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: #ifndef mozilla_ipc_backgroundchildimpl_h__ michael@0: #define mozilla_ipc_backgroundchildimpl_h__ michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "mozilla/ipc/PBackgroundChild.h" michael@0: michael@0: template class nsAutoPtr; michael@0: michael@0: namespace mozilla { michael@0: namespace ipc { michael@0: michael@0: // Instances of this class should never be created directly. This class is meant michael@0: // to be inherited in BackgroundImpl. michael@0: class BackgroundChildImpl : public PBackgroundChild michael@0: { michael@0: public: michael@0: class ThreadLocal; michael@0: michael@0: // Get the ThreadLocal for the current thread if michael@0: // BackgroundChild::GetOrCreateForCurrentThread() has been called and true was michael@0: // returned (e.g. a valid PBackgroundChild actor has been created or is in the michael@0: // process of being created). Otherwise this function returns null. michael@0: // This functions is implemented in BackgroundImpl.cpp. michael@0: static ThreadLocal* michael@0: GetThreadLocalForCurrentThread(); michael@0: michael@0: protected: michael@0: BackgroundChildImpl(); michael@0: virtual ~BackgroundChildImpl(); michael@0: michael@0: virtual void michael@0: ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE; michael@0: michael@0: virtual PBackgroundTestChild* michael@0: AllocPBackgroundTestChild(const nsCString& aTestArg) MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: DeallocPBackgroundTestChild(PBackgroundTestChild* aActor) MOZ_OVERRIDE; michael@0: }; michael@0: michael@0: class BackgroundChildImpl::ThreadLocal michael@0: { michael@0: friend class nsAutoPtr; michael@0: michael@0: // Add any members needed here. michael@0: michael@0: public: michael@0: ThreadLocal(); michael@0: michael@0: private: michael@0: // Only destroyed by nsAutoPtr. michael@0: ~ThreadLocal(); michael@0: }; michael@0: michael@0: } // namespace ipc michael@0: } // namespace mozilla michael@0: michael@0: #endif // mozilla_ipc_backgroundchildimpl_h__