2016-05-28 00:54:31 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2013-11-27 11:59:41 +04:00
|
|
|
/* 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"
|
2014-10-16 08:56:52 +04:00
|
|
|
#include "nsAutoPtr.h"
|
2014-04-01 06:55:36 +04:00
|
|
|
|
2013-11-27 11:59:41 +04:00
|
|
|
namespace mozilla {
|
2014-09-27 03:21:57 +04:00
|
|
|
namespace dom {
|
2015-09-09 14:15:05 +03:00
|
|
|
|
|
|
|
class FileHandleBase;
|
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
namespace indexedDB {
|
|
|
|
|
2014-10-16 08:56:52 +04:00
|
|
|
class ThreadLocal;
|
2014-09-27 03:21:57 +04:00
|
|
|
|
|
|
|
} // namespace indexedDB
|
|
|
|
} // namespace dom
|
|
|
|
|
2013-11-27 11:59:41 +04:00
|
|
|
namespace ipc {
|
|
|
|
|
|
|
|
// Instances of this class should never be created directly. This class is meant
|
|
|
|
// to be inherited in BackgroundImpl.
|
|
|
|
class BackgroundChildImpl : public PBackgroundChild
|
|
|
|
{
|
2014-04-01 06:55:36 +04:00
|
|
|
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();
|
|
|
|
|
2013-11-27 11:59:41 +04:00
|
|
|
protected:
|
|
|
|
BackgroundChildImpl();
|
|
|
|
virtual ~BackgroundChildImpl();
|
|
|
|
|
2014-11-20 22:48:18 +03:00
|
|
|
virtual void
|
2015-03-21 19:28:04 +03:00
|
|
|
ProcessingError(Result aCode, const char* aReason) override;
|
2014-11-20 22:48:18 +03:00
|
|
|
|
2013-11-27 11:59:41 +04:00
|
|
|
virtual void
|
2015-03-21 19:28:04 +03:00
|
|
|
ActorDestroy(ActorDestroyReason aWhy) override;
|
2013-11-27 11:59:41 +04:00
|
|
|
|
|
|
|
virtual PBackgroundTestChild*
|
2015-03-21 19:28:04 +03:00
|
|
|
AllocPBackgroundTestChild(const nsCString& aTestArg) override;
|
2013-11-27 11:59:41 +04:00
|
|
|
|
|
|
|
virtual bool
|
2015-03-21 19:28:04 +03:00
|
|
|
DeallocPBackgroundTestChild(PBackgroundTestChild* aActor) override;
|
2014-09-27 03:21:57 +04:00
|
|
|
|
|
|
|
virtual PBackgroundIDBFactoryChild*
|
2015-03-21 19:28:04 +03:00
|
|
|
AllocPBackgroundIDBFactoryChild(const LoggingInfo& aLoggingInfo) override;
|
2014-09-27 03:21:57 +04:00
|
|
|
|
|
|
|
virtual bool
|
|
|
|
DeallocPBackgroundIDBFactoryChild(PBackgroundIDBFactoryChild* aActor)
|
2015-03-21 19:28:04 +03:00
|
|
|
override;
|
2014-09-27 03:21:57 +04:00
|
|
|
|
2015-11-22 12:44:33 +03:00
|
|
|
virtual PBackgroundIndexedDBUtilsChild*
|
|
|
|
AllocPBackgroundIndexedDBUtilsChild() override;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
DeallocPBackgroundIndexedDBUtilsChild(PBackgroundIndexedDBUtilsChild* aActor)
|
|
|
|
override;
|
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
virtual PBlobChild*
|
2015-03-21 19:28:04 +03:00
|
|
|
AllocPBlobChild(const BlobConstructorParams& aParams) override;
|
2014-09-27 03:21:57 +04:00
|
|
|
|
|
|
|
virtual bool
|
2015-03-21 19:28:04 +03:00
|
|
|
DeallocPBlobChild(PBlobChild* aActor) override;
|
2014-09-27 03:21:57 +04:00
|
|
|
|
|
|
|
virtual PFileDescriptorSetChild*
|
|
|
|
AllocPFileDescriptorSetChild(const FileDescriptor& aFileDescriptor)
|
2015-03-21 19:28:04 +03:00
|
|
|
override;
|
2014-09-27 03:21:57 +04:00
|
|
|
|
|
|
|
virtual bool
|
2015-03-21 19:28:04 +03:00
|
|
|
DeallocPFileDescriptorSetChild(PFileDescriptorSetChild* aActor) override;
|
2015-01-14 02:37:00 +03:00
|
|
|
|
2015-08-31 15:51:29 +03:00
|
|
|
virtual PCamerasChild*
|
|
|
|
AllocPCamerasChild() override;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
DeallocPCamerasChild(PCamerasChild* aActor) override;
|
|
|
|
|
2015-01-14 02:37:00 +03:00
|
|
|
virtual PVsyncChild*
|
2015-03-21 19:28:04 +03:00
|
|
|
AllocPVsyncChild() override;
|
2015-01-14 02:37:00 +03:00
|
|
|
|
|
|
|
virtual bool
|
2015-03-21 19:28:04 +03:00
|
|
|
DeallocPVsyncChild(PVsyncChild* aActor) override;
|
2015-01-15 19:58:40 +03:00
|
|
|
|
2015-05-29 17:14:14 +03:00
|
|
|
virtual PUDPSocketChild*
|
|
|
|
AllocPUDPSocketChild(const OptionalPrincipalInfo& aPrincipalInfo,
|
|
|
|
const nsCString& aFilter) override;
|
|
|
|
virtual bool
|
|
|
|
DeallocPUDPSocketChild(PUDPSocketChild* aActor) override;
|
|
|
|
|
2015-01-15 19:58:40 +03:00
|
|
|
virtual PBroadcastChannelChild*
|
|
|
|
AllocPBroadcastChannelChild(const PrincipalInfo& aPrincipalInfo,
|
2015-07-06 21:28:41 +03:00
|
|
|
const nsCString& aOrigin,
|
2016-06-07 14:50:00 +03:00
|
|
|
const nsString& aChannel) override;
|
2015-01-15 19:58:40 +03:00
|
|
|
|
|
|
|
virtual bool
|
2015-03-21 19:28:04 +03:00
|
|
|
DeallocPBroadcastChannelChild(PBroadcastChannelChild* aActor) override;
|
2015-03-02 16:20:00 +03:00
|
|
|
|
2015-06-04 21:51:57 +03:00
|
|
|
virtual PServiceWorkerManagerChild*
|
|
|
|
AllocPServiceWorkerManagerChild() override;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
DeallocPServiceWorkerManagerChild(PServiceWorkerManagerChild* aActor) override;
|
|
|
|
|
2015-03-02 16:20:00 +03:00
|
|
|
virtual dom::cache::PCacheStorageChild*
|
|
|
|
AllocPCacheStorageChild(const dom::cache::Namespace& aNamespace,
|
2015-03-21 19:28:04 +03:00
|
|
|
const PrincipalInfo& aPrincipalInfo) override;
|
2015-03-02 16:20:00 +03:00
|
|
|
|
|
|
|
virtual bool
|
2015-03-21 19:28:04 +03:00
|
|
|
DeallocPCacheStorageChild(dom::cache::PCacheStorageChild* aActor) override;
|
2015-03-02 16:20:00 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual dom::cache::PCacheChild* AllocPCacheChild() override;
|
2015-03-02 16:20:00 +03:00
|
|
|
|
|
|
|
virtual bool
|
2015-03-21 19:28:04 +03:00
|
|
|
DeallocPCacheChild(dom::cache::PCacheChild* aActor) override;
|
2015-03-02 16:20:00 +03:00
|
|
|
|
|
|
|
virtual dom::cache::PCacheStreamControlChild*
|
2015-03-21 19:28:04 +03:00
|
|
|
AllocPCacheStreamControlChild() override;
|
2015-03-02 16:20:00 +03:00
|
|
|
|
|
|
|
virtual bool
|
2015-03-21 19:28:04 +03:00
|
|
|
DeallocPCacheStreamControlChild(dom::cache::PCacheStreamControlChild* aActor) override;
|
2015-06-17 13:44:27 +03:00
|
|
|
|
|
|
|
virtual PMessagePortChild*
|
|
|
|
AllocPMessagePortChild(const nsID& aUUID, const nsID& aDestinationUUID,
|
|
|
|
const uint32_t& aSequenceID) override;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
DeallocPMessagePortChild(PMessagePortChild* aActor) override;
|
2015-07-31 10:25:27 +03:00
|
|
|
|
2016-05-15 20:32:09 +03:00
|
|
|
virtual PSendStreamChild*
|
|
|
|
AllocPSendStreamChild() override;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
DeallocPSendStreamChild(PSendStreamChild* aActor) override;
|
|
|
|
|
2015-08-29 08:45:04 +03:00
|
|
|
virtual PAsmJSCacheEntryChild*
|
|
|
|
AllocPAsmJSCacheEntryChild(const dom::asmjscache::OpenMode& aOpenMode,
|
|
|
|
const dom::asmjscache::WriteParams& aWriteParams,
|
|
|
|
const PrincipalInfo& aPrincipalInfo) override;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
DeallocPAsmJSCacheEntryChild(PAsmJSCacheEntryChild* aActor) override;
|
2015-11-22 12:43:55 +03:00
|
|
|
|
|
|
|
virtual PQuotaChild*
|
|
|
|
AllocPQuotaChild() override;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
DeallocPQuotaChild(PQuotaChild* aActor) override;
|
2016-04-09 21:17:02 +03:00
|
|
|
|
|
|
|
virtual PFileSystemRequestChild*
|
|
|
|
AllocPFileSystemRequestChild(const FileSystemParams&) override;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
DeallocPFileSystemRequestChild(PFileSystemRequestChild*) override;
|
|
|
|
|
2016-06-28 01:25:00 +03:00
|
|
|
// Gamepad API Background IPC
|
|
|
|
virtual PGamepadEventChannelChild*
|
|
|
|
AllocPGamepadEventChannelChild() override;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
DeallocPGamepadEventChannelChild(PGamepadEventChannelChild* aActor) override;
|
2016-06-28 01:26:00 +03:00
|
|
|
|
|
|
|
virtual PGamepadTestChannelChild*
|
|
|
|
AllocPGamepadTestChannelChild() override;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
DeallocPGamepadTestChannelChild(PGamepadTestChannelChild* aActor) override;
|
2013-11-27 11:59:41 +04:00
|
|
|
};
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class BackgroundChildImpl::ThreadLocal final
|
2014-04-01 06:55:36 +04:00
|
|
|
{
|
|
|
|
friend class nsAutoPtr<ThreadLocal>;
|
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
public:
|
2014-10-16 08:56:52 +04:00
|
|
|
nsAutoPtr<mozilla::dom::indexedDB::ThreadLocal> mIndexedDBThreadLocal;
|
2015-09-09 14:15:05 +03:00
|
|
|
mozilla::dom::FileHandleBase* mCurrentFileHandle;
|
2014-04-01 06:55:36 +04:00
|
|
|
|
|
|
|
public:
|
|
|
|
ThreadLocal();
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Only destroyed by nsAutoPtr<ThreadLocal>.
|
|
|
|
~ThreadLocal();
|
|
|
|
};
|
|
|
|
|
2013-11-27 11:59:41 +04:00
|
|
|
} // namespace ipc
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_ipc_backgroundchildimpl_h__
|