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/. */
|
|
|
|
|
|
|
|
#include "BackgroundChildImpl.h"
|
|
|
|
|
2014-10-16 08:56:52 +04:00
|
|
|
#include "ActorsChild.h" // IndexedDB
|
2015-01-15 19:58:40 +03:00
|
|
|
#include "BroadcastChannelChild.h"
|
2015-06-04 21:51:57 +03:00
|
|
|
#include "ServiceWorkerManagerChild.h"
|
2014-09-27 03:21:57 +04:00
|
|
|
#include "FileDescriptorSetChild.h"
|
2015-09-18 09:29:14 +03:00
|
|
|
#ifdef MOZ_WEBRTC
|
2015-08-31 15:51:29 +03:00
|
|
|
#include "CamerasChild.h"
|
2015-09-18 09:29:14 +03:00
|
|
|
#endif
|
2015-08-31 15:51:29 +03:00
|
|
|
#include "mozilla/media/MediaChild.h"
|
2014-11-20 22:48:18 +03:00
|
|
|
#include "mozilla/Assertions.h"
|
2017-05-02 15:10:00 +03:00
|
|
|
#include "mozilla/SchedulerGroup.h"
|
2016-04-09 21:17:02 +03:00
|
|
|
#include "mozilla/dom/PFileSystemRequestChild.h"
|
|
|
|
#include "mozilla/dom/FileSystemTaskBase.h"
|
2015-08-29 08:45:04 +03:00
|
|
|
#include "mozilla/dom/asmjscache/AsmJSCache.h"
|
2015-03-02 16:20:00 +03:00
|
|
|
#include "mozilla/dom/cache/ActorUtils.h"
|
2014-09-27 03:21:57 +04:00
|
|
|
#include "mozilla/dom/indexedDB/PBackgroundIDBFactoryChild.h"
|
2015-11-22 12:44:33 +03:00
|
|
|
#include "mozilla/dom/indexedDB/PBackgroundIndexedDBUtilsChild.h"
|
Bug 1353629 - PBlob refactoring - part 4 - IPCBlobInputStream, r=smaug
IPCBlobInputStream is a new type of nsIInputStream that is used only in content
process when a Blob is sent from parent to child. This inputStream is for now,
just cloneable.
When the parent process sends a Blob to a content process, it has the Blob and
its inputStream. With its inputStream it creates a IPCBlobInputStreamParent
actor. This actor keeps the inputStream alive for following uses (not part of
this patch).
On the child side we will have, of course, a IPCBlobInputStreamChild actor.
This actor is able to create a IPCBlobInputStream when CreateStream() is
called. This means that 1 IPCBlobInputStreamChild can manage multiple
IPCBlobInputStreams each time one of them is cloned. When the last one of this
stream is released, the child actor sends a __delete__ request to the parent
side; the parent will be deleted, and the original inputStream, on the parent
side, will be released as well.
IPCBlobInputStream is a special inputStream because each method, except for
Available() fails. Basically, this inputStream cannot be used on the content
process for nothing else than knowing the size of the original stream.
In the following patches, I'll introduce an async way to use it.
2017-04-24 13:09:40 +03:00
|
|
|
#include "mozilla/dom/ipc/IPCBlobInputStreamChild.h"
|
2017-05-09 23:35:27 +03:00
|
|
|
#include "mozilla/dom/ipc/PendingIPCBlobChild.h"
|
2015-11-22 12:43:55 +03:00
|
|
|
#include "mozilla/dom/quota/PQuotaChild.h"
|
2016-06-28 01:25:00 +03:00
|
|
|
#include "mozilla/dom/GamepadEventChannelChild.h"
|
2016-06-28 01:26:00 +03:00
|
|
|
#include "mozilla/dom/GamepadTestChannelChild.h"
|
2015-06-17 13:44:27 +03:00
|
|
|
#include "mozilla/dom/MessagePortChild.h"
|
2017-03-14 14:29:43 +03:00
|
|
|
#include "mozilla/ipc/IPCStreamAlloc.h"
|
2013-11-27 11:59:41 +04:00
|
|
|
#include "mozilla/ipc/PBackgroundTestChild.h"
|
2017-03-14 14:28:58 +03:00
|
|
|
#include "mozilla/ipc/PChildToParentStreamChild.h"
|
2017-03-14 14:29:43 +03:00
|
|
|
#include "mozilla/ipc/PParentToChildStreamChild.h"
|
2015-01-14 02:37:00 +03:00
|
|
|
#include "mozilla/layout/VsyncChild.h"
|
2015-05-29 17:14:14 +03:00
|
|
|
#include "mozilla/net/PUDPSocketChild.h"
|
|
|
|
#include "mozilla/dom/network/UDPSocketChild.h"
|
2017-04-20 03:46:08 +03:00
|
|
|
#include "mozilla/dom/WebAuthnTransactionChild.h"
|
2014-10-16 08:56:52 +04:00
|
|
|
#include "nsID.h"
|
2013-11-27 11:59:41 +04:00
|
|
|
#include "nsTraceRefcnt.h"
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class TestChild final : public mozilla::ipc::PBackgroundTestChild
|
2013-11-27 11:59:41 +04:00
|
|
|
{
|
|
|
|
friend class mozilla::ipc::BackgroundChildImpl;
|
|
|
|
|
|
|
|
nsCString mTestArg;
|
|
|
|
|
2014-09-01 05:12:55 +04:00
|
|
|
explicit TestChild(const nsCString& aTestArg)
|
2014-09-27 03:21:57 +04:00
|
|
|
: mTestArg(aTestArg)
|
2013-11-27 11:59:41 +04:00
|
|
|
{
|
2014-07-15 19:37:45 +04:00
|
|
|
MOZ_COUNT_CTOR(TestChild);
|
2013-11-27 11:59:41 +04:00
|
|
|
}
|
|
|
|
|
2014-07-15 19:37:45 +04:00
|
|
|
protected:
|
2016-11-17 16:12:09 +03:00
|
|
|
~TestChild() override
|
2013-11-27 11:59:41 +04:00
|
|
|
{
|
2014-07-15 19:37:45 +04:00
|
|
|
MOZ_COUNT_DTOR(TestChild);
|
2013-11-27 11:59:41 +04:00
|
|
|
}
|
|
|
|
|
2014-07-15 19:37:45 +04:00
|
|
|
public:
|
2016-11-17 16:12:09 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2015-03-21 19:28:04 +03:00
|
|
|
Recv__delete__(const nsCString& aTestArg) override;
|
2013-11-27 11:59:41 +04:00
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace
|
2013-11-27 11:59:41 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace ipc {
|
|
|
|
|
2015-05-29 17:14:14 +03:00
|
|
|
using mozilla::dom::UDPSocketChild;
|
|
|
|
using mozilla::net::PUDPSocketChild;
|
|
|
|
|
2015-08-29 08:45:04 +03:00
|
|
|
using mozilla::dom::asmjscache::PAsmJSCacheEntryChild;
|
2015-03-02 16:20:00 +03:00
|
|
|
using mozilla::dom::cache::PCacheChild;
|
|
|
|
using mozilla::dom::cache::PCacheStorageChild;
|
|
|
|
using mozilla::dom::cache::PCacheStreamControlChild;
|
|
|
|
|
2017-04-20 03:46:08 +03:00
|
|
|
using mozilla::dom::WebAuthnTransactionChild;
|
|
|
|
|
2014-04-01 06:55:36 +04:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// BackgroundChildImpl::ThreadLocal
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
BackgroundChildImpl::
|
|
|
|
ThreadLocal::ThreadLocal()
|
2015-09-09 14:15:05 +03:00
|
|
|
: mCurrentFileHandle(nullptr)
|
2014-04-01 06:55:36 +04:00
|
|
|
{
|
|
|
|
// May happen on any thread!
|
|
|
|
MOZ_COUNT_CTOR(mozilla::ipc::BackgroundChildImpl::ThreadLocal);
|
|
|
|
}
|
|
|
|
|
|
|
|
BackgroundChildImpl::
|
|
|
|
ThreadLocal::~ThreadLocal()
|
|
|
|
{
|
|
|
|
// May happen on any thread!
|
|
|
|
MOZ_COUNT_DTOR(mozilla::ipc::BackgroundChildImpl::ThreadLocal);
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// BackgroundChildImpl
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2013-11-27 11:59:41 +04:00
|
|
|
BackgroundChildImpl::BackgroundChildImpl()
|
|
|
|
{
|
|
|
|
// May happen on any thread!
|
|
|
|
MOZ_COUNT_CTOR(mozilla::ipc::BackgroundChildImpl);
|
|
|
|
}
|
|
|
|
|
|
|
|
BackgroundChildImpl::~BackgroundChildImpl()
|
|
|
|
{
|
|
|
|
// May happen on any thread!
|
|
|
|
MOZ_COUNT_DTOR(mozilla::ipc::BackgroundChildImpl);
|
|
|
|
}
|
|
|
|
|
2014-11-20 22:48:18 +03:00
|
|
|
void
|
2015-02-03 20:09:27 +03:00
|
|
|
BackgroundChildImpl::ProcessingError(Result aCode, const char* aReason)
|
2014-11-20 22:48:18 +03:00
|
|
|
{
|
|
|
|
// May happen on any thread!
|
|
|
|
|
|
|
|
nsAutoCString abortMessage;
|
|
|
|
|
2015-02-03 20:09:27 +03:00
|
|
|
switch (aCode) {
|
2014-11-20 22:48:18 +03:00
|
|
|
|
|
|
|
#define HANDLE_CASE(_result) \
|
|
|
|
case _result: \
|
|
|
|
abortMessage.AssignLiteral(#_result); \
|
|
|
|
break
|
|
|
|
|
|
|
|
HANDLE_CASE(MsgDropped);
|
|
|
|
HANDLE_CASE(MsgNotKnown);
|
|
|
|
HANDLE_CASE(MsgNotAllowed);
|
|
|
|
HANDLE_CASE(MsgPayloadError);
|
|
|
|
HANDLE_CASE(MsgProcessingError);
|
|
|
|
HANDLE_CASE(MsgRouteError);
|
|
|
|
HANDLE_CASE(MsgValueError);
|
|
|
|
|
|
|
|
#undef HANDLE_CASE
|
|
|
|
|
|
|
|
default:
|
|
|
|
MOZ_CRASH("Unknown error code!");
|
|
|
|
}
|
|
|
|
|
2017-02-21 20:01:48 +03:00
|
|
|
MOZ_CRASH_UNSAFE_PRINTF("%s: %s", abortMessage.get(), aReason);
|
2014-11-20 22:48:18 +03:00
|
|
|
}
|
|
|
|
|
2013-11-27 11:59:41 +04:00
|
|
|
void
|
|
|
|
BackgroundChildImpl::ActorDestroy(ActorDestroyReason aWhy)
|
|
|
|
{
|
|
|
|
// May happen on any thread!
|
|
|
|
}
|
|
|
|
|
|
|
|
PBackgroundTestChild*
|
|
|
|
BackgroundChildImpl::AllocPBackgroundTestChild(const nsCString& aTestArg)
|
|
|
|
{
|
|
|
|
return new TestChild(aTestArg);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundChildImpl::DeallocPBackgroundTestChild(PBackgroundTestChild* aActor)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
delete static_cast<TestChild*>(aActor);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
BackgroundChildImpl::PBackgroundIDBFactoryChild*
|
2014-10-16 08:56:52 +04:00
|
|
|
BackgroundChildImpl::AllocPBackgroundIDBFactoryChild(
|
|
|
|
const LoggingInfo& aLoggingInfo)
|
2014-09-27 03:21:57 +04:00
|
|
|
{
|
|
|
|
MOZ_CRASH("PBackgroundIDBFactoryChild actors should be manually "
|
|
|
|
"constructed!");
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundChildImpl::DeallocPBackgroundIDBFactoryChild(
|
|
|
|
PBackgroundIDBFactoryChild* aActor)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
delete aActor;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-11-22 12:44:33 +03:00
|
|
|
BackgroundChildImpl::PBackgroundIndexedDBUtilsChild*
|
|
|
|
BackgroundChildImpl::AllocPBackgroundIndexedDBUtilsChild()
|
|
|
|
{
|
|
|
|
MOZ_CRASH("PBackgroundIndexedDBUtilsChild actors should be manually "
|
|
|
|
"constructed!");
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundChildImpl::DeallocPBackgroundIndexedDBUtilsChild(
|
|
|
|
PBackgroundIndexedDBUtilsChild* aActor)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
delete aActor;
|
|
|
|
return true;
|
2017-03-29 11:40:38 +03:00
|
|
|
}
|
|
|
|
|
2017-05-09 23:35:27 +03:00
|
|
|
PPendingIPCBlobChild*
|
|
|
|
BackgroundChildImpl::AllocPPendingIPCBlobChild(const IPCBlob& aBlob)
|
|
|
|
{
|
|
|
|
return new mozilla::dom::PendingIPCBlobChild(aBlob);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundChildImpl::DeallocPPendingIPCBlobChild(PPendingIPCBlobChild* aActor)
|
|
|
|
{
|
|
|
|
delete aActor;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
Bug 1353629 - PBlob refactoring - part 4 - IPCBlobInputStream, r=smaug
IPCBlobInputStream is a new type of nsIInputStream that is used only in content
process when a Blob is sent from parent to child. This inputStream is for now,
just cloneable.
When the parent process sends a Blob to a content process, it has the Blob and
its inputStream. With its inputStream it creates a IPCBlobInputStreamParent
actor. This actor keeps the inputStream alive for following uses (not part of
this patch).
On the child side we will have, of course, a IPCBlobInputStreamChild actor.
This actor is able to create a IPCBlobInputStream when CreateStream() is
called. This means that 1 IPCBlobInputStreamChild can manage multiple
IPCBlobInputStreams each time one of them is cloned. When the last one of this
stream is released, the child actor sends a __delete__ request to the parent
side; the parent will be deleted, and the original inputStream, on the parent
side, will be released as well.
IPCBlobInputStream is a special inputStream because each method, except for
Available() fails. Basically, this inputStream cannot be used on the content
process for nothing else than knowing the size of the original stream.
In the following patches, I'll introduce an async way to use it.
2017-04-24 13:09:40 +03:00
|
|
|
PIPCBlobInputStreamChild*
|
|
|
|
BackgroundChildImpl::AllocPIPCBlobInputStreamChild(const nsID& aID,
|
|
|
|
const uint64_t& aSize)
|
|
|
|
{
|
|
|
|
// IPCBlobInputStreamChild is refcounted. Here it's created and in
|
|
|
|
// DeallocPIPCBlobInputStreamChild is released.
|
|
|
|
|
|
|
|
RefPtr<mozilla::dom::IPCBlobInputStreamChild> actor =
|
|
|
|
new mozilla::dom::IPCBlobInputStreamChild(aID, aSize);
|
|
|
|
return actor.forget().take();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundChildImpl::DeallocPIPCBlobInputStreamChild(PIPCBlobInputStreamChild* aActor)
|
|
|
|
{
|
|
|
|
RefPtr<mozilla::dom::IPCBlobInputStreamChild> actor =
|
|
|
|
dont_AddRef(static_cast<mozilla::dom::IPCBlobInputStreamChild*>(aActor));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
PFileDescriptorSetChild*
|
|
|
|
BackgroundChildImpl::AllocPFileDescriptorSetChild(
|
|
|
|
const FileDescriptor& aFileDescriptor)
|
|
|
|
{
|
|
|
|
return new FileDescriptorSetChild(aFileDescriptor);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundChildImpl::DeallocPFileDescriptorSetChild(
|
|
|
|
PFileDescriptorSetChild* aActor)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
delete static_cast<FileDescriptorSetChild*>(aActor);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-01-14 02:37:00 +03:00
|
|
|
BackgroundChildImpl::PVsyncChild*
|
|
|
|
BackgroundChildImpl::AllocPVsyncChild()
|
|
|
|
{
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::layout::VsyncChild> actor = new mozilla::layout::VsyncChild();
|
2015-01-30 00:19:00 +03:00
|
|
|
// There still has one ref-count after return, and it will be released in
|
|
|
|
// DeallocPVsyncChild().
|
|
|
|
return actor.forget().take();
|
2015-01-14 02:37:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundChildImpl::DeallocPVsyncChild(PVsyncChild* aActor)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
2015-01-30 00:19:00 +03:00
|
|
|
// This actor already has one ref-count. Please check AllocPVsyncChild().
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::layout::VsyncChild> actor =
|
2015-01-30 00:19:00 +03:00
|
|
|
dont_AddRef(static_cast<mozilla::layout::VsyncChild*>(aActor));
|
2015-01-14 02:37:00 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-05-29 17:14:14 +03:00
|
|
|
PUDPSocketChild*
|
|
|
|
BackgroundChildImpl::AllocPUDPSocketChild(const OptionalPrincipalInfo& aPrincipalInfo,
|
|
|
|
const nsCString& aFilter)
|
|
|
|
{
|
|
|
|
MOZ_CRASH("AllocPUDPSocket should not be called");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundChildImpl::DeallocPUDPSocketChild(PUDPSocketChild* child)
|
|
|
|
{
|
|
|
|
|
|
|
|
UDPSocketChild* p = static_cast<UDPSocketChild*>(child);
|
|
|
|
p->ReleaseIPDLReference();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-01-15 19:58:40 +03:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// BroadcastChannel API
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
dom::PBroadcastChannelChild*
|
|
|
|
BackgroundChildImpl::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)
|
2015-01-15 19:58:40 +03:00
|
|
|
{
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<dom::BroadcastChannelChild> agent =
|
2015-04-01 14:41:29 +03:00
|
|
|
new dom::BroadcastChannelChild(aOrigin);
|
2015-01-15 19:58:40 +03:00
|
|
|
return agent.forget().take();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundChildImpl::DeallocPBroadcastChannelChild(
|
|
|
|
PBroadcastChannelChild* aActor)
|
|
|
|
{
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<dom::BroadcastChannelChild> child =
|
2015-01-15 19:58:40 +03:00
|
|
|
dont_AddRef(static_cast<dom::BroadcastChannelChild*>(aActor));
|
|
|
|
MOZ_ASSERT(child);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-08-31 15:51:29 +03:00
|
|
|
camera::PCamerasChild*
|
|
|
|
BackgroundChildImpl::AllocPCamerasChild()
|
|
|
|
{
|
2015-09-18 09:29:14 +03:00
|
|
|
#ifdef MOZ_WEBRTC
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<camera::CamerasChild> agent =
|
2015-08-31 15:51:29 +03:00
|
|
|
new camera::CamerasChild();
|
|
|
|
return agent.forget().take();
|
2015-09-18 09:29:14 +03:00
|
|
|
#else
|
|
|
|
return nullptr;
|
|
|
|
#endif
|
2015-08-31 15:51:29 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundChildImpl::DeallocPCamerasChild(camera::PCamerasChild *aActor)
|
|
|
|
{
|
2015-09-18 09:29:14 +03:00
|
|
|
#ifdef MOZ_WEBRTC
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<camera::CamerasChild> child =
|
2015-08-31 15:51:29 +03:00
|
|
|
dont_AddRef(static_cast<camera::CamerasChild*>(aActor));
|
|
|
|
MOZ_ASSERT(aActor);
|
2015-09-18 09:29:14 +03:00
|
|
|
#endif
|
2015-08-31 15:51:29 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-06-04 21:51:57 +03:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// ServiceWorkerManager
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
dom::PServiceWorkerManagerChild*
|
|
|
|
BackgroundChildImpl::AllocPServiceWorkerManagerChild()
|
|
|
|
{
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<dom::workers::ServiceWorkerManagerChild> agent =
|
2015-06-04 21:51:57 +03:00
|
|
|
new dom::workers::ServiceWorkerManagerChild();
|
|
|
|
return agent.forget().take();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundChildImpl::DeallocPServiceWorkerManagerChild(
|
|
|
|
PServiceWorkerManagerChild* aActor)
|
|
|
|
{
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<dom::workers::ServiceWorkerManagerChild> child =
|
2015-06-04 21:51:57 +03:00
|
|
|
dont_AddRef(static_cast<dom::workers::ServiceWorkerManagerChild*>(aActor));
|
|
|
|
MOZ_ASSERT(child);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-03-02 16:20:00 +03:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// Cache API
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
PCacheStorageChild*
|
|
|
|
BackgroundChildImpl::AllocPCacheStorageChild(const Namespace& aNamespace,
|
|
|
|
const PrincipalInfo& aPrincipalInfo)
|
|
|
|
{
|
|
|
|
MOZ_CRASH("CacheStorageChild actor must be provided to PBackground manager");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundChildImpl::DeallocPCacheStorageChild(PCacheStorageChild* aActor)
|
|
|
|
{
|
|
|
|
dom::cache::DeallocPCacheStorageChild(aActor);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
PCacheChild*
|
|
|
|
BackgroundChildImpl::AllocPCacheChild()
|
|
|
|
{
|
|
|
|
return dom::cache::AllocPCacheChild();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundChildImpl::DeallocPCacheChild(PCacheChild* aActor)
|
|
|
|
{
|
|
|
|
dom::cache::DeallocPCacheChild(aActor);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
PCacheStreamControlChild*
|
|
|
|
BackgroundChildImpl::AllocPCacheStreamControlChild()
|
|
|
|
{
|
|
|
|
return dom::cache::AllocPCacheStreamControlChild();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundChildImpl::DeallocPCacheStreamControlChild(PCacheStreamControlChild* aActor)
|
|
|
|
{
|
|
|
|
dom::cache::DeallocPCacheStreamControlChild(aActor);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-06-17 13:44:27 +03:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// MessageChannel/MessagePort API
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
dom::PMessagePortChild*
|
|
|
|
BackgroundChildImpl::AllocPMessagePortChild(const nsID& aUUID,
|
|
|
|
const nsID& aDestinationUUID,
|
|
|
|
const uint32_t& aSequenceID)
|
|
|
|
{
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<dom::MessagePortChild> agent = new dom::MessagePortChild();
|
2015-06-17 13:44:27 +03:00
|
|
|
return agent.forget().take();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundChildImpl::DeallocPMessagePortChild(PMessagePortChild* aActor)
|
|
|
|
{
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<dom::MessagePortChild> child =
|
2015-06-17 13:44:27 +03:00
|
|
|
dont_AddRef(static_cast<dom::MessagePortChild*>(aActor));
|
|
|
|
MOZ_ASSERT(child);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-03-14 14:28:58 +03:00
|
|
|
PChildToParentStreamChild*
|
|
|
|
BackgroundChildImpl::AllocPChildToParentStreamChild()
|
2016-05-15 20:32:09 +03:00
|
|
|
{
|
2017-03-14 14:28:58 +03:00
|
|
|
MOZ_CRASH("PChildToParentStreamChild actors should be manually constructed!");
|
2016-05-15 20:32:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2017-03-14 14:28:58 +03:00
|
|
|
BackgroundChildImpl::DeallocPChildToParentStreamChild(PChildToParentStreamChild* aActor)
|
2016-05-15 20:32:09 +03:00
|
|
|
{
|
|
|
|
delete aActor;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-03-14 14:29:43 +03:00
|
|
|
PParentToChildStreamChild*
|
|
|
|
BackgroundChildImpl::AllocPParentToChildStreamChild()
|
|
|
|
{
|
|
|
|
return mozilla::ipc::AllocPParentToChildStreamChild();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundChildImpl::DeallocPParentToChildStreamChild(PParentToChildStreamChild* aActor)
|
|
|
|
{
|
|
|
|
delete aActor;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-08-29 08:45:04 +03:00
|
|
|
PAsmJSCacheEntryChild*
|
|
|
|
BackgroundChildImpl::AllocPAsmJSCacheEntryChild(
|
|
|
|
const dom::asmjscache::OpenMode& aOpenMode,
|
|
|
|
const dom::asmjscache::WriteParams& aWriteParams,
|
|
|
|
const PrincipalInfo& aPrincipalInfo)
|
|
|
|
{
|
|
|
|
MOZ_CRASH("PAsmJSCacheEntryChild actors should be manually constructed!");
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundChildImpl::DeallocPAsmJSCacheEntryChild(PAsmJSCacheEntryChild* aActor)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
dom::asmjscache::DeallocEntryChild(aActor);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-11-22 12:43:55 +03:00
|
|
|
BackgroundChildImpl::PQuotaChild*
|
|
|
|
BackgroundChildImpl::AllocPQuotaChild()
|
|
|
|
{
|
|
|
|
MOZ_CRASH("PQuotaChild actor should be manually constructed!");
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundChildImpl::DeallocPQuotaChild(PQuotaChild* aActor)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
|
|
|
|
delete aActor;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-04-09 21:17:02 +03:00
|
|
|
dom::PFileSystemRequestChild*
|
|
|
|
BackgroundChildImpl::AllocPFileSystemRequestChild(const FileSystemParams& aParams)
|
|
|
|
{
|
|
|
|
MOZ_CRASH("Should never get here!");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundChildImpl::DeallocPFileSystemRequestChild(PFileSystemRequestChild* aActor)
|
|
|
|
{
|
|
|
|
// The reference is increased in FileSystemTaskBase::Start of
|
|
|
|
// FileSystemTaskBase.cpp. We should decrease it after IPC.
|
2016-04-09 21:17:28 +03:00
|
|
|
RefPtr<dom::FileSystemTaskChildBase> child =
|
|
|
|
dont_AddRef(static_cast<dom::FileSystemTaskChildBase*>(aActor));
|
2016-04-09 21:17:02 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-06-28 01:25:00 +03:00
|
|
|
// Gamepad API Background IPC
|
|
|
|
dom::PGamepadEventChannelChild*
|
|
|
|
BackgroundChildImpl::AllocPGamepadEventChannelChild()
|
|
|
|
{
|
|
|
|
MOZ_CRASH("PGamepadEventChannelChild actor should be manually constructed!");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundChildImpl::DeallocPGamepadEventChannelChild(PGamepadEventChannelChild* aActor)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
delete static_cast<dom::GamepadEventChannelChild*>(aActor);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-06-28 01:26:00 +03:00
|
|
|
dom::PGamepadTestChannelChild*
|
|
|
|
BackgroundChildImpl::AllocPGamepadTestChannelChild()
|
|
|
|
{
|
|
|
|
MOZ_CRASH("PGamepadTestChannelChild actor should be manually constructed!");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundChildImpl::DeallocPGamepadTestChannelChild(PGamepadTestChannelChild* aActor)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
delete static_cast<dom::GamepadTestChannelChild*>(aActor);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-05-02 15:10:00 +03:00
|
|
|
#ifdef EARLY_BETA_OR_EARLIER
|
|
|
|
void
|
|
|
|
BackgroundChildImpl::OnChannelReceivedMessage(const Message& aMsg)
|
|
|
|
{
|
2017-05-19 07:58:18 +03:00
|
|
|
// Telemetry collection temporarily disabled in bug 1366156.
|
|
|
|
#if 0
|
2017-05-02 15:10:00 +03:00
|
|
|
if (aMsg.type() == layout::PVsync::MessageType::Msg_Notify__ID) {
|
|
|
|
// Not really necessary to look at the message payload, it will be
|
|
|
|
// <0.5ms away from TimeStamp::Now()
|
|
|
|
SchedulerGroup::MarkVsyncReceived();
|
|
|
|
}
|
2017-05-19 07:58:18 +03:00
|
|
|
#endif
|
2017-05-02 15:10:00 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-04-20 03:46:08 +03:00
|
|
|
dom::PWebAuthnTransactionChild*
|
|
|
|
BackgroundChildImpl::AllocPWebAuthnTransactionChild()
|
|
|
|
{
|
|
|
|
MOZ_CRASH("PWebAuthnTransaction actor should be manually constructed!");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BackgroundChildImpl::DeallocPWebAuthnTransactionChild(PWebAuthnTransactionChild* aActor)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
RefPtr<dom::WebAuthnTransactionChild> child =
|
|
|
|
dont_AddRef(static_cast<dom::WebAuthnTransactionChild*>(aActor));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-11-27 11:59:41 +04:00
|
|
|
} // namespace ipc
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2013-11-27 11:59:41 +04:00
|
|
|
TestChild::Recv__delete__(const nsCString& aTestArg)
|
|
|
|
{
|
|
|
|
MOZ_RELEASE_ASSERT(aTestArg == mTestArg,
|
|
|
|
"BackgroundTest message was corrupted!");
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2013-11-27 11:59:41 +04:00
|
|
|
}
|