Bug 1408333 Get rid of nsIIPCBackgroundChildCreateCallback - part 7 - FileSystem APIs, r=asuth

This commit is contained in:
Andrea Marchesini 2017-10-24 12:02:40 +02:00
parent 9b144e6a22
commit db3c2421d1
2 changed files with 6 additions and 37 deletions

View File

@ -105,8 +105,6 @@ private:
} // anonymous namespace
NS_IMPL_ISUPPORTS(FileSystemTaskChildBase, nsIIPCBackgroundChildCreateCallback)
/**
* FileSystemTaskBase class
*/
@ -140,35 +138,9 @@ FileSystemTaskChildBase::Start()
mFileSystem->AssertIsOnOwningThread();
mozilla::ipc::PBackgroundChild* actor =
mozilla::ipc::BackgroundChild::GetForCurrentThread();
if (actor) {
ActorCreated(actor);
} else {
if (NS_WARN_IF(
!mozilla::ipc::BackgroundChild::GetOrCreateForCurrentThread(this))) {
MOZ_CRASH();
}
}
}
void
FileSystemTaskChildBase::ActorFailed()
{
MOZ_CRASH("Failed to create a PBackgroundChild actor!");
}
void
FileSystemTaskChildBase::ActorCreated(mozilla::ipc::PBackgroundChild* aActor)
{
if (HasError()) {
// In this case we don't want to use IPC at all.
RefPtr<ErrorRunnable> runnable = new ErrorRunnable(this);
FileSystemUtils::DispatchRunnable(mGlobalObject, runnable.forget());
return;
}
if (mFileSystem->IsShutdown()) {
return;
mozilla::ipc::BackgroundChild::GetOrCreateForCurrentThread();
if (NS_WARN_IF(!actor)) {
MOZ_CRASH("Failed to create a PBackgroundChild actor!");
}
nsAutoString serialization;
@ -190,10 +162,10 @@ FileSystemTaskChildBase::ActorCreated(mozilla::ipc::PBackgroundChild* aActor)
nsIEventTarget* target = mGlobalObject->EventTargetFor(TaskCategory::Other);
MOZ_ASSERT(target);
aActor->SetEventTargetForActor(this, target);
actor->SetEventTargetForActor(this, target);
}
aActor->SendPFileSystemRequestConstructor(this, params);
actor->SendPFileSystemRequestConstructor(this, params);
}
void

View File

@ -10,7 +10,6 @@
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/FileSystemRequestParent.h"
#include "mozilla/dom/PFileSystemRequestChild.h"
#include "nsIIPCBackgroundChildCreateCallback.h"
#include "nsThreadUtils.h"
namespace mozilla {
@ -99,11 +98,9 @@ class FileSystemParams;
* (8) Call [HandlerCallback] to send the task result to the content page.
*/
class FileSystemTaskChildBase : public PFileSystemRequestChild
, public nsIIPCBackgroundChildCreateCallback
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIIPCBACKGROUNDCHILDCREATECALLBACK
NS_INLINE_DECL_REFCOUNTING(FileSystemTaskChildBase)
/*
* Start the task. It will dispatch all the information to the parent process,