Bug 1408333 Get rid of nsIIPCBackgroundChildCreateCallback - part 5 - IPCBlob, r=asuth

This commit is contained in:
Andrea Marchesini 2017-10-24 12:02:40 +02:00
Родитель b244cf03d0
Коммит 2bd17b771a
1 изменённых файлов: 10 добавлений и 22 удалений

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

@ -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)
@ -57,22 +53,15 @@ public:
NS_IMETHOD
Run() override
{
BackgroundChild::GetOrCreateForCurrentThread(this);
MOZ_ASSERT(mActor->State() == IPCBlobInputStreamChild::eInactiveMigrating);
PBackgroundChild* actorChild =
BackgroundChild::GetOrCreateForCurrentThread();
if (!actorChild) {
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(),
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
@ -80,6 +69,8 @@ public:
mActor.get()->AddRef();
mActor->Migrated();
}
return NS_OK;
}
private:
@ -88,9 +79,6 @@ private:
RefPtr<IPCBlobInputStreamChild> mActor;
};
NS_IMPL_ISUPPORTS_INHERITED(MigrateActorRunnable, Runnable,
nsIIPCBackgroundChildCreateCallback)
} // anonymous
NS_IMPL_ISUPPORTS(IPCBlobInputStreamThread, nsIObserver, nsIEventTarget)