Bug 1570369 - Part 7: Use IPDL refcounted for PFileSystemRequest, r=baku

Differential Revision: https://phabricator.services.mozilla.com/D40260

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nika Layzell 2019-08-08 16:46:37 +00:00
parent 4825c16f54
commit c58a226270
8 changed files with 7 additions and 46 deletions

View File

@ -17,7 +17,7 @@ class FileSystemParams;
class FileSystemTaskParentBase;
class FileSystemRequestParent final : public PFileSystemRequestParent {
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FileSystemRequestParent)
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FileSystemRequestParent, final)
public:
FileSystemRequestParent();

View File

@ -139,11 +139,6 @@ void FileSystemTaskChildBase::Start() {
return;
}
// Retain a reference so the task object isn't deleted without IPDL's
// knowledge. The reference will be released by
// mozilla::ipc::BackgroundChildImpl::DeallocPFileSystemRequestChild.
NS_ADDREF_THIS();
if (NS_IsMainThread()) {
nsIEventTarget* target = mGlobalObject->EventTargetFor(TaskCategory::Other);
MOZ_ASSERT(target);

View File

@ -102,7 +102,7 @@ class FileSystemTaskChildBase : public PFileSystemRequestChild {
friend class PFileSystemRequestChild;
public:
NS_INLINE_DECL_REFCOUNTING(FileSystemTaskChildBase)
NS_INLINE_DECL_REFCOUNTING(FileSystemTaskChildBase, final)
/*
* Start the task. It will dispatch all the information to the parent process,

View File

@ -66,7 +66,7 @@ union FileSystemResponseValue
FileSystemErrorResponse;
};
protocol PFileSystemRequest
refcounted protocol PFileSystemRequest
{
manager PBackground;

View File

@ -631,21 +631,6 @@ bool BackgroundChildImpl::DeallocPMIDIManagerChild(PMIDIManagerChild* aActor) {
return true;
}
dom::PFileSystemRequestChild* BackgroundChildImpl::AllocPFileSystemRequestChild(
const FileSystemParams& aParams) {
MOZ_CRASH("Should never get here!");
return nullptr;
}
bool BackgroundChildImpl::DeallocPFileSystemRequestChild(
PFileSystemRequestChild* aActor) {
// The reference is increased in FileSystemTaskBase::Start of
// FileSystemTaskBase.cpp. We should decrease it after IPC.
RefPtr<dom::FileSystemTaskChildBase> child =
dont_AddRef(static_cast<dom::FileSystemTaskChildBase*>(aActor));
return true;
}
// Gamepad API Background IPC
dom::PGamepadEventChannelChild*
BackgroundChildImpl::AllocPGamepadEventChannelChild() {

View File

@ -225,12 +225,6 @@ class BackgroundChildImpl : public PBackgroundChild {
virtual bool DeallocPQuotaChild(PQuotaChild* aActor) override;
virtual PFileSystemRequestChild* AllocPFileSystemRequestChild(
const FileSystemParams&) override;
virtual bool DeallocPFileSystemRequestChild(
PFileSystemRequestChild*) override;
// Gamepad API Background IPC
virtual PGamepadEventChannelChild* AllocPGamepadEventChannelChild() override;

View File

@ -1027,7 +1027,7 @@ mozilla::ipc::IPCResult BackgroundParentImpl::RecvShutdownQuotaManager() {
return IPC_OK();
}
dom::PFileSystemRequestParent*
already_AddRefed<dom::PFileSystemRequestParent>
BackgroundParentImpl::AllocPFileSystemRequestParent(
const FileSystemParams& aParams) {
AssertIsInMainOrSocketProcess();
@ -1039,7 +1039,7 @@ BackgroundParentImpl::AllocPFileSystemRequestParent(
return nullptr;
}
return result.forget().take();
return result.forget();
}
mozilla::ipc::IPCResult BackgroundParentImpl::RecvPFileSystemRequestConstructor(
@ -1048,16 +1048,6 @@ mozilla::ipc::IPCResult BackgroundParentImpl::RecvPFileSystemRequestConstructor(
return IPC_OK();
}
bool BackgroundParentImpl::DeallocPFileSystemRequestParent(
PFileSystemRequestParent* aDoomed) {
AssertIsInMainOrSocketProcess();
AssertIsOnBackgroundThread();
RefPtr<FileSystemRequestParent> parent =
dont_AddRef(static_cast<FileSystemRequestParent*>(aDoomed));
return true;
}
// Gamepad API Background IPC
dom::PGamepadEventChannelParent*
BackgroundParentImpl::AllocPGamepadEventChannelParent() {

View File

@ -282,15 +282,12 @@ class BackgroundParentImpl : public PBackgroundParent {
virtual mozilla::ipc::IPCResult RecvShutdownQuotaManager() override;
virtual PFileSystemRequestParent* AllocPFileSystemRequestParent(
const FileSystemParams&) override;
virtual already_AddRefed<PFileSystemRequestParent>
AllocPFileSystemRequestParent(const FileSystemParams&) override;
virtual mozilla::ipc::IPCResult RecvPFileSystemRequestConstructor(
PFileSystemRequestParent* actor, const FileSystemParams& params) override;
virtual bool DeallocPFileSystemRequestParent(
PFileSystemRequestParent*) override;
// Gamepad API Background IPC
virtual PGamepadEventChannelParent* AllocPGamepadEventChannelParent()
override;