From 9106ae7b59774f531cac84d2dbfd0aaad271f129 Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Tue, 23 May 2017 18:00:30 +0200 Subject: [PATCH] Bug 1359718 - Get rid of PBlob - part 0 - remove PMemoryStream, r=smaug --- dom/file/ipc/Blob.cpp | 156 ++-------------------------- dom/file/ipc/MemoryStreamChild.h | 22 ---- dom/file/ipc/MemoryStreamParent.cpp | 78 -------------- dom/file/ipc/MemoryStreamParent.h | 40 ------- dom/file/ipc/PBlob.ipdl | 1 - dom/file/ipc/PMemoryStream.ipdl | 23 ---- dom/file/ipc/moz.build | 4 - dom/ipc/ContentBridgeChild.cpp | 18 ---- dom/ipc/ContentBridgeChild.h | 7 -- dom/ipc/ContentBridgeParent.cpp | 13 --- dom/ipc/ContentBridgeParent.h | 5 - dom/ipc/ContentChild.cpp | 22 ---- dom/ipc/ContentChild.h | 9 -- dom/ipc/ContentParent.cpp | 12 --- dom/ipc/ContentParent.h | 5 - dom/ipc/DOMTypes.ipdlh | 12 +-- dom/ipc/PContent.ipdl | 4 - dom/ipc/PContentBridge.ipdl | 4 - dom/ipc/nsIContentChild.cpp | 14 --- dom/ipc/nsIContentChild.h | 8 -- dom/ipc/nsIContentParent.cpp | 14 --- dom/ipc/nsIContentParent.h | 6 -- ipc/glue/BackgroundChildImpl.cpp | 14 --- ipc/glue/BackgroundChildImpl.h | 6 -- ipc/glue/BackgroundParentImpl.cpp | 21 ---- ipc/glue/BackgroundParentImpl.h | 6 -- ipc/glue/PBackground.ipdl | 4 - 27 files changed, 11 insertions(+), 517 deletions(-) delete mode 100644 dom/file/ipc/MemoryStreamChild.h delete mode 100644 dom/file/ipc/MemoryStreamParent.cpp delete mode 100644 dom/file/ipc/MemoryStreamParent.h delete mode 100644 dom/file/ipc/PMemoryStream.ipdl diff --git a/dom/file/ipc/Blob.cpp b/dom/file/ipc/Blob.cpp index ad89d1a99339..26d17dd76f71 100644 --- a/dom/file/ipc/Blob.cpp +++ b/dom/file/ipc/Blob.cpp @@ -25,8 +25,6 @@ #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" @@ -620,115 +618,6 @@ struct MOZ_STACK_CLASS CreateBlobImplMetadata final } }; -template -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 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(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& 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 @@ -760,32 +649,16 @@ CreateBlobImpl(const BlobDataStream& aStream, nsCOMPtr inputStream; uint64_t length; - if (aStream.type() == BlobDataStream::TMemoryBlobDataStream) { - const MemoryBlobDataStream& memoryBlobDataStream = - aStream.get_MemoryBlobDataStream(); + MOZ_ASSERT(aStream.type() == BlobDataStream::TIPCStream); + inputStream = DeserializeIPCStream(aStream.get_IPCStream()); + if (!inputStream) { + ASSERT_UNLESS_FUZZING(); + return nullptr; + } - MemoryStreamParent* actor = - static_cast(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; - } + nsresult rv = inputStream->Available(&length); + if (NS_WARN_IF(NS_FAILED(rv))) { + return nullptr; } RefPtr blobImpl; @@ -1039,14 +912,7 @@ BlobDataFromBlobImpl(ChildManagerType* aManager, BlobImpl* aBlobImpl, return true; } - PMemoryStreamChild* streamActor = - SerializeInputStreamInChunks(inputStream, length, aManager); - if (!streamActor) { - return false; - } - - aBlobData = MemoryBlobDataStream(nullptr, streamActor, length); - return true; + return false; } RemoteInputStream::RemoteInputStream(BlobImpl* aBlobImpl, @@ -3704,8 +3570,6 @@ BlobChild::GetOrCreateFromImpl(ChildManagerType* aManager, return nullptr; } - DeleteStreamMemory(params.blobParams()); - autoIPCStreams.Clear(); return actor; } diff --git a/dom/file/ipc/MemoryStreamChild.h b/dom/file/ipc/MemoryStreamChild.h deleted file mode 100644 index ac2a456cbafc..000000000000 --- a/dom/file/ipc/MemoryStreamChild.h +++ /dev/null @@ -1,22 +0,0 @@ -/* -*- 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 diff --git a/dom/file/ipc/MemoryStreamParent.cpp b/dom/file/ipc/MemoryStreamParent.cpp deleted file mode 100644 index 9b2b2405141d..000000000000 --- a/dom/file/ipc/MemoryStreamParent.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- 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&& 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 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 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 diff --git a/dom/file/ipc/MemoryStreamParent.h b/dom/file/ipc/MemoryStreamParent.h deleted file mode 100644 index d0f22bef5768..000000000000 --- a/dom/file/ipc/MemoryStreamParent.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- 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&& aData) override; - - void - ActorDestroy(IProtocol::ActorDestroyReason) override; - - void - GetStream(nsIInputStream** aInputStream); - -private: - uint64_t mSize; - uint64_t mCurSize; - - nsTArray> mData; -}; - -} // namespace dom -} // namespace mozilla - -#endif // mozilla_dom_ipc_MemoryStreamParent_h diff --git a/dom/file/ipc/PBlob.ipdl b/dom/file/ipc/PBlob.ipdl index 786befe1595d..7cd4cbe85677 100644 --- a/dom/file/ipc/PBlob.ipdl +++ b/dom/file/ipc/PBlob.ipdl @@ -9,7 +9,6 @@ include protocol PContentBridge; include protocol PFileDescriptorSet; include protocol PChildToParentStream; include protocol PParentToChildStream; -include protocol PMemoryStream; include BlobTypes; include DOMTypes; diff --git a/dom/file/ipc/PMemoryStream.ipdl b/dom/file/ipc/PMemoryStream.ipdl deleted file mode 100644 index a76f5159d95f..000000000000 --- a/dom/file/ipc/PMemoryStream.ipdl +++ /dev/null @@ -1,23 +0,0 @@ -/* 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 diff --git a/dom/file/ipc/moz.build b/dom/file/ipc/moz.build index eedfab091919..996e7c4cf32c 100644 --- a/dom/file/ipc/moz.build +++ b/dom/file/ipc/moz.build @@ -11,8 +11,6 @@ EXPORTS.mozilla.dom.ipc += [ 'IPCBlobInputStreamChild.h', 'IPCBlobInputStreamParent.h', 'IPCBlobInputStreamStorage.h', - 'MemoryStreamChild.h', - 'MemoryStreamParent.h', 'nsIRemoteBlob.h', 'PendingIPCBlobChild.h', 'PendingIPCBlobParent.h', @@ -29,7 +27,6 @@ UNIFIED_SOURCES += [ 'IPCBlobInputStreamParent.cpp', 'IPCBlobInputStreamStorage.cpp', 'IPCBlobUtils.cpp', - 'MemoryStreamParent.cpp', 'PendingIPCBlobChild.cpp', 'PendingIPCBlobParent.cpp', ] @@ -40,7 +37,6 @@ IPDL_SOURCES += [ 'PBlob.ipdl', 'PBlobStream.ipdl', 'PIPCBlobInputStream.ipdl', - 'PMemoryStream.ipdl', 'PPendingIPCBlob.ipdl', ] diff --git a/dom/ipc/ContentBridgeChild.cpp b/dom/ipc/ContentBridgeChild.cpp index b22795bc6259..6eb217dc330d 100644 --- a/dom/ipc/ContentBridgeChild.cpp +++ b/dom/ipc/ContentBridgeChild.cpp @@ -68,12 +68,6 @@ 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, @@ -180,18 +174,6 @@ 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) diff --git a/dom/ipc/ContentBridgeChild.h b/dom/ipc/ContentBridgeChild.h index 21c5e3277b60..112209c7b209 100644 --- a/dom/ipc/ContentBridgeChild.h +++ b/dom/ipc/ContentBridgeChild.h @@ -36,9 +36,6 @@ 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, @@ -88,10 +85,6 @@ 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; diff --git a/dom/ipc/ContentBridgeParent.cpp b/dom/ipc/ContentBridgeParent.cpp index 95436c3b2e7e..7dcc01b39c8b 100644 --- a/dom/ipc/ContentBridgeParent.cpp +++ b/dom/ipc/ContentBridgeParent.cpp @@ -7,7 +7,6 @@ #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" @@ -140,18 +139,6 @@ 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) diff --git a/dom/ipc/ContentBridgeParent.h b/dom/ipc/ContentBridgeParent.h index 0ec2b5f7d5db..85bf9e27bf55 100644 --- a/dom/ipc/ContentBridgeParent.h +++ b/dom/ipc/ContentBridgeParent.h @@ -138,11 +138,6 @@ 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, diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 31b32a10c693..3612d108817c 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -1633,18 +1633,6 @@ 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) @@ -1695,16 +1683,6 @@ 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() { diff --git a/dom/ipc/ContentChild.h b/dom/ipc/ContentChild.h index 8dbf5319cfdf..f172482161b8 100644 --- a/dom/ipc/ContentChild.h +++ b/dom/ipc/ContentChild.h @@ -189,12 +189,6 @@ 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; @@ -523,9 +517,6 @@ public: SendPBlobConstructor(PBlobChild* actor, const BlobConstructorParams& params) override; - virtual PMemoryStreamChild* - SendPMemoryStreamConstructor(const uint64_t& aSize) override; - virtual PFileDescriptorSetChild* SendPFileDescriptorSetConstructor(const FileDescriptor&) override; diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 21d7191e73ce..acffd79651e9 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -2850,18 +2850,6 @@ 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) diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index 87be8f5e19f1..b50c944ac84d 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -849,11 +849,6 @@ 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, diff --git a/dom/ipc/DOMTypes.ipdlh b/dom/ipc/DOMTypes.ipdlh index 20b3fbbf7c66..3889aca1a2d0 100644 --- a/dom/ipc/DOMTypes.ipdlh +++ b/dom/ipc/DOMTypes.ipdlh @@ -5,7 +5,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ include protocol PBlob; -include protocol PMemoryStream; include IPCBlob; include IPCStream; @@ -47,18 +46,9 @@ struct ClonedMessageData MessagePortIdentifier[] identfiers; }; -struct MemoryBlobDataStream -{ - PMemoryStream stream; - uint64_t length; -}; - +// I could remove this completely, but this will be gone in the following patch. 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; }; diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/PContent.ipdl index 565eb744cf46..c3f04c7b8560 100644 --- a/dom/ipc/PContent.ipdl +++ b/dom/ipc/PContent.ipdl @@ -21,7 +21,6 @@ include protocol PProcessHangMonitor; include protocol PImageBridge; include protocol PIPCBlobInputStream; include protocol PMedia; -include protocol PMemoryStream; include protocol PNecko; include protocol PGMPContent; include protocol PGMPService; @@ -295,7 +294,6 @@ nested(upto inside_cpow) sync protocol PContent manages PHeapSnapshotTempFileHelper; manages PIPCBlobInputStream; manages PMedia; - manages PMemoryStream; manages PNecko; manages POfflineCacheUpdate; manages PPrinting; @@ -680,8 +678,6 @@ parent: async PRemoteSpellcheckEngine(); - async PMemoryStream(uint64_t aSize); - async InitCrashReporter(Shmem shmem, NativeThreadId tid); /** diff --git a/dom/ipc/PContentBridge.ipdl b/dom/ipc/PContentBridge.ipdl index ac88b7a053c0..d6977b498cc8 100644 --- a/dom/ipc/PContentBridge.ipdl +++ b/dom/ipc/PContentBridge.ipdl @@ -10,7 +10,6 @@ include protocol PContent; include protocol PJavaScript; include protocol PFileDescriptorSet; include protocol PChildToParentStream; -include protocol PMemoryStream; include protocol PParentToChildStream; include protocol PIPCBlobInputStream; @@ -43,7 +42,6 @@ nested(upto inside_cpow) sync protocol PContentBridge manages PFileDescriptorSet; manages PJavaScript; manages PChildToParentStream; - manages PMemoryStream; manages PParentToChildStream; manages PIPCBlobInputStream; @@ -71,8 +69,6 @@ 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(). diff --git a/dom/ipc/nsIContentChild.cpp b/dom/ipc/nsIContentChild.cpp index c9787279e643..91b3f62bd849 100644 --- a/dom/ipc/nsIContentChild.cpp +++ b/dom/ipc/nsIContentChild.cpp @@ -20,7 +20,6 @@ #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" @@ -107,19 +106,6 @@ 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) diff --git a/dom/ipc/nsIContentChild.h b/dom/ipc/nsIContentChild.h index 960931cdc15c..e5a1cfcaa7c8 100644 --- a/dom/ipc/nsIContentChild.h +++ b/dom/ipc/nsIContentChild.h @@ -64,9 +64,6 @@ 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, @@ -106,11 +103,6 @@ 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); diff --git a/dom/ipc/nsIContentParent.cpp b/dom/ipc/nsIContentParent.cpp index 72b46036fe6a..fb80c40ca564 100644 --- a/dom/ipc/nsIContentParent.cpp +++ b/dom/ipc/nsIContentParent.cpp @@ -16,7 +16,6 @@ #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" @@ -219,19 +218,6 @@ 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) diff --git a/dom/ipc/nsIContentParent.h b/dom/ipc/nsIContentParent.h index 19aeb40a76f3..5718e1de8bcf 100644 --- a/dom/ipc/nsIContentParent.h +++ b/dom/ipc/nsIContentParent.h @@ -36,7 +36,6 @@ namespace ipc { class PFileDescriptorSetParent; class PChildToParentStreamParent; class PParentToChildStreamParent; -class PMemoryStreamParent; class PIPCBlobInputStreamParent; } @@ -130,11 +129,6 @@ 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); diff --git a/ipc/glue/BackgroundChildImpl.cpp b/ipc/glue/BackgroundChildImpl.cpp index 35fbdca051cb..32c74a3c60e6 100644 --- a/ipc/glue/BackgroundChildImpl.cpp +++ b/ipc/glue/BackgroundChildImpl.cpp @@ -25,7 +25,6 @@ #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" @@ -222,19 +221,6 @@ 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) { diff --git a/ipc/glue/BackgroundChildImpl.h b/ipc/glue/BackgroundChildImpl.h index bd8faf7c059a..116ba25e0bdd 100644 --- a/ipc/glue/BackgroundChildImpl.h +++ b/ipc/glue/BackgroundChildImpl.h @@ -76,12 +76,6 @@ 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; diff --git a/ipc/glue/BackgroundParentImpl.cpp b/ipc/glue/BackgroundParentImpl.cpp index d2fd9f7a75ed..636a827d2dcd 100644 --- a/ipc/glue/BackgroundParentImpl.cpp +++ b/ipc/glue/BackgroundParentImpl.cpp @@ -29,7 +29,6 @@ #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" @@ -271,26 +270,6 @@ 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) { diff --git a/ipc/glue/BackgroundParentImpl.h b/ipc/glue/BackgroundParentImpl.h index 3943db04a4fe..2662e34864b1 100644 --- a/ipc/glue/BackgroundParentImpl.h +++ b/ipc/glue/BackgroundParentImpl.h @@ -69,12 +69,6 @@ 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; diff --git a/ipc/glue/PBackground.ipdl b/ipc/glue/PBackground.ipdl index cdd106cf99af..38ab9aa2826e 100644 --- a/ipc/glue/PBackground.ipdl +++ b/ipc/glue/PBackground.ipdl @@ -17,7 +17,6 @@ include protocol PGamepadEventChannel; include protocol PGamepadTestChannel; include protocol PIPCBlobInputStream; include protocol PPendingIPCBlob; -include protocol PMemoryStream; include protocol PMessagePort; include protocol PCameras; include protocol PQuota; @@ -65,7 +64,6 @@ sync protocol PBackground manages PGamepadEventChannel; manages PGamepadTestChannel; manages PIPCBlobInputStream; - manages PMemoryStream; manages PPendingIPCBlob; manages PMessagePort; manages PCameras; @@ -119,8 +117,6 @@ parent: async PGamepadTestChannel(); - async PMemoryStream(uint64_t aSize); - async PWebAuthnTransaction(); child: