michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "BackgroundChildImpl.h" michael@0: michael@0: #include "mozilla/ipc/PBackgroundTestChild.h" michael@0: #include "nsTraceRefcnt.h" michael@0: michael@0: namespace { michael@0: michael@0: class TestChild MOZ_FINAL : public mozilla::ipc::PBackgroundTestChild michael@0: { michael@0: friend class mozilla::ipc::BackgroundChildImpl; michael@0: michael@0: nsCString mTestArg; michael@0: michael@0: TestChild(const nsCString& aTestArg) michael@0: : mTestArg(aTestArg) michael@0: { michael@0: MOZ_COUNT_CTOR(mozilla::ipc::BackgroundTestChild); michael@0: } michael@0: michael@0: ~TestChild() michael@0: { michael@0: MOZ_COUNT_DTOR(mozilla::ipc::BackgroundTestChild); michael@0: } michael@0: michael@0: virtual bool michael@0: Recv__delete__(const nsCString& aTestArg) MOZ_OVERRIDE; michael@0: }; michael@0: michael@0: } // anonymous namespace michael@0: michael@0: namespace mozilla { michael@0: namespace ipc { michael@0: michael@0: // ----------------------------------------------------------------------------- michael@0: // BackgroundChildImpl::ThreadLocal michael@0: // ----------------------------------------------------------------------------- michael@0: michael@0: BackgroundChildImpl:: michael@0: ThreadLocal::ThreadLocal() michael@0: { michael@0: // May happen on any thread! michael@0: MOZ_COUNT_CTOR(mozilla::ipc::BackgroundChildImpl::ThreadLocal); michael@0: } michael@0: michael@0: BackgroundChildImpl:: michael@0: ThreadLocal::~ThreadLocal() michael@0: { michael@0: // May happen on any thread! michael@0: MOZ_COUNT_DTOR(mozilla::ipc::BackgroundChildImpl::ThreadLocal); michael@0: } michael@0: michael@0: // ----------------------------------------------------------------------------- michael@0: // BackgroundChildImpl michael@0: // ----------------------------------------------------------------------------- michael@0: michael@0: BackgroundChildImpl::BackgroundChildImpl() michael@0: { michael@0: // May happen on any thread! michael@0: MOZ_COUNT_CTOR(mozilla::ipc::BackgroundChildImpl); michael@0: } michael@0: michael@0: BackgroundChildImpl::~BackgroundChildImpl() michael@0: { michael@0: // May happen on any thread! michael@0: MOZ_COUNT_DTOR(mozilla::ipc::BackgroundChildImpl); michael@0: } michael@0: michael@0: void michael@0: BackgroundChildImpl::ActorDestroy(ActorDestroyReason aWhy) michael@0: { michael@0: // May happen on any thread! michael@0: } michael@0: michael@0: PBackgroundTestChild* michael@0: BackgroundChildImpl::AllocPBackgroundTestChild(const nsCString& aTestArg) michael@0: { michael@0: return new TestChild(aTestArg); michael@0: } michael@0: michael@0: bool michael@0: BackgroundChildImpl::DeallocPBackgroundTestChild(PBackgroundTestChild* aActor) michael@0: { michael@0: MOZ_ASSERT(aActor); michael@0: michael@0: delete static_cast(aActor); michael@0: return true; michael@0: } michael@0: michael@0: } // namespace ipc michael@0: } // namespace mozilla michael@0: michael@0: bool michael@0: TestChild::Recv__delete__(const nsCString& aTestArg) michael@0: { michael@0: MOZ_RELEASE_ASSERT(aTestArg == mTestArg, michael@0: "BackgroundTest message was corrupted!"); michael@0: michael@0: return true; michael@0: }