ipc/glue/BackgroundChildImpl.h

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:1c8a2a7f9004
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/. */
4
5 #ifndef mozilla_ipc_backgroundchildimpl_h__
6 #define mozilla_ipc_backgroundchildimpl_h__
7
8 #include "mozilla/Attributes.h"
9 #include "mozilla/ipc/PBackgroundChild.h"
10
11 template <class> class nsAutoPtr;
12
13 namespace mozilla {
14 namespace ipc {
15
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;
22
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();
30
31 protected:
32 BackgroundChildImpl();
33 virtual ~BackgroundChildImpl();
34
35 virtual void
36 ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
37
38 virtual PBackgroundTestChild*
39 AllocPBackgroundTestChild(const nsCString& aTestArg) MOZ_OVERRIDE;
40
41 virtual bool
42 DeallocPBackgroundTestChild(PBackgroundTestChild* aActor) MOZ_OVERRIDE;
43 };
44
45 class BackgroundChildImpl::ThreadLocal
46 {
47 friend class nsAutoPtr<ThreadLocal>;
48
49 // Add any members needed here.
50
51 public:
52 ThreadLocal();
53
54 private:
55 // Only destroyed by nsAutoPtr<ThreadLocal>.
56 ~ThreadLocal();
57 };
58
59 } // namespace ipc
60 } // namespace mozilla
61
62 #endif // mozilla_ipc_backgroundchildimpl_h__

mercurial