Bumping manifests a=b2g-bump
[gecko.git] / ipc / glue / BackgroundChildImpl.cpp
blob789aebc53059d3a37c24ecce5dc8253648734da7
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "BackgroundChildImpl.h"
7 #include "mozilla/ipc/PBackgroundTestChild.h"
8 #include "nsTraceRefcnt.h"
10 namespace {
12 class TestChild MOZ_FINAL : public mozilla::ipc::PBackgroundTestChild
14 friend class mozilla::ipc::BackgroundChildImpl;
16 nsCString mTestArg;
18 explicit TestChild(const nsCString& aTestArg)
19 : mTestArg(aTestArg)
21 MOZ_COUNT_CTOR(TestChild);
24 protected:
25 ~TestChild()
27 MOZ_COUNT_DTOR(TestChild);
30 public:
31 virtual bool
32 Recv__delete__(const nsCString& aTestArg) MOZ_OVERRIDE;
35 } // anonymous namespace
37 namespace mozilla {
38 namespace ipc {
40 // -----------------------------------------------------------------------------
41 // BackgroundChildImpl::ThreadLocal
42 // -----------------------------------------------------------------------------
44 BackgroundChildImpl::
45 ThreadLocal::ThreadLocal()
47 // May happen on any thread!
48 MOZ_COUNT_CTOR(mozilla::ipc::BackgroundChildImpl::ThreadLocal);
51 BackgroundChildImpl::
52 ThreadLocal::~ThreadLocal()
54 // May happen on any thread!
55 MOZ_COUNT_DTOR(mozilla::ipc::BackgroundChildImpl::ThreadLocal);
58 // -----------------------------------------------------------------------------
59 // BackgroundChildImpl
60 // -----------------------------------------------------------------------------
62 BackgroundChildImpl::BackgroundChildImpl()
64 // May happen on any thread!
65 MOZ_COUNT_CTOR(mozilla::ipc::BackgroundChildImpl);
68 BackgroundChildImpl::~BackgroundChildImpl()
70 // May happen on any thread!
71 MOZ_COUNT_DTOR(mozilla::ipc::BackgroundChildImpl);
74 void
75 BackgroundChildImpl::ActorDestroy(ActorDestroyReason aWhy)
77 // May happen on any thread!
80 PBackgroundTestChild*
81 BackgroundChildImpl::AllocPBackgroundTestChild(const nsCString& aTestArg)
83 return new TestChild(aTestArg);
86 bool
87 BackgroundChildImpl::DeallocPBackgroundTestChild(PBackgroundTestChild* aActor)
89 MOZ_ASSERT(aActor);
91 delete static_cast<TestChild*>(aActor);
92 return true;
95 } // namespace ipc
96 } // namespace mozilla
98 bool
99 TestChild::Recv__delete__(const nsCString& aTestArg)
101 MOZ_RELEASE_ASSERT(aTestArg == mTestArg,
102 "BackgroundTest message was corrupted!");
104 return true;