Bug 1648141 - IPCBlobInputStream to RemoteLazyInputStream - part 4 - IPDL actors, r=smaug,necko-reviewers,dragana

Differential Revision: https://phabricator.services.mozilla.com/D80927
This commit is contained in:
Andrea Marchesini
2020-06-29 10:27:20 +00:00
parent a3732b8279
commit a1197a447e
23 changed files with 192 additions and 180 deletions

View File

@@ -9,7 +9,7 @@
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/FetchTypes.h"
#include "mozilla/dom/IPCBlobInputStreamChild.h"
#include "mozilla/dom/RemoteLazyInputStreamChild.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/WorkerCommon.h"
#include "mozilla/dom/WorkerPrivate.h"
@@ -169,7 +169,7 @@ InternalRequest::InternalRequest(const IPCInternalRequest& aIPCRequest)
// (constructed on the child side).
if (body) {
MOZ_ASSERT(body->type() == BodyStreamVariant::TParentToChildStream);
mBodyStream = static_cast<IPCBlobInputStreamChild*>(
mBodyStream = static_cast<RemoteLazyInputStreamChild*>(
body->get_ParentToChildStream().actorChild())
->CreateStream();
}

View File

@@ -5,8 +5,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "IPCBlobInputStream.h"
#include "IPCBlobInputStreamChild.h"
#include "IPCBlobInputStreamParent.h"
#include "RemoteLazyInputStreamChild.h"
#include "RemoteLazyInputStreamParent.h"
#include "mozilla/ipc/InputStreamParams.h"
#include "mozilla/net/SocketProcessParent.h"
#include "mozilla/SlicedInputStream.h"
@@ -129,7 +129,7 @@ NS_INTERFACE_MAP_BEGIN(IPCBlobInputStream)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIInputStream)
NS_INTERFACE_MAP_END
IPCBlobInputStream::IPCBlobInputStream(IPCBlobInputStreamChild* aActor)
IPCBlobInputStream::IPCBlobInputStream(RemoteLazyInputStreamChild* aActor)
: mActor(aActor),
mState(eInit),
mStart(0),
@@ -597,7 +597,7 @@ void IPCBlobInputStream::Serialize(
nsresult rv;
nsCOMPtr<nsIAsyncInputStream> asyncRemoteStream;
RefPtr<IPCBlobInputStreamParent> parentActor;
RefPtr<RemoteLazyInputStreamParent> parentActor;
{
MutexAutoLock lock(mMutex);
rv = EnsureAsyncRemoteStream(lock);
@@ -609,8 +609,8 @@ void IPCBlobInputStream::Serialize(
MOZ_ASSERT(asyncRemoteStream);
parentActor = IPCBlobInputStreamParent::Create(asyncRemoteStream, mLength, 0,
&rv, socketActor);
parentActor = RemoteLazyInputStreamParent::Create(asyncRemoteStream, mLength,
0, &rv, socketActor);
MOZ_ASSERT(parentActor);
if (!socketActor->SendPRemoteLazyInputStreamConstructor(

View File

@@ -19,7 +19,7 @@
namespace mozilla {
namespace dom {
class IPCBlobInputStreamChild;
class RemoteLazyInputStreamChild;
#define IPCBLOBINPUTSTREAM_IID \
{ \
@@ -49,7 +49,7 @@ class IPCBlobInputStream final : public nsIAsyncInputStream,
NS_DECL_NSIINPUTSTREAMLENGTH
NS_DECL_NSIASYNCINPUTSTREAMLENGTH
explicit IPCBlobInputStream(IPCBlobInputStreamChild* aActor);
explicit IPCBlobInputStream(RemoteLazyInputStreamChild* aActor);
void StreamReady(already_AddRefed<nsIInputStream> aInputStream);
@@ -76,7 +76,7 @@ class IPCBlobInputStream final : public nsIAsyncInputStream,
void InitWithExistingRange(uint64_t aStart, uint64_t aLength,
const MutexAutoLock& aProofOfLock);
RefPtr<IPCBlobInputStreamChild> mActor;
RefPtr<RemoteLazyInputStreamChild> mActor;
// This is the list of possible states.
enum {

View File

@@ -40,14 +40,15 @@ class ThreadInitializeRunnable final : public Runnable {
class MigrateActorRunnable final : public Runnable {
public:
explicit MigrateActorRunnable(IPCBlobInputStreamChild* aActor)
explicit MigrateActorRunnable(RemoteLazyInputStreamChild* aActor)
: Runnable("dom::MigrateActorRunnable"), mActor(aActor) {
MOZ_ASSERT(mActor);
}
NS_IMETHOD
Run() override {
MOZ_ASSERT(mActor->State() == IPCBlobInputStreamChild::eInactiveMigrating);
MOZ_ASSERT(mActor->State() ==
RemoteLazyInputStreamChild::eInactiveMigrating);
PBackgroundChild* actorChild =
BackgroundChild::GetOrCreateForCurrentThread();
@@ -66,7 +67,7 @@ class MigrateActorRunnable final : public Runnable {
private:
~MigrateActorRunnable() = default;
RefPtr<IPCBlobInputStreamChild> mActor;
RefPtr<RemoteLazyInputStreamChild> mActor;
};
} // namespace
@@ -178,8 +179,9 @@ IPCBlobInputStreamThread::Observe(nsISupports* aSubject, const char* aTopic,
return NS_OK;
}
void IPCBlobInputStreamThread::MigrateActor(IPCBlobInputStreamChild* aActor) {
MOZ_ASSERT(aActor->State() == IPCBlobInputStreamChild::eInactiveMigrating);
void IPCBlobInputStreamThread::MigrateActor(
RemoteLazyInputStreamChild* aActor) {
MOZ_ASSERT(aActor->State() == RemoteLazyInputStreamChild::eInactiveMigrating);
mozilla::StaticMutexAutoLock lock(gIPCBlobThreadMutex);
@@ -197,7 +199,7 @@ void IPCBlobInputStreamThread::MigrateActor(IPCBlobInputStreamChild* aActor) {
}
void IPCBlobInputStreamThread::MigrateActorInternal(
IPCBlobInputStreamChild* aActor) {
RemoteLazyInputStreamChild* aActor) {
RefPtr<Runnable> runnable = new MigrateActorRunnable(aActor);
mThread->Dispatch(runnable, NS_DISPATCH_NORMAL);
}

View File

@@ -7,7 +7,7 @@
#ifndef mozilla_dom_IPCBlobInputStreamThread_h
#define mozilla_dom_IPCBlobInputStreamThread_h
#include "mozilla/dom/IPCBlobInputStreamChild.h"
#include "mozilla/dom/RemoteLazyInputStreamChild.h"
#include "nsIEventTarget.h"
#include "nsIObserver.h"
#include "nsTArray.h"
@@ -17,7 +17,7 @@ class nsIThread;
namespace mozilla {
namespace dom {
class IPCBlobInputStreamChild;
class RemoteLazyInputStreamChild;
class IPCBlobInputStreamThread final : public nsIObserver,
public nsIEventTarget {
@@ -32,7 +32,7 @@ class IPCBlobInputStreamThread final : public nsIObserver,
static IPCBlobInputStreamThread* GetOrCreate();
void MigrateActor(IPCBlobInputStreamChild* aActor);
void MigrateActor(RemoteLazyInputStreamChild* aActor);
bool Initialize();
@@ -41,13 +41,13 @@ class IPCBlobInputStreamThread final : public nsIObserver,
private:
~IPCBlobInputStreamThread() = default;
void MigrateActorInternal(IPCBlobInputStreamChild* aActor);
void MigrateActorInternal(RemoteLazyInputStreamChild* aActor);
nsCOMPtr<nsIThread> mThread;
// This is populated if MigrateActor() is called before the initialization of
// the thread.
nsTArray<RefPtr<IPCBlobInputStreamChild>> mPendingActors;
nsTArray<RefPtr<RemoteLazyInputStreamChild>> mPendingActors;
};
bool IsOnDOMFileThread();

View File

@@ -6,8 +6,8 @@
#include "IPCBlobUtils.h"
#include "IPCBlobInputStream.h"
#include "IPCBlobInputStreamChild.h"
#include "IPCBlobInputStreamParent.h"
#include "RemoteLazyInputStreamChild.h"
#include "RemoteLazyInputStreamParent.h"
#include "mozilla/dom/IPCBlob.h"
#include "mozilla/ipc/BackgroundParent.h"
#include "mozilla/ipc/PBackgroundParent.h"
@@ -35,8 +35,9 @@ already_AddRefed<BlobImpl> Deserialize(const IPCBlob& aIPCBlob) {
// Parent to child: when an nsIInputStream is sent from parent to child, the
// child receives a IPCBlobInputStream actor.
case IPCBlobStream::TPRemoteLazyInputStreamChild: {
IPCBlobInputStreamChild* actor = static_cast<IPCBlobInputStreamChild*>(
stream.get_PRemoteLazyInputStreamChild());
RemoteLazyInputStreamChild* actor =
static_cast<RemoteLazyInputStreamChild*>(
stream.get_PRemoteLazyInputStreamChild());
inputStream = actor->CreateStream();
break;
}
@@ -86,8 +87,8 @@ nsresult SerializeInputStreamParent(nsIInputStream* aInputStream,
nsCOMPtr<nsIInputStream> stream = aInputStream;
// In case this is a IPCBlobInputStream, we don't want to create a loop:
// IPCBlobInputStreamParent -> IPCBlobInputStream ->
// IPCBlobInputStreamParent. Let's use the underlying inputStream instead.
// RemoteLazyInputStreamParent -> IPCBlobInputStream ->
// RemoteLazyInputStreamParent. Let's use the underlying inputStream instead.
nsCOMPtr<mozIRemoteLazyInputStream> ipcBlobInputStream =
do_QueryInterface(aInputStream);
if (ipcBlobInputStream) {
@@ -101,8 +102,9 @@ nsresult SerializeInputStreamParent(nsIInputStream* aInputStream,
}
nsresult rv;
RefPtr<IPCBlobInputStreamParent> parentActor =
IPCBlobInputStreamParent::Create(stream, aSize, aChildID, &rv, aManager);
RefPtr<RemoteLazyInputStreamParent> parentActor =
RemoteLazyInputStreamParent::Create(stream, aSize, aChildID, &rv,
aManager);
if (!parentActor) {
return rv;
}

View File

@@ -140,7 +140,7 @@
* DOM-File Thread
* ~~~~~~~~~~~~~~~
*
* IPCBlobInputStreamChild actor can be created in any thread (sort of) and
* RemoteLazyInputStreamChild actor can be created in any thread (sort of) and
* their top-level IPDL protocol is PBackground. These actors are wrapped by 1
* or more IPCBlobInputStream objects in order to expose nsIInputStream
* interface and be thread-safe.
@@ -158,24 +158,24 @@
* used on another thread (note that nsIInputStream could do I/O and usually
* they are used on special I/O threads).
*
* In order to avoid this, IPCBlobInputStreamChild are 'migrated' to a DOM-File
* thread. This is done in this way:
* In order to avoid this, RemoteLazyInputStreamChild are 'migrated' to a
* DOM-File thread. This is done in this way:
*
* 1. If IPCBlobInputStreamChild actor is not already owned by DOM-File thread,
* it calls Send__delete__ in order to inform the parent side that we don't
* need this IPC channel on the current thread.
* 2. A new IPCBlobInputStreamChild is created. IPCBlobInputStreamThread is
* 1. If RemoteLazyInputStreamChild actor is not already owned by DOM-File
* thread, it calls Send__delete__ in order to inform the parent side that we
* don't need this IPC channel on the current thread.
* 2. A new RemoteLazyInputStreamChild is created. IPCBlobInputStreamThread is
* used to assign this actor to the DOM-File thread.
* IPCBlobInputStreamThread::GetOrCreate() creates the DOM-File thread if it
* doesn't exist yet. Pending operations and IPCBlobInputStreams are moved
* onto the new actor.
* 3. IPCBlobInputStreamParent::Recv__delete__ is called on the parent side and
* the parent actor is deleted. Doing this we don't remove the UUID from
* 3. RemoteLazyInputStreamParent::Recv__delete__ is called on the parent side
* and the parent actor is deleted. Doing this we don't remove the UUID from
* RemoteLazyInputStreamStorage.
* 4. The IPCBlobInputStream constructor is sent with the new
* IPCBlobInputStreamChild actor, with the DOM-File thread's PBackground as
* its manager.
* 5. When the new IPCBlobInputStreamParent actor is created, it will receive
* RemoteLazyInputStreamChild actor, with the DOM-File thread's PBackground
* as its manager.
* 5. When the new RemoteLazyInputStreamParent actor is created, it will receive
* the same UUID of the previous parent actor. The nsIInputStream will be
* retrieved from RemoteLazyInputStreamStorage.
* 6. In order to avoid leaks, RemoteLazyInputStreamStorage will monitor child

View File

@@ -4,7 +4,7 @@
* 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 "IPCBlobInputStreamChild.h"
#include "RemoteLazyInputStreamChild.h"
#include "IPCBlobInputStreamThread.h"
#include "mozilla/ipc/IPCStreamUtils.h"
@@ -20,7 +20,7 @@ namespace {
// thread.
class ShutdownRunnable final : public CancelableRunnable {
public:
explicit ShutdownRunnable(IPCBlobInputStreamChild* aActor)
explicit ShutdownRunnable(RemoteLazyInputStreamChild* aActor)
: CancelableRunnable("dom::ShutdownRunnable"), mActor(aActor) {}
NS_IMETHOD
@@ -30,28 +30,29 @@ class ShutdownRunnable final : public CancelableRunnable {
}
private:
RefPtr<IPCBlobInputStreamChild> mActor;
RefPtr<RemoteLazyInputStreamChild> mActor;
};
// This runnable is used in case StreamNeeded() has been called on a non-owning
// thread.
class StreamNeededRunnable final : public CancelableRunnable {
public:
explicit StreamNeededRunnable(IPCBlobInputStreamChild* aActor)
explicit StreamNeededRunnable(RemoteLazyInputStreamChild* aActor)
: CancelableRunnable("dom::StreamNeededRunnable"), mActor(aActor) {}
NS_IMETHOD
Run() override {
MOZ_ASSERT(mActor->State() != IPCBlobInputStreamChild::eActiveMigrating &&
mActor->State() != IPCBlobInputStreamChild::eInactiveMigrating);
if (mActor->State() == IPCBlobInputStreamChild::eActive) {
MOZ_ASSERT(
mActor->State() != RemoteLazyInputStreamChild::eActiveMigrating &&
mActor->State() != RemoteLazyInputStreamChild::eInactiveMigrating);
if (mActor->State() == RemoteLazyInputStreamChild::eActive) {
mActor->SendStreamNeeded();
}
return NS_OK;
}
private:
RefPtr<IPCBlobInputStreamChild> mActor;
RefPtr<RemoteLazyInputStreamChild> mActor;
};
// When the stream has been received from the parent, we inform the
@@ -82,21 +83,22 @@ class StreamReadyRunnable final : public CancelableRunnable {
// thread.
class LengthNeededRunnable final : public CancelableRunnable {
public:
explicit LengthNeededRunnable(IPCBlobInputStreamChild* aActor)
explicit LengthNeededRunnable(RemoteLazyInputStreamChild* aActor)
: CancelableRunnable("dom::LengthNeededRunnable"), mActor(aActor) {}
NS_IMETHOD
Run() override {
MOZ_ASSERT(mActor->State() != IPCBlobInputStreamChild::eActiveMigrating &&
mActor->State() != IPCBlobInputStreamChild::eInactiveMigrating);
if (mActor->State() == IPCBlobInputStreamChild::eActive) {
MOZ_ASSERT(
mActor->State() != RemoteLazyInputStreamChild::eActiveMigrating &&
mActor->State() != RemoteLazyInputStreamChild::eInactiveMigrating);
if (mActor->State() == RemoteLazyInputStreamChild::eActive) {
mActor->SendLengthNeeded();
}
return NS_OK;
}
private:
RefPtr<IPCBlobInputStreamChild> mActor;
RefPtr<RemoteLazyInputStreamChild> mActor;
};
// When the stream has been received from the parent, we inform the
@@ -123,9 +125,9 @@ class LengthReadyRunnable final : public CancelableRunnable {
} // namespace
IPCBlobInputStreamChild::IPCBlobInputStreamChild(const nsID& aID,
uint64_t aSize)
: mMutex("IPCBlobInputStreamChild::mMutex"),
RemoteLazyInputStreamChild::RemoteLazyInputStreamChild(const nsID& aID,
uint64_t aSize)
: mMutex("RemoteLazyInputStreamChild::mMutex"),
mID(aID),
mSize(aSize),
mState(eActive),
@@ -139,7 +141,7 @@ IPCBlobInputStreamChild::IPCBlobInputStreamChild(const nsID& aID,
}
RefPtr<StrongWorkerRef> workerRef =
StrongWorkerRef::Create(workerPrivate, "IPCBlobInputStreamChild");
StrongWorkerRef::Create(workerPrivate, "RemoteLazyInputStreamChild");
if (!workerRef) {
return;
}
@@ -149,12 +151,12 @@ IPCBlobInputStreamChild::IPCBlobInputStreamChild(const nsID& aID,
}
}
IPCBlobInputStreamChild::~IPCBlobInputStreamChild() = default;
RemoteLazyInputStreamChild::~RemoteLazyInputStreamChild() = default;
void IPCBlobInputStreamChild::Shutdown() {
void RemoteLazyInputStreamChild::Shutdown() {
MutexAutoLock lock(mMutex);
RefPtr<IPCBlobInputStreamChild> kungFuDeathGrip = this;
RefPtr<RemoteLazyInputStreamChild> kungFuDeathGrip = this;
mWorkerRef = nullptr;
mPendingOperations.Clear();
@@ -165,7 +167,7 @@ void IPCBlobInputStreamChild::Shutdown() {
}
}
void IPCBlobInputStreamChild::ActorDestroy(
void RemoteLazyInputStreamChild::ActorDestroy(
IProtocol::ActorDestroyReason aReason) {
bool migrating = false;
@@ -182,12 +184,13 @@ void IPCBlobInputStreamChild::ActorDestroy(
}
}
IPCBlobInputStreamChild::ActorState IPCBlobInputStreamChild::State() {
RemoteLazyInputStreamChild::ActorState RemoteLazyInputStreamChild::State() {
MutexAutoLock lock(mMutex);
return mState;
}
already_AddRefed<IPCBlobInputStream> IPCBlobInputStreamChild::CreateStream() {
already_AddRefed<IPCBlobInputStream>
RemoteLazyInputStreamChild::CreateStream() {
bool shouldMigrate = false;
RefPtr<IPCBlobInputStream> stream;
@@ -213,8 +216,8 @@ already_AddRefed<IPCBlobInputStream> IPCBlobInputStreamChild::CreateStream() {
MOZ_ASSERT(thread, "We cannot continue without DOMFile thread.");
// Create a new actor object to connect to the target thread.
RefPtr<IPCBlobInputStreamChild> newActor =
new IPCBlobInputStreamChild(mID, mSize);
RefPtr<RemoteLazyInputStreamChild> newActor =
new RemoteLazyInputStreamChild(mID, mSize);
{
MutexAutoLock newActorLock(newActor->mMutex);
@@ -245,10 +248,10 @@ already_AddRefed<IPCBlobInputStream> IPCBlobInputStreamChild::CreateStream() {
return stream.forget();
}
void IPCBlobInputStreamChild::ForgetStream(IPCBlobInputStream* aStream) {
void RemoteLazyInputStreamChild::ForgetStream(IPCBlobInputStream* aStream) {
MOZ_ASSERT(aStream);
RefPtr<IPCBlobInputStreamChild> kungFuDeathGrip = this;
RefPtr<RemoteLazyInputStreamChild> kungFuDeathGrip = this;
{
MutexAutoLock lock(mMutex);
@@ -268,8 +271,8 @@ void IPCBlobInputStreamChild::ForgetStream(IPCBlobInputStream* aStream) {
mOwningEventTarget->Dispatch(runnable, NS_DISPATCH_NORMAL);
}
void IPCBlobInputStreamChild::StreamNeeded(IPCBlobInputStream* aStream,
nsIEventTarget* aEventTarget) {
void RemoteLazyInputStreamChild::StreamNeeded(IPCBlobInputStream* aStream,
nsIEventTarget* aEventTarget) {
MutexAutoLock lock(mMutex);
if (mState == eInactive) {
@@ -299,7 +302,7 @@ void IPCBlobInputStreamChild::StreamNeeded(IPCBlobInputStream* aStream,
mOwningEventTarget->Dispatch(runnable.forget(), NS_DISPATCH_NORMAL);
}
mozilla::ipc::IPCResult IPCBlobInputStreamChild::RecvStreamReady(
mozilla::ipc::IPCResult RemoteLazyInputStreamChild::RecvStreamReady(
const Maybe<IPCStream>& aStream) {
nsCOMPtr<nsIInputStream> stream = mozilla::ipc::DeserializeIPCStream(aStream);
@@ -340,8 +343,8 @@ mozilla::ipc::IPCResult IPCBlobInputStreamChild::RecvStreamReady(
return IPC_OK();
}
void IPCBlobInputStreamChild::LengthNeeded(IPCBlobInputStream* aStream,
nsIEventTarget* aEventTarget) {
void RemoteLazyInputStreamChild::LengthNeeded(IPCBlobInputStream* aStream,
nsIEventTarget* aEventTarget) {
MutexAutoLock lock(mMutex);
if (mState == eInactive) {
@@ -371,7 +374,7 @@ void IPCBlobInputStreamChild::LengthNeeded(IPCBlobInputStream* aStream,
mOwningEventTarget->Dispatch(runnable.forget(), NS_DISPATCH_NORMAL);
}
mozilla::ipc::IPCResult IPCBlobInputStreamChild::RecvLengthReady(
mozilla::ipc::IPCResult RemoteLazyInputStreamChild::RecvLengthReady(
const int64_t& aLength) {
RefPtr<IPCBlobInputStream> pendingStream;
nsCOMPtr<nsIEventTarget> eventTarget;
@@ -402,7 +405,7 @@ mozilla::ipc::IPCResult IPCBlobInputStreamChild::RecvLengthReady(
return IPC_OK();
}
void IPCBlobInputStreamChild::Migrated() {
void RemoteLazyInputStreamChild::Migrated() {
MutexAutoLock lock(mMutex);
MOZ_ASSERT(mState == eInactiveMigrating);

View File

@@ -4,8 +4,8 @@
* 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_IPCBlobInputStreamChild_h
#define mozilla_dom_IPCBlobInputStreamChild_h
#ifndef mozilla_dom_RemoteLazyInputStreamChild_h
#define mozilla_dom_RemoteLazyInputStreamChild_h
#include "mozilla/dom/PRemoteLazyInputStreamChild.h"
#include "mozilla/dom/IPCBlobInputStream.h"
@@ -19,7 +19,7 @@ namespace dom {
class IPCBlobInputStream;
class ThreadSafeWorkerRef;
class IPCBlobInputStreamChild final : public PRemoteLazyInputStreamChild {
class RemoteLazyInputStreamChild final : public PRemoteLazyInputStreamChild {
public:
enum ActorState {
// The actor is connected via IPDL to the parent.
@@ -37,9 +37,9 @@ class IPCBlobInputStreamChild final : public PRemoteLazyInputStreamChild {
eInactiveMigrating,
};
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(IPCBlobInputStreamChild, final)
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(RemoteLazyInputStreamChild, final)
IPCBlobInputStreamChild(const nsID& aID, uint64_t aSize);
RemoteLazyInputStreamChild(const nsID& aID, uint64_t aSize);
void ActorDestroy(IProtocol::ActorDestroyReason aReason) override;
@@ -66,7 +66,7 @@ class IPCBlobInputStreamChild final : public PRemoteLazyInputStreamChild {
void Migrated();
private:
~IPCBlobInputStreamChild();
~RemoteLazyInputStreamChild();
// Raw pointers because these streams keep this actor alive. When the last
// stream is unregister, the actor will be deleted. This list is protected by
@@ -100,4 +100,4 @@ class IPCBlobInputStreamChild final : public PRemoteLazyInputStreamChild {
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_IPCBlobInputStreamChild_h
#endif // mozilla_dom_RemoteLazyInputStreamChild_h

View File

@@ -4,7 +4,7 @@
* 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 "IPCBlobInputStreamParent.h"
#include "RemoteLazyInputStreamParent.h"
#include "mozilla/ipc/IPCStreamUtils.h"
#include "mozilla/InputStreamLengthHelper.h"
#include "nsContentUtils.h"
@@ -15,9 +15,10 @@ namespace dom {
template <typename M>
/* static */
already_AddRefed<IPCBlobInputStreamParent> IPCBlobInputStreamParent::Create(
nsIInputStream* aInputStream, uint64_t aSize, uint64_t aChildID,
nsresult* aRv, M* aManager) {
already_AddRefed<RemoteLazyInputStreamParent>
RemoteLazyInputStreamParent::Create(nsIInputStream* aInputStream,
uint64_t aSize, uint64_t aChildID,
nsresult* aRv, M* aManager) {
MOZ_ASSERT(aInputStream);
MOZ_ASSERT(aRv);
@@ -30,51 +31,52 @@ already_AddRefed<IPCBlobInputStreamParent> IPCBlobInputStreamParent::Create(
RemoteLazyInputStreamStorage::Get()->AddStream(aInputStream, id, aSize,
aChildID);
RefPtr<IPCBlobInputStreamParent> parent =
new IPCBlobInputStreamParent(id, aSize, aManager);
RefPtr<RemoteLazyInputStreamParent> parent =
new RemoteLazyInputStreamParent(id, aSize, aManager);
return parent.forget();
}
/* static */
already_AddRefed<IPCBlobInputStreamParent> IPCBlobInputStreamParent::Create(
const nsID& aID, uint64_t aSize, PBackgroundParent* aManager) {
RefPtr<IPCBlobInputStreamParent> actor =
new IPCBlobInputStreamParent(aID, aSize, aManager);
already_AddRefed<RemoteLazyInputStreamParent>
RemoteLazyInputStreamParent::Create(const nsID& aID, uint64_t aSize,
PBackgroundParent* aManager) {
RefPtr<RemoteLazyInputStreamParent> actor =
new RemoteLazyInputStreamParent(aID, aSize, aManager);
actor->mCallback = RemoteLazyInputStreamStorage::Get()->TakeCallback(aID);
return actor.forget();
}
template already_AddRefed<IPCBlobInputStreamParent>
IPCBlobInputStreamParent::Create<mozilla::ipc::PBackgroundParent>(
template already_AddRefed<RemoteLazyInputStreamParent>
RemoteLazyInputStreamParent::Create<mozilla::ipc::PBackgroundParent>(
nsIInputStream*, uint64_t, uint64_t, nsresult*,
mozilla::ipc::PBackgroundParent*);
/* static */
already_AddRefed<IPCBlobInputStreamParent> IPCBlobInputStreamParent::Create(
const nsID& aID, uint64_t aSize, SocketProcessParent* aManager) {
RefPtr<IPCBlobInputStreamParent> actor =
new IPCBlobInputStreamParent(aID, aSize, aManager);
already_AddRefed<RemoteLazyInputStreamParent>
RemoteLazyInputStreamParent::Create(const nsID& aID, uint64_t aSize,
SocketProcessParent* aManager) {
RefPtr<RemoteLazyInputStreamParent> actor =
new RemoteLazyInputStreamParent(aID, aSize, aManager);
actor->mCallback = RemoteLazyInputStreamStorage::Get()->TakeCallback(aID);
return actor.forget();
}
template already_AddRefed<IPCBlobInputStreamParent>
IPCBlobInputStreamParent::Create<mozilla::net::SocketProcessParent>(
template already_AddRefed<RemoteLazyInputStreamParent>
RemoteLazyInputStreamParent::Create<mozilla::net::SocketProcessParent>(
nsIInputStream*, uint64_t, uint64_t, nsresult*,
mozilla::net::SocketProcessParent*);
template already_AddRefed<IPCBlobInputStreamParent>
IPCBlobInputStreamParent::Create<ContentParent>(nsIInputStream*, uint64_t,
uint64_t, nsresult*,
ContentParent*);
template already_AddRefed<RemoteLazyInputStreamParent>
RemoteLazyInputStreamParent::Create<ContentParent>(nsIInputStream*, uint64_t,
uint64_t, nsresult*,
ContentParent*);
IPCBlobInputStreamParent::IPCBlobInputStreamParent(const nsID& aID,
uint64_t aSize,
ContentParent* aManager)
RemoteLazyInputStreamParent::RemoteLazyInputStreamParent(
const nsID& aID, uint64_t aSize, ContentParent* aManager)
: mID(aID),
mSize(aSize),
mContentManager(aManager),
@@ -82,9 +84,8 @@ IPCBlobInputStreamParent::IPCBlobInputStreamParent(const nsID& aID,
mSocketProcessManager(nullptr),
mMigrating(false) {}
IPCBlobInputStreamParent::IPCBlobInputStreamParent(const nsID& aID,
uint64_t aSize,
PBackgroundParent* aManager)
RemoteLazyInputStreamParent::RemoteLazyInputStreamParent(
const nsID& aID, uint64_t aSize, PBackgroundParent* aManager)
: mID(aID),
mSize(aSize),
mContentManager(nullptr),
@@ -92,7 +93,7 @@ IPCBlobInputStreamParent::IPCBlobInputStreamParent(const nsID& aID,
mSocketProcessManager(nullptr),
mMigrating(false) {}
IPCBlobInputStreamParent::IPCBlobInputStreamParent(
RemoteLazyInputStreamParent::RemoteLazyInputStreamParent(
const nsID& aID, uint64_t aSize, SocketProcessParent* aManager)
: mID(aID),
mSize(aSize),
@@ -101,7 +102,7 @@ IPCBlobInputStreamParent::IPCBlobInputStreamParent(
mSocketProcessManager(aManager),
mMigrating(false) {}
void IPCBlobInputStreamParent::ActorDestroy(
void RemoteLazyInputStreamParent::ActorDestroy(
IProtocol::ActorDestroyReason aReason) {
MOZ_ASSERT(mContentManager || mPBackgroundManager || mSocketProcessManager);
@@ -109,7 +110,7 @@ void IPCBlobInputStreamParent::ActorDestroy(
mPBackgroundManager = nullptr;
mSocketProcessManager = nullptr;
RefPtr<IPCBlobInputStreamParentCallback> callback;
RefPtr<RemoteLazyInputStreamParentCallback> callback;
mCallback.swap(callback);
RefPtr<RemoteLazyInputStreamStorage> storage =
@@ -132,15 +133,15 @@ void IPCBlobInputStreamParent::ActorDestroy(
}
}
void IPCBlobInputStreamParent::SetCallback(
IPCBlobInputStreamParentCallback* aCallback) {
void RemoteLazyInputStreamParent::SetCallback(
RemoteLazyInputStreamParentCallback* aCallback) {
MOZ_ASSERT(aCallback);
MOZ_ASSERT(!mCallback);
mCallback = aCallback;
}
mozilla::ipc::IPCResult IPCBlobInputStreamParent::RecvStreamNeeded() {
mozilla::ipc::IPCResult RemoteLazyInputStreamParent::RecvStreamNeeded() {
MOZ_ASSERT(mContentManager || mPBackgroundManager || mSocketProcessManager);
nsCOMPtr<nsIInputStream> stream;
@@ -178,7 +179,7 @@ mozilla::ipc::IPCResult IPCBlobInputStreamParent::RecvStreamNeeded() {
return IPC_OK();
}
mozilla::ipc::IPCResult IPCBlobInputStreamParent::RecvLengthNeeded() {
mozilla::ipc::IPCResult RemoteLazyInputStreamParent::RecvLengthNeeded() {
MOZ_ASSERT(mContentManager || mPBackgroundManager || mSocketProcessManager);
nsCOMPtr<nsIInputStream> stream;
@@ -198,7 +199,7 @@ mozilla::ipc::IPCResult IPCBlobInputStreamParent::RecvLengthNeeded() {
return IPC_OK();
}
RefPtr<IPCBlobInputStreamParent> self = this;
RefPtr<RemoteLazyInputStreamParent> self = this;
InputStreamLengthHelper::GetAsyncLength(stream, [self](int64_t aLength) {
if (self->mContentManager || self->mPBackgroundManager ||
self->mSocketProcessManager) {
@@ -209,20 +210,20 @@ mozilla::ipc::IPCResult IPCBlobInputStreamParent::RecvLengthNeeded() {
return IPC_OK();
}
mozilla::ipc::IPCResult IPCBlobInputStreamParent::RecvClose() {
mozilla::ipc::IPCResult RemoteLazyInputStreamParent::RecvClose() {
MOZ_ASSERT(mContentManager || mPBackgroundManager || mSocketProcessManager);
Unused << Send__delete__(this);
return IPC_OK();
}
mozilla::ipc::IPCResult IPCBlobInputStreamParent::Recv__delete__() {
mozilla::ipc::IPCResult RemoteLazyInputStreamParent::Recv__delete__() {
MOZ_ASSERT(mContentManager || mPBackgroundManager || mSocketProcessManager);
mMigrating = true;
return IPC_OK();
}
bool IPCBlobInputStreamParent::HasValidStream() const {
bool RemoteLazyInputStreamParent::HasValidStream() const {
return RemoteLazyInputStreamStorage::Get()->HasStream(mID);
}

View File

@@ -4,8 +4,8 @@
* 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_IPCBlobInputStreamParent_h
#define mozilla_dom_IPCBlobInputStreamParent_h
#ifndef mozilla_dom_RemoteLazyInputStreamParent_h
#define mozilla_dom_RemoteLazyInputStreamParent_h
#include "mozilla/dom/PRemoteLazyInputStreamParent.h"
@@ -19,33 +19,33 @@ class SocketProcessParent;
namespace dom {
class NS_NO_VTABLE IPCBlobInputStreamParentCallback {
class NS_NO_VTABLE RemoteLazyInputStreamParentCallback {
public:
virtual void ActorDestroyed(const nsID& aID) = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
protected:
virtual ~IPCBlobInputStreamParentCallback() = default;
virtual ~RemoteLazyInputStreamParentCallback() = default;
};
class IPCBlobInputStreamParent final : public PRemoteLazyInputStreamParent {
class RemoteLazyInputStreamParent final : public PRemoteLazyInputStreamParent {
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(IPCBlobInputStreamParent, final)
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(RemoteLazyInputStreamParent, final)
// The size of the inputStream must be passed as argument in order to avoid
// the use of nsIInputStream::Available() which could open a fileDescriptor in
// case the stream is a nsFileStream.
template <typename M>
static already_AddRefed<IPCBlobInputStreamParent> Create(
static already_AddRefed<RemoteLazyInputStreamParent> Create(
nsIInputStream* aInputStream, uint64_t aSize, uint64_t aChildID,
nsresult* aRv, M* aManager);
static already_AddRefed<IPCBlobInputStreamParent> Create(
static already_AddRefed<RemoteLazyInputStreamParent> Create(
const nsID& aID, uint64_t aSize,
mozilla::ipc::PBackgroundParent* aManager);
static already_AddRefed<IPCBlobInputStreamParent> Create(
static already_AddRefed<RemoteLazyInputStreamParent> Create(
const nsID& aID, uint64_t aSize,
mozilla::net::SocketProcessParent* aManager);
@@ -55,7 +55,7 @@ class IPCBlobInputStreamParent final : public PRemoteLazyInputStreamParent {
uint64_t Size() const { return mSize; }
void SetCallback(IPCBlobInputStreamParentCallback* aCallback);
void SetCallback(RemoteLazyInputStreamParentCallback* aCallback);
mozilla::ipc::IPCResult RecvStreamNeeded();
@@ -68,16 +68,16 @@ class IPCBlobInputStreamParent final : public PRemoteLazyInputStreamParent {
bool HasValidStream() const;
private:
IPCBlobInputStreamParent(const nsID& aID, uint64_t aSize,
ContentParent* aManager);
RemoteLazyInputStreamParent(const nsID& aID, uint64_t aSize,
ContentParent* aManager);
IPCBlobInputStreamParent(const nsID& aID, uint64_t aSize,
mozilla::ipc::PBackgroundParent* aManager);
RemoteLazyInputStreamParent(const nsID& aID, uint64_t aSize,
mozilla::ipc::PBackgroundParent* aManager);
IPCBlobInputStreamParent(const nsID& aID, uint64_t aSize,
mozilla::net::SocketProcessParent* aManager);
RemoteLazyInputStreamParent(const nsID& aID, uint64_t aSize,
mozilla::net::SocketProcessParent* aManager);
~IPCBlobInputStreamParent() = default;
~RemoteLazyInputStreamParent() = default;
const nsID mID;
const uint64_t mSize;
@@ -88,7 +88,7 @@ class IPCBlobInputStreamParent final : public PRemoteLazyInputStreamParent {
mozilla::ipc::PBackgroundParent* mPBackgroundManager;
mozilla::net::SocketProcessParent* mSocketProcessManager;
RefPtr<IPCBlobInputStreamParentCallback> mCallback;
RefPtr<RemoteLazyInputStreamParentCallback> mCallback;
bool mMigrating;
};
@@ -96,4 +96,4 @@ class IPCBlobInputStreamParent final : public PRemoteLazyInputStreamParent {
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_IPCBlobInputStreamParent_h
#endif // mozilla_dom_RemoteLazyInputStreamParent_h

View File

@@ -178,7 +178,7 @@ void RemoteLazyInputStreamStorage::GetStream(const nsID& aID, uint64_t aStart,
}
void RemoteLazyInputStreamStorage::StoreCallback(
const nsID& aID, IPCBlobInputStreamParentCallback* aCallback) {
const nsID& aID, RemoteLazyInputStreamParentCallback* aCallback) {
MOZ_ASSERT(aCallback);
mozilla::StaticMutexAutoLock lock(gMutex);
@@ -189,7 +189,7 @@ void RemoteLazyInputStreamStorage::StoreCallback(
}
}
already_AddRefed<IPCBlobInputStreamParentCallback>
already_AddRefed<RemoteLazyInputStreamParentCallback>
RemoteLazyInputStreamStorage::TakeCallback(const nsID& aID) {
mozilla::StaticMutexAutoLock lock(gMutex);
StreamData* data = mStorage.Get(aID);
@@ -197,7 +197,7 @@ RemoteLazyInputStreamStorage::TakeCallback(const nsID& aID) {
return nullptr;
}
RefPtr<IPCBlobInputStreamParentCallback> callback;
RefPtr<RemoteLazyInputStreamParentCallback> callback;
data->mCallback.swap(callback);
return callback.forget();
}

View File

@@ -17,7 +17,7 @@ struct nsID;
namespace mozilla {
namespace dom {
class IPCBlobInputStreamParentCallback;
class RemoteLazyInputStreamParentCallback;
class RemoteLazyInputStreamStorage final : public nsIObserver {
public:
@@ -42,9 +42,9 @@ class RemoteLazyInputStreamStorage final : public nsIObserver {
nsIInputStream** aInputStream);
void StoreCallback(const nsID& aID,
IPCBlobInputStreamParentCallback* aCallback);
RemoteLazyInputStreamParentCallback* aCallback);
already_AddRefed<IPCBlobInputStreamParentCallback> TakeCallback(
already_AddRefed<RemoteLazyInputStreamParentCallback> TakeCallback(
const nsID& aID);
private:
@@ -53,7 +53,7 @@ class RemoteLazyInputStreamStorage final : public nsIObserver {
struct StreamData {
nsCOMPtr<nsIInputStream> mInputStream;
RefPtr<IPCBlobInputStreamParentCallback> mCallback;
RefPtr<RemoteLazyInputStreamParentCallback> mCallback;
// This is the Process ID connected with this inputStream. We need to store
// this information in order to delete it if the child crashes/shutdowns.

View File

@@ -17,9 +17,9 @@ EXPORTS.mozilla.dom += [
'FileCreatorChild.h',
'FileCreatorParent.h',
'IPCBlobInputStream.h',
'IPCBlobInputStreamChild.h',
'IPCBlobInputStreamParent.h',
'IPCBlobUtils.h',
'RemoteLazyInputStreamChild.h',
'RemoteLazyInputStreamParent.h',
'RemoteLazyInputStreamStorage.h',
'TemporaryIPCBlobChild.h',
'TemporaryIPCBlobParent.h',
@@ -29,10 +29,10 @@ UNIFIED_SOURCES += [
'FileCreatorChild.cpp',
'FileCreatorParent.cpp',
'IPCBlobInputStream.cpp',
'IPCBlobInputStreamChild.cpp',
'IPCBlobInputStreamParent.cpp',
'IPCBlobInputStreamThread.cpp',
'IPCBlobUtils.cpp',
'RemoteLazyInputStreamChild.cpp',
'RemoteLazyInputStreamParent.cpp',
'RemoteLazyInputStreamStorage.cpp',
'TemporaryIPCBlobChild.cpp',
'TemporaryIPCBlobParent.cpp',

View File

@@ -62,7 +62,6 @@
#include "mozilla/dom/indexedDB/PBackgroundIDBTransactionParent.h"
#include "mozilla/dom/indexedDB/PBackgroundIDBVersionChangeTransactionParent.h"
#include "mozilla/dom/indexedDB/PBackgroundIndexedDBUtilsParent.h"
#include "mozilla/dom/IPCBlobInputStreamParent.h"
#include "mozilla/dom/IPCBlobUtils.h"
#include "mozilla/dom/quota/CheckedUnsafePtr.h"
#include "mozilla/dom/quota/Client.h"
@@ -71,6 +70,7 @@
#include "mozilla/dom/quota/QuotaCommon.h"
#include "mozilla/dom/quota/QuotaManager.h"
#include "mozilla/dom/quota/UsageInfo.h"
#include "mozilla/dom/RemoteLazyInputStreamParent.h"
#include "mozilla/ipc/BackgroundParent.h"
#include "mozilla/ipc/BackgroundUtils.h"
#include "mozilla/ipc/InputStreamParams.h"
@@ -6053,7 +6053,7 @@ class Database::StartTransactionOp final
};
class Database::UnmapBlobCallback final
: public IPCBlobInputStreamParentCallback {
: public RemoteLazyInputStreamParentCallback {
SafeRefPtr<Database> mDatabase;
public:
@@ -13799,8 +13799,9 @@ void Database::MapBlob(const IPCBlob& aIPCBlob,
const IPCBlobStream& stream = aIPCBlob.inputStream();
MOZ_ASSERT(stream.type() == IPCBlobStream::TPRemoteLazyInputStreamParent);
IPCBlobInputStreamParent* actor = static_cast<IPCBlobInputStreamParent*>(
stream.get_PRemoteLazyInputStreamParent());
RemoteLazyInputStreamParent* actor =
static_cast<RemoteLazyInputStreamParent*>(
stream.get_PRemoteLazyInputStreamParent());
MOZ_ASSERT(!mMappedBlobs.GetWeak(actor->ID()));
mMappedBlobs.Put(actor->ID(), AsRefPtr(std::move(aFileInfo)));

View File

@@ -51,7 +51,6 @@
#include "mozilla/dom/ExternalHelperAppChild.h"
#include "mozilla/dom/GetFilesHelper.h"
#include "mozilla/dom/InProcessChild.h"
#include "mozilla/dom/IPCBlobInputStreamChild.h"
#include "mozilla/dom/IPCBlobUtils.h"
#include "mozilla/dom/JSActorService.h"
#include "mozilla/dom/JSProcessActorBinding.h"
@@ -63,6 +62,7 @@
#include "mozilla/dom/ContentPlaybackController.h"
#include "mozilla/dom/PostMessageEvent.h"
#include "mozilla/dom/PushNotifier.h"
#include "mozilla/dom/RemoteLazyInputStreamChild.h"
#include "mozilla/dom/RemoteWorkerService.h"
#include "mozilla/dom/ScreenOrientation.h"
#include "mozilla/dom/ServiceWorkerManager.h"
@@ -1806,8 +1806,8 @@ bool ContentChild::DeallocPFileDescriptorSetChild(
already_AddRefed<PRemoteLazyInputStreamChild>
ContentChild::AllocPRemoteLazyInputStreamChild(const nsID& aID,
const uint64_t& aSize) {
RefPtr<IPCBlobInputStreamChild> actor =
new IPCBlobInputStreamChild(aID, aSize);
RefPtr<RemoteLazyInputStreamChild> actor =
new RemoteLazyInputStreamChild(aID, aSize);
return actor.forget();
}

View File

@@ -96,7 +96,6 @@
#include "mozilla/dom/GeolocationBinding.h"
#include "mozilla/dom/GeolocationPositionError.h"
#include "mozilla/dom/GetFilesHelper.h"
#include "mozilla/dom/IPCBlobInputStreamParent.h"
#include "mozilla/dom/IPCBlobUtils.h"
#include "mozilla/dom/JSActorService.h"
#include "mozilla/dom/JSProcessActorBinding.h"
@@ -113,6 +112,7 @@
#include "mozilla/dom/PresentationParent.h"
#include "mozilla/dom/ProcessMessageManager.h"
#include "mozilla/dom/PushNotifier.h"
#include "mozilla/dom/RemoteLazyInputStreamParent.h"
#include "mozilla/dom/ServiceWorkerManager.h"
#include "mozilla/dom/ServiceWorkerRegistrar.h"
#include "mozilla/dom/ServiceWorkerUtils.h"

View File

@@ -25,7 +25,6 @@
#include "mozilla/dom/PFileSystemRequestChild.h"
#include "mozilla/dom/EndpointForReportChild.h"
#include "mozilla/dom/FileSystemTaskBase.h"
#include "mozilla/dom/IPCBlobInputStreamChild.h"
#include "mozilla/dom/PMediaTransportChild.h"
#include "mozilla/dom/TemporaryIPCBlobChild.h"
#include "mozilla/dom/cache/ActorUtils.h"
@@ -33,6 +32,7 @@
#include "mozilla/dom/indexedDB/PBackgroundIndexedDBUtilsChild.h"
#include "mozilla/dom/IPCBlobUtils.h"
#include "mozilla/dom/quota/PQuotaChild.h"
#include "mozilla/dom/RemoteLazyInputStreamChild.h"
#include "mozilla/dom/RemoteWorkerChild.h"
#include "mozilla/dom/RemoteWorkerControllerChild.h"
#include "mozilla/dom/RemoteWorkerServiceChild.h"
@@ -386,8 +386,8 @@ bool BackgroundChildImpl::DeallocPFileCreatorChild(PFileCreatorChild* aActor) {
already_AddRefed<dom::PRemoteLazyInputStreamChild>
BackgroundChildImpl::AllocPRemoteLazyInputStreamChild(const nsID& aID,
const uint64_t& aSize) {
RefPtr<dom::IPCBlobInputStreamChild> actor =
new dom::IPCBlobInputStreamChild(aID, aSize);
RefPtr<dom::RemoteLazyInputStreamChild> actor =
new dom::RemoteLazyInputStreamChild(aID, aSize);
return actor.forget();
}

View File

@@ -33,11 +33,11 @@
#include "mozilla/dom/TemporaryIPCBlobParent.h"
#include "mozilla/dom/cache/ActorUtils.h"
#include "mozilla/dom/indexedDB/ActorsParent.h"
#include "mozilla/dom/IPCBlobInputStreamParent.h"
#include "mozilla/dom/IPCBlobUtils.h"
#include "mozilla/dom/localstorage/ActorsParent.h"
#include "mozilla/dom/quota/ActorsParent.h"
#include "mozilla/dom/simpledb/ActorsParent.h"
#include "mozilla/dom/RemoteLazyInputStreamParent.h"
#include "mozilla/dom/RemoteWorkerParent.h"
#include "mozilla/dom/RemoteWorkerControllerParent.h"
#include "mozilla/dom/RemoteWorkerServiceParent.h"
@@ -629,8 +629,8 @@ BackgroundParentImpl::AllocPRemoteLazyInputStreamParent(const nsID& aID,
AssertIsInMainOrSocketProcess();
AssertIsOnBackgroundThread();
RefPtr<dom::IPCBlobInputStreamParent> actor =
dom::IPCBlobInputStreamParent::Create(aID, aSize, this);
RefPtr<dom::RemoteLazyInputStreamParent> actor =
dom::RemoteLazyInputStreamParent::Create(aID, aSize, this);
return actor.forget();
}
@@ -638,7 +638,8 @@ mozilla::ipc::IPCResult
BackgroundParentImpl::RecvPRemoteLazyInputStreamConstructor(
dom::PRemoteLazyInputStreamParent* aActor, const nsID& aID,
const uint64_t& aSize) {
if (!static_cast<dom::IPCBlobInputStreamParent*>(aActor)->HasValidStream()) {
if (!static_cast<dom::RemoteLazyInputStreamParent*>(aActor)
->HasValidStream()) {
return IPC_FAIL_NO_REASON(this);
}

View File

@@ -11,7 +11,7 @@
#include "mozilla/Assertions.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/IPCBlobInputStream.h"
#include "mozilla/dom/IPCBlobInputStreamChild.h"
#include "mozilla/dom/RemoteLazyInputStreamChild.h"
#include "mozilla/dom/RemoteLazyInputStreamStorage.h"
#include "mozilla/dom/quota/DecryptingInputStream_impl.h"
#include "mozilla/dom/quota/IPCStreamCipherStrategy.h"
@@ -293,8 +293,9 @@ already_AddRefed<nsIInputStream> InputStreamHelper::DeserializeInputStream(
// parent -> child serializations receive an IPCBlobInputStream actor.
MOZ_ASSERT(params.type() ==
IPCBlobInputStreamParams::TPRemoteLazyInputStreamChild);
IPCBlobInputStreamChild* actor = static_cast<IPCBlobInputStreamChild*>(
params.get_PRemoteLazyInputStreamChild());
RemoteLazyInputStreamChild* actor =
static_cast<RemoteLazyInputStreamChild*>(
params.get_PRemoteLazyInputStreamChild());
nsCOMPtr<nsIInputStream> stream = actor->CreateStream();
return stream.forget();
}

View File

@@ -11,8 +11,8 @@
#include "HttpTransactionChild.h"
#include "HttpConnectionMgrChild.h"
#include "mozilla/Assertions.h"
#include "mozilla/dom/IPCBlobInputStreamChild.h"
#include "mozilla/dom/MemoryReportRequest.h"
#include "mozilla/dom/RemoteLazyInputStreamChild.h"
#include "mozilla/ipc/CrashReporterClient.h"
#include "mozilla/ipc/BackgroundChild.h"
#include "mozilla/ipc/BackgroundParent.h"
@@ -467,8 +467,8 @@ mozilla::ipc::IPCResult SocketProcessChild::RecvNotifyObserver(
already_AddRefed<dom::PRemoteLazyInputStreamChild>
SocketProcessChild::AllocPRemoteLazyInputStreamChild(const nsID& aID,
const uint64_t& aSize) {
RefPtr<dom::IPCBlobInputStreamChild> actor =
new dom::IPCBlobInputStreamChild(aID, aSize);
RefPtr<dom::RemoteLazyInputStreamChild> actor =
new dom::RemoteLazyInputStreamChild(aID, aSize);
return actor.forget();
}

View File

@@ -10,8 +10,8 @@
#include "CachePushChecker.h"
#include "HttpTransactionParent.h"
#include "SocketProcessHost.h"
#include "mozilla/dom/IPCBlobInputStreamParent.h"
#include "mozilla/dom/MemoryReportRequest.h"
#include "mozilla/dom/RemoteLazyInputStreamParent.h"
#include "mozilla/ipc/FileDescriptorSetParent.h"
#include "mozilla/ipc/IPCStreamAlloc.h"
#include "mozilla/ipc/PChildToParentStreamParent.h"
@@ -391,8 +391,8 @@ void SocketProcessParent::Destroy(UniquePtr<SocketProcessParent>&& aParent) {
already_AddRefed<dom::PRemoteLazyInputStreamParent>
SocketProcessParent::AllocPRemoteLazyInputStreamParent(const nsID& aID,
const uint64_t& aSize) {
RefPtr<dom::IPCBlobInputStreamParent> actor =
dom::IPCBlobInputStreamParent::Create(aID, aSize, this);
RefPtr<dom::RemoteLazyInputStreamParent> actor =
dom::RemoteLazyInputStreamParent::Create(aID, aSize, this);
return actor.forget();
}
@@ -400,7 +400,8 @@ mozilla::ipc::IPCResult
SocketProcessParent::RecvPRemoteLazyInputStreamConstructor(
dom::PRemoteLazyInputStreamParent* aActor, const nsID& aID,
const uint64_t& aSize) {
if (!static_cast<dom::IPCBlobInputStreamParent*>(aActor)->HasValidStream()) {
if (!static_cast<dom::RemoteLazyInputStreamParent*>(aActor)
->HasValidStream()) {
return IPC_FAIL_NO_REASON(this);
}

View File

@@ -82,7 +82,7 @@
#include "nsThreadUtils.h"
#include "nsURLHelper.h"
#include "mozilla/dom/IPCBlobUtils.h"
#include "mozilla/dom/IPCBlobInputStreamChild.h"
#include "mozilla/dom/RemoteLazyInputStreamChild.h"
namespace mozilla {
namespace net {
@@ -3680,8 +3680,8 @@ HttpBaseChannel::ReplacementChannelConfig::ReplacementChannelConfig(
method = aInit.method();
referrerInfo = aInit.referrerInfo();
timedChannel = aInit.timedChannel();
if (dom::IPCBlobInputStreamChild* actor =
static_cast<dom::IPCBlobInputStreamChild*>(
if (dom::RemoteLazyInputStreamChild* actor =
static_cast<dom::RemoteLazyInputStreamChild*>(
aInit.uploadStreamChild())) {
uploadStreamLength = actor->Size();
uploadStream = actor->CreateStream();