Backed out changeset c92612ac17d3 (bug 1359718) for bustage in IPCBlobInputStreamChild.cpp. r=backout on a CLOSED TREE

This commit is contained in:
Sebastian Hengst 2017-05-23 18:35:24 +02:00
Родитель 77897ad1e3
Коммит 2ac2023c15
27 изменённых файлов: 517 добавлений и 11 удалений

Просмотреть файл

@ -25,6 +25,8 @@
#include "mozilla/dom/PBlobStreamChild.h"
#include "mozilla/dom/PBlobStreamParent.h"
#include "mozilla/dom/indexedDB/FileSnapshot.h"
#include "mozilla/dom/ipc/MemoryStreamChild.h"
#include "mozilla/dom/ipc/MemoryStreamParent.h"
#include "mozilla/dom/IndexedDatabaseManager.h"
#include "mozilla/ipc/InputStreamUtils.h"
#include "mozilla/ipc/IPCStreamUtils.h"
@ -618,6 +620,115 @@ struct MOZ_STACK_CLASS CreateBlobImplMetadata final
}
};
template<class M>
PMemoryStreamChild*
SerializeInputStreamInChunks(nsIInputStream* aInputStream, uint64_t aLength,
M* aManager)
{
MOZ_ASSERT(aInputStream);
PMemoryStreamChild* child = aManager->SendPMemoryStreamConstructor(aLength);
if (NS_WARN_IF(!child)) {
return nullptr;
}
const uint64_t kMaxChunk = 1024 * 1024;
while (aLength) {
FallibleTArray<uint8_t> buffer;
uint64_t size = XPCOM_MIN(aLength, kMaxChunk);
if (NS_WARN_IF(!buffer.SetLength(size, fallible))) {
return nullptr;
}
uint32_t read;
nsresult rv = aInputStream->Read(reinterpret_cast<char*>(buffer.Elements()),
size, &read);
if (NS_WARN_IF(NS_FAILED(rv))) {
return nullptr;
}
if (NS_WARN_IF(read == 0)) {
// We were not expecting a read==0 here.
return nullptr;
}
MOZ_ASSERT(read <= size);
aLength -= read;
if (NS_WARN_IF(!buffer.SetLength(read, fallible))) {
return nullptr;
}
if (NS_WARN_IF(!child->SendAddChunk(buffer))) {
return nullptr;
}
}
return child;
}
void
DeleteStreamMemoryFromBlobDataStream(BlobDataStream& aStream)
{
if (aStream.type() == BlobDataStream::TMemoryBlobDataStream) {
PMemoryStreamChild* actor =
aStream.get_MemoryBlobDataStream().streamChild();
if (actor) {
actor->Send__delete__(actor);
}
}
}
void
DeleteStreamMemoryFromBlobData(BlobData& aBlobData)
{
switch (aBlobData.type()) {
case BlobData::TBlobDataStream:
DeleteStreamMemoryFromBlobDataStream(aBlobData.get_BlobDataStream());
return;
case BlobData::TArrayOfBlobData: {
nsTArray<BlobData>& arrayBlobData = aBlobData.get_ArrayOfBlobData();
for (uint32_t i = 0; i < arrayBlobData.Length(); ++i) {
DeleteStreamMemoryFromBlobData(arrayBlobData[i]);
}
return;
}
default:
// Nothing to do here.
return;
}
}
void
DeleteStreamMemoryFromOptionalBlobData(OptionalBlobData& aParams)
{
if (aParams.type() == OptionalBlobData::Tvoid_t) {
return;
}
DeleteStreamMemoryFromBlobData(aParams.get_BlobData());
}
void
DeleteStreamMemory(AnyBlobConstructorParams& aParams)
{
if (aParams.type() == AnyBlobConstructorParams::TFileBlobConstructorParams) {
FileBlobConstructorParams& fileParams = aParams.get_FileBlobConstructorParams();
DeleteStreamMemoryFromOptionalBlobData(fileParams.optionalBlobData());
return;
}
if (aParams.type() == AnyBlobConstructorParams::TNormalBlobConstructorParams) {
NormalBlobConstructorParams& normalParams = aParams.get_NormalBlobConstructorParams();
DeleteStreamMemoryFromOptionalBlobData(normalParams.optionalBlobData());
return;
}
}
} // namespace
already_AddRefed<BlobImpl>
@ -649,16 +760,32 @@ CreateBlobImpl(const BlobDataStream& aStream,
nsCOMPtr<nsIInputStream> inputStream;
uint64_t length;
MOZ_ASSERT(aStream.type() == BlobDataStream::TIPCStream);
inputStream = DeserializeIPCStream(aStream.get_IPCStream());
if (!inputStream) {
ASSERT_UNLESS_FUZZING();
return nullptr;
}
if (aStream.type() == BlobDataStream::TMemoryBlobDataStream) {
const MemoryBlobDataStream& memoryBlobDataStream =
aStream.get_MemoryBlobDataStream();
nsresult rv = inputStream->Available(&length);
if (NS_WARN_IF(NS_FAILED(rv))) {
return nullptr;
MemoryStreamParent* actor =
static_cast<MemoryStreamParent*>(memoryBlobDataStream.streamParent());
actor->GetStream(getter_AddRefs(inputStream));
if (!inputStream) {
ASSERT_UNLESS_FUZZING();
return nullptr;
}
length = memoryBlobDataStream.length();
} else {
MOZ_ASSERT(aStream.type() == BlobDataStream::TIPCStream);
inputStream = DeserializeIPCStream(aStream.get_IPCStream());
if (!inputStream) {
ASSERT_UNLESS_FUZZING();
return nullptr;
}
nsresult rv = inputStream->Available(&length);
if (NS_WARN_IF(NS_FAILED(rv))) {
return nullptr;
}
}
RefPtr<BlobImpl> blobImpl;
@ -912,7 +1039,14 @@ BlobDataFromBlobImpl(ChildManagerType* aManager, BlobImpl* aBlobImpl,
return true;
}
return false;
PMemoryStreamChild* streamActor =
SerializeInputStreamInChunks(inputStream, length, aManager);
if (!streamActor) {
return false;
}
aBlobData = MemoryBlobDataStream(nullptr, streamActor, length);
return true;
}
RemoteInputStream::RemoteInputStream(BlobImpl* aBlobImpl,
@ -3570,6 +3704,8 @@ BlobChild::GetOrCreateFromImpl(ChildManagerType* aManager,
return nullptr;
}
DeleteStreamMemory(params.blobParams());
autoIPCStreams.Clear();
return actor;
}

Просмотреть файл

@ -0,0 +1,22 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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_dom_ipc_MemoryStreamChild_h
#define mozilla_dom_ipc_MemoryStreamChild_h
#include "mozilla/ipc/PMemoryStreamChild.h"
namespace mozilla {
namespace dom {
class MemoryStreamChild final : public mozilla::ipc::PMemoryStreamChild
{
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_ipc_MemoryStreamChild_h

Просмотреть файл

@ -0,0 +1,78 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 "MemoryStreamParent.h"
#include "nsIInputStream.h"
namespace mozilla {
namespace dom {
MemoryStreamParent::MemoryStreamParent(uint64_t aSize)
: mSize(aSize)
, mCurSize(0)
{}
mozilla::ipc::IPCResult
MemoryStreamParent::RecvAddChunk(nsTArray<unsigned char>&& aData)
{
MOZ_ASSERT(mSize);
uint64_t dataLength = aData.Length();
if (!dataLength || mSize < (mCurSize + dataLength)) {
return IPC_FAIL_NO_REASON(this);
}
void* buffer = malloc(dataLength);
if (NS_WARN_IF(!buffer)) {
return IPC_FAIL_NO_REASON(this);
}
memcpy(buffer, aData.Elements(), dataLength);
mData.AppendElement(new MemoryBlobImpl::DataOwner(buffer, dataLength));
mCurSize += dataLength;
return IPC_OK();
}
void
MemoryStreamParent::ActorDestroy(IProtocol::ActorDestroyReason)
{
}
void
MemoryStreamParent::GetStream(nsIInputStream** aInputStream)
{
if (mCurSize != mSize) {
*aInputStream = nullptr;
return;
}
nsCOMPtr<nsIMultiplexInputStream> stream =
do_CreateInstance("@mozilla.org/io/multiplex-input-stream;1");
if (NS_WARN_IF(!stream)) {
*aInputStream = nullptr;
return;
}
for (uint32_t i = 0; i < mData.Length(); ++i) {
nsCOMPtr<nsIInputStream> dataStream;
nsresult rv =
MemoryBlobImpl::DataOwnerAdapter::Create(mData[i], 0, mData[i]->mLength,
getter_AddRefs(dataStream));
if (NS_WARN_IF(NS_FAILED(rv))) {
*aInputStream = nullptr;
return;
}
stream->AppendStream(dataStream);
}
stream.forget(aInputStream);
}
} // namespace dom
} // namespace mozilla

Просмотреть файл

@ -0,0 +1,40 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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_dom_ipc_MemoryStreamParent_h
#define mozilla_dom_ipc_MemoryStreamParent_h
#include "mozilla/ipc/PMemoryStreamParent.h"
#include "mozilla/dom/MemoryBlobImpl.h"
namespace mozilla {
namespace dom {
class MemoryStreamParent final : public mozilla::ipc::PMemoryStreamParent
{
public:
explicit MemoryStreamParent(uint64_t aSize);
mozilla::ipc::IPCResult
RecvAddChunk(nsTArray<unsigned char>&& aData) override;
void
ActorDestroy(IProtocol::ActorDestroyReason) override;
void
GetStream(nsIInputStream** aInputStream);
private:
uint64_t mSize;
uint64_t mCurSize;
nsTArray<RefPtr<MemoryBlobImpl::DataOwner>> mData;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_ipc_MemoryStreamParent_h

Просмотреть файл

@ -9,6 +9,7 @@ include protocol PContentBridge;
include protocol PFileDescriptorSet;
include protocol PChildToParentStream;
include protocol PParentToChildStream;
include protocol PMemoryStream;
include BlobTypes;
include DOMTypes;

Просмотреть файл

@ -0,0 +1,23 @@
/* 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 protocol PBackground;
include protocol PContent;
include protocol PContentBridge;
namespace mozilla {
namespace ipc {
protocol PMemoryStream
{
manager PBackground or PContent or PContentBridge;
parent:
async AddChunk(uint8_t[] data);
async __delete__();
};
} // namespace dom
} // namespace mozilla

Просмотреть файл

@ -11,6 +11,8 @@ EXPORTS.mozilla.dom.ipc += [
'IPCBlobInputStreamChild.h',
'IPCBlobInputStreamParent.h',
'IPCBlobInputStreamStorage.h',
'MemoryStreamChild.h',
'MemoryStreamParent.h',
'nsIRemoteBlob.h',
'PendingIPCBlobChild.h',
'PendingIPCBlobParent.h',
@ -27,6 +29,7 @@ UNIFIED_SOURCES += [
'IPCBlobInputStreamParent.cpp',
'IPCBlobInputStreamStorage.cpp',
'IPCBlobUtils.cpp',
'MemoryStreamParent.cpp',
'PendingIPCBlobChild.cpp',
'PendingIPCBlobParent.cpp',
]
@ -37,6 +40,7 @@ IPDL_SOURCES += [
'PBlob.ipdl',
'PBlobStream.ipdl',
'PIPCBlobInputStream.ipdl',
'PMemoryStream.ipdl',
'PPendingIPCBlob.ipdl',
]

Просмотреть файл

@ -68,6 +68,12 @@ ContentBridgeChild::SendPBlobConstructor(PBlobChild* actor,
return PContentBridgeChild::SendPBlobConstructor(actor, params);
}
PMemoryStreamChild*
ContentBridgeChild::SendPMemoryStreamConstructor(const uint64_t& aSize)
{
return PContentBridgeChild::SendPMemoryStreamConstructor(aSize);
}
bool
ContentBridgeChild::SendPBrowserConstructor(PBrowserChild* aActor,
const TabId& aTabId,
@ -174,6 +180,18 @@ ContentBridgeChild::DeallocPBlobChild(PBlobChild* aActor)
return nsIContentChild::DeallocPBlobChild(aActor);
}
PMemoryStreamChild*
ContentBridgeChild::AllocPMemoryStreamChild(const uint64_t& aSize)
{
return nsIContentChild::AllocPMemoryStreamChild(aSize);
}
bool
ContentBridgeChild::DeallocPMemoryStreamChild(PMemoryStreamChild* aActor)
{
return nsIContentChild::DeallocPMemoryStreamChild(aActor);
}
PIPCBlobInputStreamChild*
ContentBridgeChild::AllocPIPCBlobInputStreamChild(const nsID& aID,
const uint64_t& aSize)

Просмотреть файл

@ -36,6 +36,9 @@ public:
SendPBlobConstructor(PBlobChild* actor,
const BlobConstructorParams& aParams) override;
virtual PMemoryStreamChild*
SendPMemoryStreamConstructor(const uint64_t& aSize) override;
jsipc::CPOWManager* GetCPOWManager() override;
virtual bool SendPBrowserConstructor(PBrowserChild* aActor,
@ -85,6 +88,10 @@ protected:
virtual PBlobChild* AllocPBlobChild(const BlobConstructorParams& aParams) override;
virtual bool DeallocPBlobChild(PBlobChild*) override;
virtual PMemoryStreamChild*
AllocPMemoryStreamChild(const uint64_t& aSize) override;
virtual bool DeallocPMemoryStreamChild(PMemoryStreamChild*) override;
virtual PIPCBlobInputStreamChild*
AllocPIPCBlobInputStreamChild(const nsID& aID,
const uint64_t& aSize) override;

Просмотреть файл

@ -7,6 +7,7 @@
#include "mozilla/dom/ContentBridgeParent.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
#include "mozilla/dom/ipc/MemoryStreamParent.h"
#include "nsXULAppAPI.h"
#include "nsIObserverService.h"
#include "base/task.h"
@ -139,6 +140,18 @@ ContentBridgeParent::SendPIPCBlobInputStreamConstructor(PIPCBlobInputStreamParen
PContentBridgeParent::SendPIPCBlobInputStreamConstructor(aActor, aID, aSize);
}
PMemoryStreamParent*
ContentBridgeParent::AllocPMemoryStreamParent(const uint64_t& aSize)
{
return nsIContentParent::AllocPMemoryStreamParent(aSize);
}
bool
ContentBridgeParent::DeallocPMemoryStreamParent(PMemoryStreamParent* aActor)
{
return nsIContentParent::DeallocPMemoryStreamParent(aActor);
}
PIPCBlobInputStreamParent*
ContentBridgeParent::AllocPIPCBlobInputStreamParent(const nsID& aID,
const uint64_t& aSize)

Просмотреть файл

@ -138,6 +138,11 @@ protected:
virtual bool DeallocPBlobParent(PBlobParent*) override;
virtual PMemoryStreamParent*
AllocPMemoryStreamParent(const uint64_t& aSize) override;
virtual bool DeallocPMemoryStreamParent(PMemoryStreamParent*) override;
virtual PIPCBlobInputStreamParent*
SendPIPCBlobInputStreamConstructor(PIPCBlobInputStreamParent* aActor,
const nsID& aID,

Просмотреть файл

@ -1633,6 +1633,18 @@ ContentChild::DeallocPBrowserChild(PBrowserChild* aIframe)
return nsIContentChild::DeallocPBrowserChild(aIframe);
}
PMemoryStreamChild*
ContentChild::AllocPMemoryStreamChild(const uint64_t& aSize)
{
return nsIContentChild::AllocPMemoryStreamChild(aSize);
}
bool
ContentChild::DeallocPMemoryStreamChild(PMemoryStreamChild* aActor)
{
return nsIContentChild::DeallocPMemoryStreamChild(aActor);
}
PIPCBlobInputStreamChild*
ContentChild::AllocPIPCBlobInputStreamChild(const nsID& aID,
const uint64_t& aSize)
@ -1683,6 +1695,16 @@ ContentChild::SendPBlobConstructor(PBlobChild* aActor,
return PContentChild::SendPBlobConstructor(aActor, aParams);
}
PMemoryStreamChild*
ContentChild::SendPMemoryStreamConstructor(const uint64_t& aSize)
{
if (IsShuttingDown()) {
return nullptr;
}
return PContentChild::SendPMemoryStreamConstructor(aSize);
}
PPresentationChild*
ContentChild::AllocPPresentationChild()
{

Просмотреть файл

@ -189,6 +189,12 @@ public:
virtual bool DeallocPBlobChild(PBlobChild* aActor) override;
virtual PMemoryStreamChild*
AllocPMemoryStreamChild(const uint64_t& aSize) override;
virtual bool
DeallocPMemoryStreamChild(PMemoryStreamChild* aActor) override;
virtual PIPCBlobInputStreamChild*
AllocPIPCBlobInputStreamChild(const nsID& aID,
const uint64_t& aSize) override;
@ -517,6 +523,9 @@ public:
SendPBlobConstructor(PBlobChild* actor,
const BlobConstructorParams& params) override;
virtual PMemoryStreamChild*
SendPMemoryStreamConstructor(const uint64_t& aSize) override;
virtual PFileDescriptorSetChild*
SendPFileDescriptorSetConstructor(const FileDescriptor&) override;

Просмотреть файл

@ -2850,6 +2850,18 @@ ContentParent::DeallocPBlobParent(PBlobParent* aActor)
return nsIContentParent::DeallocPBlobParent(aActor);
}
PMemoryStreamParent*
ContentParent::AllocPMemoryStreamParent(const uint64_t& aSize)
{
return nsIContentParent::AllocPMemoryStreamParent(aSize);
}
bool
ContentParent::DeallocPMemoryStreamParent(PMemoryStreamParent* aActor)
{
return nsIContentParent::DeallocPMemoryStreamParent(aActor);
}
PIPCBlobInputStreamParent*
ContentParent::AllocPIPCBlobInputStreamParent(const nsID& aID,
const uint64_t& aSize)

Просмотреть файл

@ -849,6 +849,11 @@ private:
virtual bool DeallocPBlobParent(PBlobParent* aActor) override;
virtual PMemoryStreamParent*
AllocPMemoryStreamParent(const uint64_t& aSize) override;
virtual bool DeallocPMemoryStreamParent(PMemoryStreamParent* aActor) override;
virtual PIPCBlobInputStreamParent*
SendPIPCBlobInputStreamConstructor(PIPCBlobInputStreamParent* aActor,
const nsID& aID,

Просмотреть файл

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
include protocol PBlob;
include protocol PMemoryStream;
include IPCBlob;
include IPCStream;
@ -46,9 +47,18 @@ struct ClonedMessageData
MessagePortIdentifier[] identfiers;
};
// I could remove this completely, but this will be gone in the following patch.
struct MemoryBlobDataStream
{
PMemoryStream stream;
uint64_t length;
};
union BlobDataStream
{
MemoryBlobDataStream;
// InputStreamParams is used only when we are _sure_ that the serialized size
// is lower than 1 Mb. Otherwise we use MemoryBlobDataStream.
IPCStream;
};

Просмотреть файл

@ -21,6 +21,7 @@ include protocol PProcessHangMonitor;
include protocol PImageBridge;
include protocol PIPCBlobInputStream;
include protocol PMedia;
include protocol PMemoryStream;
include protocol PNecko;
include protocol PGMPContent;
include protocol PGMPService;
@ -294,6 +295,7 @@ nested(upto inside_cpow) sync protocol PContent
manages PHeapSnapshotTempFileHelper;
manages PIPCBlobInputStream;
manages PMedia;
manages PMemoryStream;
manages PNecko;
manages POfflineCacheUpdate;
manages PPrinting;
@ -678,6 +680,8 @@ parent:
async PRemoteSpellcheckEngine();
async PMemoryStream(uint64_t aSize);
async InitCrashReporter(Shmem shmem, NativeThreadId tid);
/**

Просмотреть файл

@ -10,6 +10,7 @@ include protocol PContent;
include protocol PJavaScript;
include protocol PFileDescriptorSet;
include protocol PChildToParentStream;
include protocol PMemoryStream;
include protocol PParentToChildStream;
include protocol PIPCBlobInputStream;
@ -42,6 +43,7 @@ nested(upto inside_cpow) sync protocol PContentBridge
manages PFileDescriptorSet;
manages PJavaScript;
manages PChildToParentStream;
manages PMemoryStream;
manages PParentToChildStream;
manages PIPCBlobInputStream;
@ -69,6 +71,8 @@ parent:
async PChildToParentStream();
async PMemoryStream(uint64_t aSize);
both:
// Both the parent and the child can construct the PBrowser.
// See the comment in PContent::PBrowser().

Просмотреть файл

@ -20,6 +20,7 @@
#include "mozilla/ipc/IPCStreamSource.h"
#include "mozilla/ipc/PChildToParentStreamChild.h"
#include "mozilla/ipc/PParentToChildStreamChild.h"
#include "mozilla/dom/ipc/MemoryStreamChild.h"
#include "mozilla/dom/ipc/IPCBlobInputStreamChild.h"
#include "nsPrintfCString.h"
@ -106,6 +107,19 @@ nsIContentChild::RecvPBrowserConstructor(PBrowserChild* aActor,
return IPC_OK();
}
PMemoryStreamChild*
nsIContentChild::AllocPMemoryStreamChild(const uint64_t& aSize)
{
return new MemoryStreamChild();
}
bool
nsIContentChild::DeallocPMemoryStreamChild(PMemoryStreamChild* aActor)
{
delete aActor;
return true;
}
PIPCBlobInputStreamChild*
nsIContentChild::AllocPIPCBlobInputStreamChild(const nsID& aID,
const uint64_t& aSize)

Просмотреть файл

@ -64,6 +64,9 @@ public:
SendPBlobConstructor(PBlobChild* aActor,
const BlobConstructorParams& aParams) = 0;
virtual mozilla::ipc::PMemoryStreamChild*
SendPMemoryStreamConstructor(const uint64_t& aSize) = 0;
virtual bool
SendPBrowserConstructor(PBrowserChild* aActor,
const TabId& aTabId,
@ -103,6 +106,11 @@ protected:
virtual bool DeallocPBlobChild(PBlobChild* aActor);
virtual mozilla::ipc::PMemoryStreamChild*
AllocPMemoryStreamChild(const uint64_t& aSize);
virtual bool DeallocPMemoryStreamChild(mozilla::ipc::PMemoryStreamChild* aActor);
virtual mozilla::ipc::PIPCBlobInputStreamChild*
AllocPIPCBlobInputStreamChild(const nsID& aID, const uint64_t& aSize);

Просмотреть файл

@ -16,6 +16,7 @@
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/ipc/BlobParent.h"
#include "mozilla/dom/ipc/IPCBlobInputStreamParent.h"
#include "mozilla/dom/ipc/MemoryStreamParent.h"
#include "mozilla/dom/ipc/StructuredCloneData.h"
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
#include "mozilla/ipc/FileDescriptorSetParent.h"
@ -218,6 +219,19 @@ nsIContentParent::DeallocPBlobParent(PBlobParent* aActor)
return true;
}
PMemoryStreamParent*
nsIContentParent::AllocPMemoryStreamParent(const uint64_t& aSize)
{
return new MemoryStreamParent(aSize);
}
bool
nsIContentParent::DeallocPMemoryStreamParent(PMemoryStreamParent* aActor)
{
delete aActor;
return true;
}
PIPCBlobInputStreamParent*
nsIContentParent::AllocPIPCBlobInputStreamParent(const nsID& aID,
const uint64_t& aSize)

Просмотреть файл

@ -36,6 +36,7 @@ namespace ipc {
class PFileDescriptorSetParent;
class PChildToParentStreamParent;
class PParentToChildStreamParent;
class PMemoryStreamParent;
class PIPCBlobInputStreamParent;
}
@ -129,6 +130,11 @@ protected: // IPDL methods
virtual bool DeallocPBlobParent(PBlobParent* aActor);
virtual mozilla::ipc::PMemoryStreamParent*
AllocPMemoryStreamParent(const uint64_t& aSize);
virtual bool DeallocPMemoryStreamParent(mozilla::ipc::PMemoryStreamParent* aActor);
virtual mozilla::ipc::PIPCBlobInputStreamParent*
AllocPIPCBlobInputStreamParent(const nsID& aID, const uint64_t& aSize);

Просмотреть файл

@ -25,6 +25,7 @@
#include "mozilla/dom/indexedDB/PBackgroundIndexedDBUtilsChild.h"
#include "mozilla/dom/ipc/BlobChild.h"
#include "mozilla/dom/ipc/IPCBlobInputStreamChild.h"
#include "mozilla/dom/ipc/MemoryStreamChild.h"
#include "mozilla/dom/ipc/PendingIPCBlobChild.h"
#include "mozilla/dom/quota/PQuotaChild.h"
#include "mozilla/dom/GamepadEventChannelChild.h"
@ -221,6 +222,19 @@ BackgroundChildImpl::DeallocPBlobChild(PBlobChild* aActor)
return true;
}
PMemoryStreamChild*
BackgroundChildImpl::AllocPMemoryStreamChild(const uint64_t& aSize)
{
return new mozilla::dom::MemoryStreamChild();
}
bool
BackgroundChildImpl::DeallocPMemoryStreamChild(PMemoryStreamChild* aActor)
{
delete aActor;
return true;
}
PPendingIPCBlobChild*
BackgroundChildImpl::AllocPPendingIPCBlobChild(const IPCBlob& aBlob)
{

Просмотреть файл

@ -76,6 +76,12 @@ protected:
virtual bool
DeallocPBlobChild(PBlobChild* aActor) override;
virtual PMemoryStreamChild*
AllocPMemoryStreamChild(const uint64_t& aSize) override;
virtual bool
DeallocPMemoryStreamChild(PMemoryStreamChild* aActor) override;
virtual PPendingIPCBlobChild*
AllocPPendingIPCBlobChild(const IPCBlob& aBlob) override;

Просмотреть файл

@ -29,6 +29,7 @@
#include "mozilla/dom/indexedDB/ActorsParent.h"
#include "mozilla/dom/ipc/BlobParent.h"
#include "mozilla/dom/ipc/IPCBlobInputStreamParent.h"
#include "mozilla/dom/ipc/MemoryStreamParent.h"
#include "mozilla/dom/ipc/PendingIPCBlobParent.h"
#include "mozilla/dom/quota/ActorsParent.h"
#include "mozilla/ipc/BackgroundParent.h"
@ -270,6 +271,26 @@ BackgroundParentImpl::DeallocPBlobParent(PBlobParent* aActor)
return true;
}
PMemoryStreamParent*
BackgroundParentImpl::AllocPMemoryStreamParent(const uint64_t& aSize)
{
AssertIsInMainProcess();
AssertIsOnBackgroundThread();
return new mozilla::dom::MemoryStreamParent(aSize);
}
bool
BackgroundParentImpl::DeallocPMemoryStreamParent(PMemoryStreamParent* aActor)
{
AssertIsInMainProcess();
AssertIsOnBackgroundThread();
MOZ_ASSERT(aActor);
delete aActor;
return true;
}
PPendingIPCBlobParent*
BackgroundParentImpl::AllocPPendingIPCBlobParent(const IPCBlob& aBlob)
{

Просмотреть файл

@ -69,6 +69,12 @@ protected:
virtual bool
DeallocPBlobParent(PBlobParent* aActor) override;
virtual PMemoryStreamParent*
AllocPMemoryStreamParent(const uint64_t& aSize) override;
virtual bool
DeallocPMemoryStreamParent(PMemoryStreamParent* aActor) override;
virtual PPendingIPCBlobParent*
AllocPPendingIPCBlobParent(const IPCBlob& aBlob) override;

Просмотреть файл

@ -17,6 +17,7 @@ include protocol PGamepadEventChannel;
include protocol PGamepadTestChannel;
include protocol PIPCBlobInputStream;
include protocol PPendingIPCBlob;
include protocol PMemoryStream;
include protocol PMessagePort;
include protocol PCameras;
include protocol PQuota;
@ -64,6 +65,7 @@ sync protocol PBackground
manages PGamepadEventChannel;
manages PGamepadTestChannel;
manages PIPCBlobInputStream;
manages PMemoryStream;
manages PPendingIPCBlob;
manages PMessagePort;
manages PCameras;
@ -117,6 +119,8 @@ parent:
async PGamepadTestChannel();
async PMemoryStream(uint64_t aSize);
async PWebAuthnTransaction();
child: