Bug 1359718 - Get rid of PBlob - part 0 - remove PMemoryStream, r=smaug
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 23 May 2017 18:00:30 +0200
changeset 360422 50416ab469e7e633d19e23ad6076b019c1089f71
parent 360421 a936e628dbb352550e1ad092db1474470215bda4
child 360423 422e67a8d2b79c8b1564f64e10a51c0abdc302e5
push id31882
push userryanvm@gmail.com
push dateWed, 24 May 2017 20:33:11 +0000
treeherdermozilla-central@c575ecde5303 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1359718
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1359718 - Get rid of PBlob - part 0 - remove PMemoryStream, r=smaug
dom/file/ipc/Blob.cpp
dom/file/ipc/MemoryStreamChild.h
dom/file/ipc/MemoryStreamParent.cpp
dom/file/ipc/MemoryStreamParent.h
dom/file/ipc/PBlob.ipdl
dom/file/ipc/PMemoryStream.ipdl
dom/file/ipc/moz.build
dom/ipc/ContentBridgeChild.cpp
dom/ipc/ContentBridgeChild.h
dom/ipc/ContentBridgeParent.cpp
dom/ipc/ContentBridgeParent.h
dom/ipc/ContentChild.cpp
dom/ipc/ContentChild.h
dom/ipc/ContentParent.cpp
dom/ipc/ContentParent.h
dom/ipc/DOMTypes.ipdlh
dom/ipc/PContent.ipdl
dom/ipc/PContentBridge.ipdl
dom/ipc/nsIContentChild.cpp
dom/ipc/nsIContentChild.h
dom/ipc/nsIContentParent.cpp
dom/ipc/nsIContentParent.h
ipc/glue/BackgroundChildImpl.cpp
ipc/glue/BackgroundChildImpl.h
ipc/glue/BackgroundParentImpl.cpp
ipc/glue/BackgroundParentImpl.h
ipc/glue/PBackground.ipdl
--- a/dom/file/ipc/Blob.cpp
+++ b/dom/file/ipc/Blob.cpp
@@ -20,18 +20,16 @@
 #include "mozilla/Mutex.h"
 #include "mozilla/Unused.h"
 #include "mozilla/dom/BaseBlobImpl.h"
 #include "mozilla/dom/nsIContentParent.h"
 #include "mozilla/dom/nsIContentChild.h"
 #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"
 #include "mozilla/ipc/BackgroundChild.h"
 #include "mozilla/ipc/PBackgroundChild.h"
 #include "mozilla/ipc/PBackgroundParent.h"
 #include "mozilla/ipc/PFileDescriptorSetParent.h"
 #include "MultipartBlobImpl.h"
@@ -615,125 +613,16 @@ struct MOZ_STACK_CLASS CreateBlobImplMet
 
   bool
   IsFile() const
   {
     return !mName.IsVoid();
   }
 };
 
-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>
 CreateBlobImpl(const nsID& aKnownBlobIDData,
                const CreateBlobImplMetadata& aMetadata)
 {
   MOZ_ASSERT(gProcessType == GeckoProcessType_Default);
   MOZ_ASSERT(aMetadata.mHasRecursed);
@@ -755,42 +644,26 @@ already_AddRefed<BlobImpl>
 CreateBlobImpl(const BlobDataStream& aStream,
                const CreateBlobImplMetadata& aMetadata)
 {
   MOZ_ASSERT(gProcessType == GeckoProcessType_Default);
 
   nsCOMPtr<nsIInputStream> inputStream;
   uint64_t length;
 
-  if (aStream.type() == BlobDataStream::TMemoryBlobDataStream) {
-    const MemoryBlobDataStream& memoryBlobDataStream =
-      aStream.get_MemoryBlobDataStream();
-
-    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;
-    }
+  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;
   if (!aMetadata.mHasRecursed && aMetadata.IsFile()) {
     if (length) {
       blobImpl =
         StreamBlobImpl::Create(inputStream,
                                aMetadata.mName,
@@ -1034,24 +907,17 @@ BlobDataFromBlobImpl(ChildManagerType* a
     UniquePtr<AutoIPCStream> autoStream(new AutoIPCStream());
     autoStream->Serialize(inputStream, aManager);
     aBlobData = autoStream->TakeValue();
 
     aIPCStreams.AppendElement(Move(autoStream));
     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,
                                      uint64_t aStart,
                                      uint64_t aLength)
   : mMonitor("RemoteInputStream.mMonitor")
   , mActor(nullptr)
   , mBlobImpl(aBlobImpl)
@@ -3699,18 +3565,16 @@ BlobChild::GetOrCreateFromImpl(ChildMana
   auto* actor = new BlobChild(aManager, aBlobImpl);
 
   ParentBlobConstructorParams params(blobParams);
 
   if (NS_WARN_IF(!aManager->SendPBlobConstructor(actor, params))) {
     return nullptr;
   }
 
-  DeleteStreamMemory(params.blobParams());
-
   autoIPCStreams.Clear();
   return actor;
 }
 
 // static
 template <class ChildManagerType>
 BlobChild*
 BlobChild::CreateFromParams(ChildManagerType* aManager,
deleted file mode 100644
--- 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
deleted file mode 100644
--- 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<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
deleted file mode 100644
--- 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<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
--- a/dom/file/ipc/PBlob.ipdl
+++ b/dom/file/ipc/PBlob.ipdl
@@ -4,17 +4,16 @@
 
 include protocol PBackground;
 include protocol PBlobStream;
 include protocol PContent;
 include protocol PContentBridge;
 include protocol PFileDescriptorSet;
 include protocol PChildToParentStream;
 include protocol PParentToChildStream;
-include protocol PMemoryStream;
 
 include BlobTypes;
 include DOMTypes;
 include InputStreamParams;
 
 namespace mozilla {
 namespace dom {
 
deleted file mode 100644
--- 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
--- a/dom/file/ipc/moz.build
+++ b/dom/file/ipc/moz.build
@@ -6,46 +6,42 @@
 
 EXPORTS.mozilla.dom.ipc += [
     'BlobChild.h',
     'BlobParent.h',
     'IPCBlobInputStream.h',
     'IPCBlobInputStreamChild.h',
     'IPCBlobInputStreamParent.h',
     'IPCBlobInputStreamStorage.h',
-    'MemoryStreamChild.h',
-    'MemoryStreamParent.h',
     'nsIRemoteBlob.h',
     'PendingIPCBlobChild.h',
     'PendingIPCBlobParent.h',
 ]
 
 EXPORTS.mozilla.dom += [
     'IPCBlobUtils.h',
 ]
 
 UNIFIED_SOURCES += [
     'Blob.cpp',
     'IPCBlobInputStream.cpp',
     'IPCBlobInputStreamChild.cpp',
     'IPCBlobInputStreamParent.cpp',
     'IPCBlobInputStreamStorage.cpp',
     'IPCBlobUtils.cpp',
-    'MemoryStreamParent.cpp',
     'PendingIPCBlobChild.cpp',
     'PendingIPCBlobParent.cpp',
 ]
 
 IPDL_SOURCES += [
     'BlobTypes.ipdlh',
     'IPCBlob.ipdlh',
     'PBlob.ipdl',
     'PBlobStream.ipdl',
     'PIPCBlobInputStream.ipdl',
-    'PMemoryStream.ipdl',
     'PPendingIPCBlob.ipdl',
 ]
 
 LOCAL_INCLUDES += [
     '/dom/file',
     '/dom/ipc',
     '/dom/workers',
 ]
--- a/dom/ipc/ContentBridgeChild.cpp
+++ b/dom/ipc/ContentBridgeChild.cpp
@@ -63,22 +63,16 @@ ContentBridgeChild::RecvAsyncMessage(con
 
 PBlobChild*
 ContentBridgeChild::SendPBlobConstructor(PBlobChild* actor,
                                          const BlobConstructorParams& params)
 {
   return PContentBridgeChild::SendPBlobConstructor(actor, params);
 }
 
-PMemoryStreamChild*
-ContentBridgeChild::SendPMemoryStreamConstructor(const uint64_t& aSize)
-{
-  return PContentBridgeChild::SendPMemoryStreamConstructor(aSize);
-}
-
 bool
 ContentBridgeChild::SendPBrowserConstructor(PBrowserChild* aActor,
                                             const TabId& aTabId,
                                             const TabId& aSameTabGroupAs,
                                             const IPCTabContext& aContext,
                                             const uint32_t& aChromeFlags,
                                             const ContentParentId& aCpID,
                                             const bool& aIsForBrowser)
@@ -175,28 +169,16 @@ ContentBridgeChild::AllocPBlobChild(cons
 }
 
 bool
 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)
 {
   return nsIContentChild::AllocPIPCBlobInputStreamChild(aID, aSize);
 }
 
 bool
--- a/dom/ipc/ContentBridgeChild.h
+++ b/dom/ipc/ContentBridgeChild.h
@@ -31,19 +31,16 @@ public:
                                                    InfallibleTArray<jsipc::CpowEntry>&& aCpows,
                                                    const IPC::Principal& aPrincipal,
                                                    const ClonedMessageData& aData) override;
 
   virtual PBlobChild*
   SendPBlobConstructor(PBlobChild* actor,
                        const BlobConstructorParams& aParams) override;
 
-  virtual PMemoryStreamChild*
-  SendPMemoryStreamConstructor(const uint64_t& aSize) override;
-
   jsipc::CPOWManager* GetCPOWManager() override;
 
   virtual bool SendPBrowserConstructor(PBrowserChild* aActor,
                                        const TabId& aTabId,
                                        const TabId& aSameTabGroupAs,
                                        const IPCTabContext& aContext,
                                        const uint32_t& aChromeFlags,
                                        const ContentParentId& aCpID,
@@ -83,20 +80,16 @@ protected:
                                                           const bool& aIsForBrowser) override;
 
   virtual mozilla::jsipc::PJavaScriptChild* AllocPJavaScriptChild() override;
   virtual bool DeallocPJavaScriptChild(mozilla::jsipc::PJavaScriptChild*) override;
 
   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;
 
   virtual bool
   DeallocPIPCBlobInputStreamChild(PIPCBlobInputStreamChild*) override;
 
   virtual mozilla::ipc::PChildToParentStreamChild*
--- a/dom/ipc/ContentBridgeParent.cpp
+++ b/dom/ipc/ContentBridgeParent.cpp
@@ -2,17 +2,16 @@
 /* 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 "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"
 
 using namespace mozilla::ipc;
 using namespace mozilla::jsipc;
 
 namespace mozilla {
@@ -135,28 +134,16 @@ PIPCBlobInputStreamParent*
 ContentBridgeParent::SendPIPCBlobInputStreamConstructor(PIPCBlobInputStreamParent* aActor,
                                                         const nsID& aID,
                                                         const uint64_t& aSize)
 {
   return
     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)
 {
   return nsIContentParent::AllocPIPCBlobInputStreamParent(aID, aSize);
 }
 
 bool
--- a/dom/ipc/ContentBridgeParent.h
+++ b/dom/ipc/ContentBridgeParent.h
@@ -133,21 +133,16 @@ protected:
 
   virtual bool DeallocPBrowserParent(PBrowserParent*) override;
 
   virtual PBlobParent*
   AllocPBlobParent(const BlobConstructorParams& aParams) override;
 
   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,
                                      const uint64_t& aSize) override;
 
   virtual PIPCBlobInputStreamParent*
   AllocPIPCBlobInputStreamParent(const nsID& aID,
                                  const uint64_t& aSize) override;
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -1632,28 +1632,16 @@ ContentChild::DeallocPFileDescriptorSetC
 }
 
 bool
 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)
 {
   return nsIContentChild::AllocPIPCBlobInputStreamChild(aID, aSize);
 }
 
 bool
@@ -1694,26 +1682,16 @@ ContentChild::SendPBlobConstructor(PBlob
 {
   if (IsShuttingDown()) {
     return nullptr;
   }
 
   return PContentChild::SendPBlobConstructor(aActor, aParams);
 }
 
-PMemoryStreamChild*
-ContentChild::SendPMemoryStreamConstructor(const uint64_t& aSize)
-{
-  if (IsShuttingDown()) {
-    return nullptr;
-  }
-
-  return PContentChild::SendPMemoryStreamConstructor(aSize);
-}
-
 PPresentationChild*
 ContentChild::AllocPPresentationChild()
 {
   MOZ_CRASH("We should never be manually allocating PPresentationChild actors");
   return nullptr;
 }
 
 bool
--- a/dom/ipc/ContentChild.h
+++ b/dom/ipc/ContentChild.h
@@ -184,22 +184,16 @@ public:
 
   virtual bool DeallocPBrowserChild(PBrowserChild*) override;
 
   virtual PBlobChild*
   AllocPBlobChild(const BlobConstructorParams& aParams) override;
 
   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;
 
   virtual bool
   DeallocPIPCBlobInputStreamChild(PIPCBlobInputStreamChild* aActor) override;
 
   virtual PHalChild* AllocPHalChild() override;
@@ -518,19 +512,16 @@ public:
 #endif
 
   bool IsForBrowser() const { return mIsForBrowser; }
 
   virtual PBlobChild*
   SendPBlobConstructor(PBlobChild* actor,
                        const BlobConstructorParams& params) override;
 
-  virtual PMemoryStreamChild*
-  SendPMemoryStreamConstructor(const uint64_t& aSize) override;
-
   virtual PFileDescriptorSetChild*
   SendPFileDescriptorSetConstructor(const FileDescriptor&) override;
 
   virtual PFileDescriptorSetChild*
   AllocPFileDescriptorSetChild(const FileDescriptor&) override;
 
   virtual bool
   DeallocPFileDescriptorSetChild(PFileDescriptorSetChild*) override;
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -2845,28 +2845,16 @@ ContentParent::AllocPBlobParent(const Bl
 }
 
 bool
 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)
 {
   return nsIContentParent::AllocPIPCBlobInputStreamParent(aID, aSize);
 }
 
 bool
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -843,21 +843,16 @@ private:
 
   virtual bool DeallocPBrowserParent(PBrowserParent* frame) override;
 
   virtual PBlobParent*
   AllocPBlobParent(const BlobConstructorParams& aParams) override;
 
   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,
                                      const uint64_t& aSize) override;
 
   virtual PIPCBlobInputStreamParent*
   AllocPIPCBlobInputStreamParent(const nsID& aID,
                                  const uint64_t& aSize) override;
--- a/dom/ipc/DOMTypes.ipdlh
+++ b/dom/ipc/DOMTypes.ipdlh
@@ -1,16 +1,15 @@
 /* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
 /* vim: set sw=4 ts=8 et tw=80 ft=cpp : */
 /* 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 PBlob;
-include protocol PMemoryStream;
 
 include IPCBlob;
 include IPCStream;
 include ProtocolTypes;
 
 using struct mozilla::void_t
   from "ipc/IPCMessageUtils.h";
 
@@ -42,28 +41,19 @@ struct MessagePortIdentifier
 struct ClonedMessageData
 {
   SerializedStructuredCloneBuffer data;
   IPCBlob[] blobs;
   IPCStream[] inputStreams;
   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;
 };
 
 union BlobData
 {
   // For remote blobs.
   nsID;
 
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -16,17 +16,16 @@ include protocol PExternalHelperApp;
 include protocol PHandlerService;
 include protocol PFileDescriptorSet;
 include protocol PHal;
 include protocol PHeapSnapshotTempFileHelper;
 include protocol PProcessHangMonitor;
 include protocol PImageBridge;
 include protocol PIPCBlobInputStream;
 include protocol PMedia;
-include protocol PMemoryStream;
 include protocol PNecko;
 include protocol PGMPContent;
 include protocol PGMPService;
 include protocol PPluginModule;
 include protocol PGMP;
 include protocol PPrinting;
 include protocol PChildToParentStream;
 include protocol PParentToChildStream;
@@ -290,17 +289,16 @@ nested(upto inside_cpow) sync protocol P
     manages PPSMContentDownloader;
     manages PExternalHelperApp;
     manages PFileDescriptorSet;
     manages PHal;
     manages PHandlerService;
     manages PHeapSnapshotTempFileHelper;
     manages PIPCBlobInputStream;
     manages PMedia;
-    manages PMemoryStream;
     manages PNecko;
     manages POfflineCacheUpdate;
     manages PPrinting;
     manages PChildToParentStream;
     manages PParentToChildStream;
     manages PSpeechSynthesis;
     manages PStorage;
     manages PTestShell;
@@ -675,18 +673,16 @@ parent:
      * |pluginEpoch == newPluginEpoch|, then |plugins| will be left empty.
      */
     sync FindPlugins(uint32_t pluginEpoch) returns (nsresult aResult, PluginTag[] plugins, uint32_t newPluginEpoch);
 
     async PJavaScript();
 
     async PRemoteSpellcheckEngine();
 
-    async PMemoryStream(uint64_t aSize);
-
     async InitCrashReporter(Shmem shmem, NativeThreadId tid);
 
     /**
      * Is this token compatible with the provided version?
      *
      * |version| The offered version to test
      * Returns |True| if the offered version is compatible
      */
--- a/dom/ipc/PContentBridge.ipdl
+++ b/dom/ipc/PContentBridge.ipdl
@@ -5,17 +5,16 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 include protocol PBlob;
 include protocol PBrowser;
 include protocol PContent;
 include protocol PJavaScript;
 include protocol PFileDescriptorSet;
 include protocol PChildToParentStream;
-include protocol PMemoryStream;
 include protocol PParentToChildStream;
 include protocol PIPCBlobInputStream;
 
 include DOMTypes;
 include JavaScriptTypes;
 include ProtocolTypes;
 include PTabContext;
 
@@ -38,17 +37,16 @@ namespace dom {
  */
 nested(upto inside_cpow) sync protocol PContentBridge
 {
     manages PBlob;
     manages PBrowser;
     manages PFileDescriptorSet;
     manages PJavaScript;
     manages PChildToParentStream;
-    manages PMemoryStream;
     manages PParentToChildStream;
     manages PIPCBlobInputStream;
 
 child:
     async PParentToChildStream();
 
 child:
    /**
@@ -66,18 +64,16 @@ parent:
     sync SyncMessage(nsString aMessage, ClonedMessageData aData,
                      CpowEntry[] aCpows, Principal aPrincipal)
       returns (StructuredCloneData[] retval);
 
     async PJavaScript();
 
     async PChildToParentStream();
 
-    async PMemoryStream(uint64_t aSize);
-
 both:
     // Both the parent and the child can construct the PBrowser.
     // See the comment in PContent::PBrowser().
     async PBrowser(TabId tabId, TabId sameTabGroupAs,
                    IPCTabContext context, uint32_t chromeFlags,
                    ContentParentId cpId, bool isForBrowser);
 
     async PBlob(BlobConstructorParams params);
--- a/dom/ipc/nsIContentChild.cpp
+++ b/dom/ipc/nsIContentChild.cpp
@@ -15,17 +15,16 @@
 #include "mozilla/dom/ipc/StructuredCloneData.h"
 #include "mozilla/ipc/FileDescriptorSetChild.h"
 #include "mozilla/ipc/InputStreamUtils.h"
 #include "mozilla/ipc/IPCStreamAlloc.h"
 #include "mozilla/ipc/IPCStreamDestination.h"
 #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"
 #include "xpcpublic.h"
 
 using namespace mozilla::ipc;
 using namespace mozilla::jsipc;
 
@@ -102,29 +101,16 @@ nsIContentChild::RecvPBrowserConstructor
   nsCOMPtr<nsIObserverService> os = services::GetObserverService();
   if (os) {
     os->NotifyObservers(static_cast<nsITabChild*>(tabChild), "tab-child-created", nullptr);
   }
 
   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)
 {
   // IPCBlobInputStreamChild is refcounted. Here it's created and in
   // DeallocPIPCBlobInputStreamChild is released.
 
   RefPtr<IPCBlobInputStreamChild> actor =
--- a/dom/ipc/nsIContentChild.h
+++ b/dom/ipc/nsIContentChild.h
@@ -59,19 +59,16 @@ public:
 
   BlobChild* GetOrCreateActorForBlob(Blob* aBlob);
   BlobChild* GetOrCreateActorForBlobImpl(BlobImpl* aImpl);
 
   virtual PBlobChild*
   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,
                           const TabId& aSameTabGroupAs,
                           const IPCTabContext& aContext,
                           const uint32_t& aChromeFlags,
                           const ContentParentId& aCpID,
                           const bool& aIsForBrowser) = 0;
@@ -101,21 +98,16 @@ protected:
                                                           const uint32_t& aChromeFlags,
                                                           const ContentParentId& aCpID,
                                                           const bool& aIsForBrowse);
 
   virtual PBlobChild* AllocPBlobChild(const BlobConstructorParams& aParams);
 
   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);
 
   virtual bool
   DeallocPIPCBlobInputStreamChild(mozilla::ipc::PIPCBlobInputStreamChild* aActor);
 
   virtual mozilla::ipc::PChildToParentStreamChild* AllocPChildToParentStreamChild();
 
--- a/dom/ipc/nsIContentParent.cpp
+++ b/dom/ipc/nsIContentParent.cpp
@@ -11,17 +11,16 @@
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/dom/ContentBridgeParent.h"
 #include "mozilla/dom/ContentProcessManager.h"
 #include "mozilla/dom/PTabContext.h"
 #include "mozilla/dom/PermissionMessageUtils.h"
 #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"
 #include "mozilla/ipc/PFileDescriptorSetParent.h"
 #include "mozilla/ipc/IPCStreamAlloc.h"
 #include "mozilla/ipc/IPCStreamDestination.h"
 #include "mozilla/ipc/IPCStreamSource.h"
 #include "mozilla/Unused.h"
@@ -214,29 +213,16 @@ nsIContentParent::AllocPBlobParent(const
 
 bool
 nsIContentParent::DeallocPBlobParent(PBlobParent* aActor)
 {
   BlobParent::Destroy(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)
 {
   MOZ_CRASH("PIPCBlobInputStreamParent actors should be manually constructed!");
   return nullptr;
 }
 
--- a/dom/ipc/nsIContentParent.h
+++ b/dom/ipc/nsIContentParent.h
@@ -31,17 +31,16 @@ namespace jsipc {
 class PJavaScriptParent;
 class CpowEntry;
 } // namespace jsipc
 
 namespace ipc {
 class PFileDescriptorSetParent;
 class PChildToParentStreamParent;
 class PParentToChildStreamParent;
-class PMemoryStreamParent;
 class PIPCBlobInputStreamParent;
 }
 
 namespace dom {
 
 class Blob;
 class BlobConstructorParams;
 class BlobImpl;
@@ -125,21 +124,16 @@ protected: // IPDL methods
                                               const ContentParentId& aCpId,
                                               const bool& aIsForBrowser);
   virtual bool DeallocPBrowserParent(PBrowserParent* frame);
 
   virtual PBlobParent* AllocPBlobParent(const BlobConstructorParams& aParams);
 
   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);
 
   virtual bool
   DeallocPIPCBlobInputStreamParent(mozilla::ipc::PIPCBlobInputStreamParent* aActor);
 
   virtual mozilla::ipc::PFileDescriptorSetParent*
   AllocPFileDescriptorSetParent(const mozilla::ipc::FileDescriptor& aFD);
--- a/ipc/glue/BackgroundChildImpl.cpp
+++ b/ipc/glue/BackgroundChildImpl.cpp
@@ -20,17 +20,16 @@
 #include "mozilla/dom/PFileSystemRequestChild.h"
 #include "mozilla/dom/FileSystemTaskBase.h"
 #include "mozilla/dom/asmjscache/AsmJSCache.h"
 #include "mozilla/dom/cache/ActorUtils.h"
 #include "mozilla/dom/indexedDB/PBackgroundIDBFactoryChild.h"
 #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"
 #include "mozilla/dom/GamepadTestChannelChild.h"
 #include "mozilla/dom/MessagePortChild.h"
 #include "mozilla/ipc/IPCStreamAlloc.h"
 #include "mozilla/ipc/PBackgroundTestChild.h"
 #include "mozilla/ipc/PChildToParentStreamChild.h"
@@ -217,29 +216,16 @@ bool
 BackgroundChildImpl::DeallocPBlobChild(PBlobChild* aActor)
 {
   MOZ_ASSERT(aActor);
 
   mozilla::dom::BlobChild::Destroy(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)
 {
   return new mozilla::dom::PendingIPCBlobChild(aBlob);
 }
 
 bool
 BackgroundChildImpl::DeallocPPendingIPCBlobChild(PPendingIPCBlobChild* aActor)
--- a/ipc/glue/BackgroundChildImpl.h
+++ b/ipc/glue/BackgroundChildImpl.h
@@ -71,22 +71,16 @@ protected:
                                         override;
 
   virtual PBlobChild*
   AllocPBlobChild(const BlobConstructorParams& aParams) override;
 
   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;
 
   virtual bool
   DeallocPPendingIPCBlobChild(PPendingIPCBlobChild* aActor) override;
 
   virtual PIPCBlobInputStreamChild*
   AllocPIPCBlobInputStreamChild(const nsID& aID,
--- a/ipc/glue/BackgroundParentImpl.cpp
+++ b/ipc/glue/BackgroundParentImpl.cpp
@@ -24,17 +24,16 @@
 #include "mozilla/dom/PGamepadTestChannelParent.h"
 #include "mozilla/dom/MessagePortParent.h"
 #include "mozilla/dom/ServiceWorkerRegistrar.h"
 #include "mozilla/dom/asmjscache/AsmJSCache.h"
 #include "mozilla/dom/cache/ActorUtils.h"
 #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"
 #include "mozilla/ipc/BackgroundUtils.h"
 #include "mozilla/ipc/IPCStreamAlloc.h"
 #include "mozilla/ipc/PBackgroundSharedTypes.h"
 #include "mozilla/ipc/PBackgroundTestParent.h"
 #include "mozilla/ipc/PChildToParentStreamParent.h"
@@ -266,36 +265,16 @@ BackgroundParentImpl::DeallocPBlobParent
   AssertIsInMainProcess();
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(aActor);
 
   mozilla::dom::BlobParent::Destroy(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)
 {
   MOZ_CRASH("PPendingIPCBlobParent actors should be manually constructed!");
 }
 
 bool
 BackgroundParentImpl::DeallocPPendingIPCBlobParent(PPendingIPCBlobParent* aActor)
--- a/ipc/glue/BackgroundParentImpl.h
+++ b/ipc/glue/BackgroundParentImpl.h
@@ -64,22 +64,16 @@ protected:
   RecvFlushPendingFileDeletions() override;
 
   virtual PBlobParent*
   AllocPBlobParent(const BlobConstructorParams& aParams) override;
 
   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;
 
   virtual bool
   DeallocPPendingIPCBlobParent(PPendingIPCBlobParent* aActor) override;
 
   virtual PIPCBlobInputStreamParent*
   AllocPIPCBlobInputStreamParent(const nsID& aID,
--- a/ipc/glue/PBackground.ipdl
+++ b/ipc/glue/PBackground.ipdl
@@ -12,17 +12,16 @@ include protocol PCache;
 include protocol PCacheStorage;
 include protocol PCacheStreamControl;
 include protocol PFileDescriptorSet;
 include protocol PFileSystemRequest;
 include protocol PGamepadEventChannel;
 include protocol PGamepadTestChannel;
 include protocol PIPCBlobInputStream;
 include protocol PPendingIPCBlob;
-include protocol PMemoryStream;
 include protocol PMessagePort;
 include protocol PCameras;
 include protocol PQuota;
 include protocol PChildToParentStream;
 include protocol PParentToChildStream;
 include protocol PServiceWorkerManager;
 include protocol PWebAuthnTransaction;
 include protocol PUDPSocket;
@@ -60,17 +59,16 @@ sync protocol PBackground
   manages PCache;
   manages PCacheStorage;
   manages PCacheStreamControl;
   manages PFileDescriptorSet;
   manages PFileSystemRequest;
   manages PGamepadEventChannel;
   manages PGamepadTestChannel;
   manages PIPCBlobInputStream;
-  manages PMemoryStream;
   manages PPendingIPCBlob;
   manages PMessagePort;
   manages PCameras;
   manages PQuota;
   manages PChildToParentStream;
   manages PParentToChildStream;
   manages PServiceWorkerManager;
   manages PWebAuthnTransaction;
@@ -114,18 +112,16 @@ parent:
   async PQuota();
 
   async PFileSystemRequest(FileSystemParams params);
 
   async PGamepadEventChannel();
 
   async PGamepadTestChannel();
 
-  async PMemoryStream(uint64_t aSize);
-
   async PWebAuthnTransaction();
 
 child:
   async PCache();
   async PCacheStreamControl();
 
   async PParentToChildStream();