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"
12 class TestChild MOZ_FINAL
: public mozilla::ipc::PBackgroundTestChild
14 friend class mozilla::ipc::BackgroundChildImpl
;
18 explicit TestChild(const nsCString
& aTestArg
)
21 MOZ_COUNT_CTOR(TestChild
);
27 MOZ_COUNT_DTOR(TestChild
);
32 Recv__delete__(const nsCString
& aTestArg
) MOZ_OVERRIDE
;
35 } // anonymous namespace
40 // -----------------------------------------------------------------------------
41 // BackgroundChildImpl::ThreadLocal
42 // -----------------------------------------------------------------------------
45 ThreadLocal::ThreadLocal()
47 // May happen on any thread!
48 MOZ_COUNT_CTOR(mozilla::ipc::BackgroundChildImpl::ThreadLocal
);
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
);
75 BackgroundChildImpl::ActorDestroy(ActorDestroyReason aWhy
)
77 // May happen on any thread!
81 BackgroundChildImpl::AllocPBackgroundTestChild(const nsCString
& aTestArg
)
83 return new TestChild(aTestArg
);
87 BackgroundChildImpl::DeallocPBackgroundTestChild(PBackgroundTestChild
* aActor
)
91 delete static_cast<TestChild
*>(aActor
);
96 } // namespace mozilla
99 TestChild::Recv__delete__(const nsCString
& aTestArg
)
101 MOZ_RELEASE_ASSERT(aTestArg
== mTestArg
,
102 "BackgroundTest message was corrupted!");