Bumping manifests a=b2g-bump
[gecko.git] / ipc / glue / BackgroundChildImpl.h
blob5a43f8af4025b8821b60258bc09a5875097fdbdd
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 #ifndef mozilla_ipc_backgroundchildimpl_h__
6 #define mozilla_ipc_backgroundchildimpl_h__
8 #include "mozilla/Attributes.h"
9 #include "mozilla/ipc/PBackgroundChild.h"
11 template <class> class nsAutoPtr;
13 namespace mozilla {
14 namespace ipc {
16 // Instances of this class should never be created directly. This class is meant
17 // to be inherited in BackgroundImpl.
18 class BackgroundChildImpl : public PBackgroundChild
20 public:
21 class ThreadLocal;
23 // Get the ThreadLocal for the current thread if
24 // BackgroundChild::GetOrCreateForCurrentThread() has been called and true was
25 // returned (e.g. a valid PBackgroundChild actor has been created or is in the
26 // process of being created). Otherwise this function returns null.
27 // This functions is implemented in BackgroundImpl.cpp.
28 static ThreadLocal*
29 GetThreadLocalForCurrentThread();
31 protected:
32 BackgroundChildImpl();
33 virtual ~BackgroundChildImpl();
35 virtual void
36 ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
38 virtual PBackgroundTestChild*
39 AllocPBackgroundTestChild(const nsCString& aTestArg) MOZ_OVERRIDE;
41 virtual bool
42 DeallocPBackgroundTestChild(PBackgroundTestChild* aActor) MOZ_OVERRIDE;
45 class BackgroundChildImpl::ThreadLocal
47 friend class nsAutoPtr<ThreadLocal>;
49 // Add any members needed here.
51 public:
52 ThreadLocal();
54 private:
55 // Only destroyed by nsAutoPtr<ThreadLocal>.
56 ~ThreadLocal();
59 } // namespace ipc
60 } // namespace mozilla
62 #endif // mozilla_ipc_backgroundchildimpl_h__