Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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
19 {
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;
43 };
45 class BackgroundChildImpl::ThreadLocal
46 {
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();
57 };
59 } // namespace ipc
60 } // namespace mozilla
62 #endif // mozilla_ipc_backgroundchildimpl_h__