no bug - Import translations from android-l10n r=release a=l10n CLOSED TREE
[gecko.git] / ipc / glue / BackgroundChildImpl.h
blob8fbac75e64e9ed1024c6608a552b4be0aedc850b
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_ipc_backgroundchildimpl_h__
8 #define mozilla_ipc_backgroundchildimpl_h__
10 #include "mozilla/ipc/PBackgroundChild.h"
11 #include "mozilla/UniquePtr.h"
13 namespace mozilla {
14 namespace dom {
16 class IDBFileHandle;
18 namespace indexedDB {
20 class ThreadLocal;
22 } // namespace indexedDB
23 } // namespace dom
25 namespace ipc {
27 // Instances of this class should never be created directly. This class is meant
28 // to be inherited in BackgroundImpl.
29 class BackgroundChildImpl : public PBackgroundChild {
30 public:
31 class ThreadLocal;
33 // Get the ThreadLocal for the current thread if
34 // BackgroundChild::GetOrCreateForCurrentThread() has been called and true was
35 // returned (e.g. a valid PBackgroundChild actor has been created or is in the
36 // process of being created). Otherwise this function returns null.
37 // This functions is implemented in BackgroundImpl.cpp.
38 static ThreadLocal* GetThreadLocalForCurrentThread();
40 protected:
41 BackgroundChildImpl();
42 virtual ~BackgroundChildImpl();
44 virtual void ProcessingError(Result aCode, const char* aReason) override;
46 virtual void ActorDestroy(ActorDestroyReason aWhy) override;
48 virtual PBackgroundTestChild* AllocPBackgroundTestChild(
49 const nsACString& aTestArg) override;
51 virtual bool DeallocPBackgroundTestChild(
52 PBackgroundTestChild* aActor) override;
54 virtual PBackgroundIndexedDBUtilsChild* AllocPBackgroundIndexedDBUtilsChild()
55 override;
57 virtual bool DeallocPBackgroundIndexedDBUtilsChild(
58 PBackgroundIndexedDBUtilsChild* aActor) override;
60 virtual PBackgroundLSObserverChild* AllocPBackgroundLSObserverChild(
61 const uint64_t& aObserverId) override;
63 virtual bool DeallocPBackgroundLSObserverChild(
64 PBackgroundLSObserverChild* aActor) override;
66 virtual PBackgroundLSRequestChild* AllocPBackgroundLSRequestChild(
67 const LSRequestParams& aParams) override;
69 virtual bool DeallocPBackgroundLSRequestChild(
70 PBackgroundLSRequestChild* aActor) override;
72 virtual PBackgroundLSSimpleRequestChild* AllocPBackgroundLSSimpleRequestChild(
73 const LSSimpleRequestParams& aParams) override;
75 virtual bool DeallocPBackgroundLSSimpleRequestChild(
76 PBackgroundLSSimpleRequestChild* aActor) override;
78 virtual PBackgroundLocalStorageCacheChild*
79 AllocPBackgroundLocalStorageCacheChild(
80 const PrincipalInfo& aPrincipalInfo, const nsACString& aOriginKey,
81 const uint32_t& aPrivateBrowsingId) override;
83 virtual bool DeallocPBackgroundLocalStorageCacheChild(
84 PBackgroundLocalStorageCacheChild* aActor) override;
86 virtual PBackgroundStorageChild* AllocPBackgroundStorageChild(
87 const nsAString& aProfilePath,
88 const uint32_t& aPrivateBrowsingId) override;
90 virtual bool DeallocPBackgroundStorageChild(
91 PBackgroundStorageChild* aActor) override;
93 virtual PTemporaryIPCBlobChild* AllocPTemporaryIPCBlobChild() override;
95 virtual bool DeallocPTemporaryIPCBlobChild(
96 PTemporaryIPCBlobChild* aActor) override;
98 virtual PFileCreatorChild* AllocPFileCreatorChild(
99 const nsAString& aFullPath, const nsAString& aType,
100 const nsAString& aName, const Maybe<int64_t>& aLastModified,
101 const bool& aExistenceCheck, const bool& aIsFromNsIFile) override;
103 virtual bool DeallocPFileCreatorChild(PFileCreatorChild* aActor) override;
105 virtual mozilla::dom::PSharedWorkerChild* AllocPSharedWorkerChild(
106 const mozilla::dom::RemoteWorkerData& aData, const uint64_t& aWindowID,
107 const mozilla::dom::MessagePortIdentifier& aPortIdentifier) override;
109 virtual bool DeallocPSharedWorkerChild(
110 mozilla::dom::PSharedWorkerChild* aActor) override;
112 virtual PCamerasChild* AllocPCamerasChild() override;
114 virtual bool DeallocPCamerasChild(PCamerasChild* aActor) override;
116 virtual PUDPSocketChild* AllocPUDPSocketChild(
117 const Maybe<PrincipalInfo>& aPrincipalInfo,
118 const nsACString& aFilter) override;
119 virtual bool DeallocPUDPSocketChild(PUDPSocketChild* aActor) override;
121 virtual PBroadcastChannelChild* AllocPBroadcastChannelChild(
122 const PrincipalInfo& aPrincipalInfo, const nsACString& aOrigin,
123 const nsAString& aChannel) override;
125 virtual bool DeallocPBroadcastChannelChild(
126 PBroadcastChannelChild* aActor) override;
128 virtual PServiceWorkerManagerChild* AllocPServiceWorkerManagerChild()
129 override;
131 virtual bool DeallocPServiceWorkerManagerChild(
132 PServiceWorkerManagerChild* aActor) override;
134 virtual already_AddRefed<dom::cache::PCacheChild> AllocPCacheChild() override;
136 virtual already_AddRefed<dom::cache::PCacheStreamControlChild>
137 AllocPCacheStreamControlChild() override;
139 virtual PMessagePortChild* AllocPMessagePortChild(
140 const nsID& aUUID, const nsID& aDestinationUUID,
141 const uint32_t& aSequenceID) override;
143 virtual bool DeallocPMessagePortChild(PMessagePortChild* aActor) override;
145 virtual PWebAuthnTransactionChild* AllocPWebAuthnTransactionChild() override;
147 virtual bool DeallocPWebAuthnTransactionChild(
148 PWebAuthnTransactionChild* aActor) override;
150 already_AddRefed<PServiceWorkerChild> AllocPServiceWorkerChild(
151 const IPCServiceWorkerDescriptor&);
153 already_AddRefed<PServiceWorkerContainerChild>
154 AllocPServiceWorkerContainerChild();
156 already_AddRefed<PServiceWorkerRegistrationChild>
157 AllocPServiceWorkerRegistrationChild(
158 const IPCServiceWorkerRegistrationDescriptor&);
160 virtual PEndpointForReportChild* AllocPEndpointForReportChild(
161 const nsAString& aGroupName,
162 const PrincipalInfo& aPrincipalInfo) override;
164 virtual bool DeallocPEndpointForReportChild(
165 PEndpointForReportChild* aActor) override;
168 class BackgroundChildImpl::ThreadLocal final {
169 friend class mozilla::DefaultDelete<ThreadLocal>;
171 public:
172 mozilla::UniquePtr<mozilla::dom::indexedDB::ThreadLocal>
173 mIndexedDBThreadLocal;
174 mozilla::dom::IDBFileHandle* mCurrentFileHandle;
176 public:
177 ThreadLocal();
179 private:
180 // Only destroyed by UniquePtr<ThreadLocal>.
181 ~ThreadLocal();
184 } // namespace ipc
185 } // namespace mozilla
187 #endif // mozilla_ipc_backgroundchildimpl_h__