forked from Floorp-Projects/Floorp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBackgroundChildImpl.h
97 lines (71 loc) · 2.61 KB
/
BackgroundChildImpl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_ipc_backgroundchildimpl_h__
#define mozilla_ipc_backgroundchildimpl_h__
#include "mozilla/Attributes.h"
#include "mozilla/ipc/PBackgroundChild.h"
template <class> class nsAutoPtr;
namespace mozilla {
namespace dom {
namespace indexedDB {
class IDBTransaction;
} // namespace indexedDB
} // namespace dom
namespace ipc {
// Instances of this class should never be created directly. This class is meant
// to be inherited in BackgroundImpl.
class BackgroundChildImpl : public PBackgroundChild
{
public:
class ThreadLocal;
// Get the ThreadLocal for the current thread if
// BackgroundChild::GetOrCreateForCurrentThread() has been called and true was
// returned (e.g. a valid PBackgroundChild actor has been created or is in the
// process of being created). Otherwise this function returns null.
// This functions is implemented in BackgroundImpl.cpp.
static ThreadLocal*
GetThreadLocalForCurrentThread();
protected:
BackgroundChildImpl();
virtual ~BackgroundChildImpl();
virtual void
ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
virtual PBackgroundTestChild*
AllocPBackgroundTestChild(const nsCString& aTestArg) MOZ_OVERRIDE;
virtual bool
DeallocPBackgroundTestChild(PBackgroundTestChild* aActor) MOZ_OVERRIDE;
virtual PBackgroundIDBFactoryChild*
AllocPBackgroundIDBFactoryChild(const OptionalWindowId& aOptionalWindowId)
MOZ_OVERRIDE;
virtual bool
DeallocPBackgroundIDBFactoryChild(PBackgroundIDBFactoryChild* aActor)
MOZ_OVERRIDE;
virtual PBlobChild*
AllocPBlobChild(const BlobConstructorParams& aParams) MOZ_OVERRIDE;
virtual bool
DeallocPBlobChild(PBlobChild* aActor) MOZ_OVERRIDE;
virtual PFileDescriptorSetChild*
AllocPFileDescriptorSetChild(const FileDescriptor& aFileDescriptor)
MOZ_OVERRIDE;
virtual bool
DeallocPFileDescriptorSetChild(PFileDescriptorSetChild* aActor) MOZ_OVERRIDE;
};
class BackgroundChildImpl::ThreadLocal MOZ_FINAL
{
friend class nsAutoPtr<ThreadLocal>;
public:
mozilla::dom::indexedDB::IDBTransaction* mCurrentTransaction;
#ifdef MOZ_ENABLE_PROFILER_SPS
uint64_t mNextTransactionSerialNumber;
uint64_t mNextRequestSerialNumber;
#endif
public:
ThreadLocal();
private:
// Only destroyed by nsAutoPtr<ThreadLocal>.
~ThreadLocal();
};
} // namespace ipc
} // namespace mozilla
#endif // mozilla_ipc_backgroundchildimpl_h__