From 2bd17b771aedaa04f88a626165f7b63554dd5a0f Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Tue, 24 Oct 2017 12:02:40 +0200 Subject: [PATCH] Bug 1408333 Get rid of nsIIPCBackgroundChildCreateCallback - part 5 - IPCBlob, r=asuth --- dom/file/ipc/IPCBlobInputStreamThread.cpp | 32 +++++++---------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/dom/file/ipc/IPCBlobInputStreamThread.cpp b/dom/file/ipc/IPCBlobInputStreamThread.cpp index 29e9d9fa662e..15671b7cb769 100644 --- a/dom/file/ipc/IPCBlobInputStreamThread.cpp +++ b/dom/file/ipc/IPCBlobInputStreamThread.cpp @@ -11,7 +11,6 @@ #include "mozilla/TaskCategory.h" #include "mozilla/ipc/BackgroundChild.h" #include "mozilla/ipc/PBackgroundChild.h" -#include "nsIIPCBackgroundChildCreateCallback.h" #include "nsXPCOMPrivate.h" namespace mozilla { @@ -42,11 +41,8 @@ public: }; class MigrateActorRunnable final : public Runnable - , public nsIIPCBackgroundChildCreateCallback { public: - NS_DECL_ISUPPORTS_INHERITED - explicit MigrateActorRunnable(IPCBlobInputStreamChild* aActor) : Runnable("dom::MigrateActorRunnable") , mActor(aActor) @@ -56,30 +52,25 @@ public: NS_IMETHOD Run() override - { - BackgroundChild::GetOrCreateForCurrentThread(this); - return NS_OK; - } - - void - ActorFailed() override - { - // We cannot continue. We are probably shutting down. - } - - void - ActorCreated(mozilla::ipc::PBackgroundChild* aActor) override { MOZ_ASSERT(mActor->State() == IPCBlobInputStreamChild::eInactiveMigrating); - if (aActor->SendPIPCBlobInputStreamConstructor(mActor, mActor->ID(), - mActor->Size())) { + PBackgroundChild* actorChild = + BackgroundChild::GetOrCreateForCurrentThread(); + if (!actorChild) { + return NS_OK; + } + + if (actorChild->SendPIPCBlobInputStreamConstructor(mActor, mActor->ID(), + mActor->Size())) { // We need manually to increase the reference for this actor because the // IPC allocator method is not triggered. The Release() is called by IPDL // when the actor is deleted. mActor.get()->AddRef(); mActor->Migrated(); } + + return NS_OK; } private: @@ -88,9 +79,6 @@ private: RefPtr mActor; }; -NS_IMPL_ISUPPORTS_INHERITED(MigrateActorRunnable, Runnable, - nsIIPCBackgroundChildCreateCallback) - } // anonymous NS_IMPL_ISUPPORTS(IPCBlobInputStreamThread, nsIObserver, nsIEventTarget)