зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1570369 - Part 11: Use IPDL refcounted for PIPCBlobInputStream, r=baku
Differential Revision: https://phabricator.services.mozilla.com/D40266 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
1b7d7ce8f0
Коммит
021bb13602
|
@ -37,7 +37,7 @@ class IPCBlobInputStreamChild final : public PIPCBlobInputStreamChild {
|
|||
eInactiveMigrating,
|
||||
};
|
||||
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(IPCBlobInputStreamChild)
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(IPCBlobInputStreamChild, final)
|
||||
|
||||
IPCBlobInputStreamChild(const nsID& aID, uint64_t aSize);
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class NS_NO_VTABLE IPCBlobInputStreamParentCallback {
|
|||
|
||||
class IPCBlobInputStreamParent final : public PIPCBlobInputStreamParent {
|
||||
public:
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(IPCBlobInputStreamParent)
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(IPCBlobInputStreamParent, 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
|
||||
|
|
|
@ -57,10 +57,6 @@ class MigrateActorRunnable final : public Runnable {
|
|||
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -106,11 +106,6 @@ nsresult SerializeInputStreamParent(nsIInputStream* aInputStream,
|
|||
return rv;
|
||||
}
|
||||
|
||||
// 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.
|
||||
parentActor.get()->AddRef();
|
||||
|
||||
if (!aManager->SendPIPCBlobInputStreamConstructor(
|
||||
parentActor, parentActor->ID(), parentActor->Size())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -13,7 +13,7 @@ include IPCStream;
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
protocol PIPCBlobInputStream
|
||||
refcounted protocol PIPCBlobInputStream
|
||||
{
|
||||
manager PBackground or PContent;
|
||||
|
||||
|
|
|
@ -1931,21 +1931,12 @@ bool ContentChild::DeallocPFileDescriptorSetChild(
|
|||
return true;
|
||||
}
|
||||
|
||||
PIPCBlobInputStreamChild* ContentChild::AllocPIPCBlobInputStreamChild(
|
||||
const nsID& aID, const uint64_t& aSize) {
|
||||
// IPCBlobInputStreamChild is refcounted. Here it's created and in
|
||||
// DeallocPIPCBlobInputStreamChild is released.
|
||||
|
||||
already_AddRefed<PIPCBlobInputStreamChild>
|
||||
ContentChild::AllocPIPCBlobInputStreamChild(const nsID& aID,
|
||||
const uint64_t& aSize) {
|
||||
RefPtr<IPCBlobInputStreamChild> actor =
|
||||
new IPCBlobInputStreamChild(aID, aSize);
|
||||
return actor.forget().take();
|
||||
}
|
||||
|
||||
bool ContentChild::DeallocPIPCBlobInputStreamChild(
|
||||
PIPCBlobInputStreamChild* aActor) {
|
||||
RefPtr<IPCBlobInputStreamChild> actor =
|
||||
dont_AddRef(static_cast<IPCBlobInputStreamChild*>(aActor));
|
||||
return true;
|
||||
return actor.forget();
|
||||
}
|
||||
|
||||
mozilla::PRemoteSpellcheckEngineChild*
|
||||
|
|
|
@ -198,11 +198,9 @@ class ContentChild final : public PContentChild,
|
|||
mozilla::ipc::IPCResult RecvSetProcessSandbox(
|
||||
const Maybe<FileDescriptor>& aBroker);
|
||||
|
||||
PIPCBlobInputStreamChild* AllocPIPCBlobInputStreamChild(
|
||||
already_AddRefed<PIPCBlobInputStreamChild> AllocPIPCBlobInputStreamChild(
|
||||
const nsID& aID, const uint64_t& aSize);
|
||||
|
||||
bool DeallocPIPCBlobInputStreamChild(PIPCBlobInputStreamChild* aActor);
|
||||
|
||||
PHalChild* AllocPHalChild();
|
||||
bool DeallocPHalChild(PHalChild*);
|
||||
|
||||
|
|
|
@ -3372,19 +3372,6 @@ mozilla::ipc::IPCResult ContentParent::RecvConstructPopupBrowser(
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
PIPCBlobInputStreamParent* ContentParent::AllocPIPCBlobInputStreamParent(
|
||||
const nsID& aID, const uint64_t& aSize) {
|
||||
MOZ_CRASH("PIPCBlobInputStreamParent actors should be manually constructed!");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool ContentParent::DeallocPIPCBlobInputStreamParent(
|
||||
PIPCBlobInputStreamParent* aActor) {
|
||||
RefPtr<IPCBlobInputStreamParent> actor =
|
||||
dont_AddRef(static_cast<IPCBlobInputStreamParent*>(aActor));
|
||||
return true;
|
||||
}
|
||||
|
||||
mozilla::PRemoteSpellcheckEngineParent*
|
||||
ContentParent::AllocPRemoteSpellcheckEngineParent() {
|
||||
mozilla::RemoteSpellcheckEngineParent* parent =
|
||||
|
|
|
@ -830,11 +830,6 @@ class ContentParent final : public PContentParent,
|
|||
const IPCTabContext& context, const WindowGlobalInit& initialWindowInit,
|
||||
const uint32_t& chromeFlags);
|
||||
|
||||
PIPCBlobInputStreamParent* AllocPIPCBlobInputStreamParent(
|
||||
const nsID& aID, const uint64_t& aSize);
|
||||
|
||||
bool DeallocPIPCBlobInputStreamParent(PIPCBlobInputStreamParent* aActor);
|
||||
|
||||
mozilla::ipc::IPCResult RecvIsSecureURI(
|
||||
const uint32_t& aType, const URIParams& aURI, const uint32_t& aFlags,
|
||||
const OriginAttributes& aOriginAttributes, bool* aIsSecureURI);
|
||||
|
|
|
@ -395,22 +395,12 @@ bool BackgroundChildImpl::DeallocPFileCreatorChild(PFileCreatorChild* aActor) {
|
|||
return true;
|
||||
}
|
||||
|
||||
dom::PIPCBlobInputStreamChild*
|
||||
already_AddRefed<dom::PIPCBlobInputStreamChild>
|
||||
BackgroundChildImpl::AllocPIPCBlobInputStreamChild(const nsID& aID,
|
||||
const uint64_t& aSize) {
|
||||
// IPCBlobInputStreamChild is refcounted. Here it's created and in
|
||||
// DeallocPIPCBlobInputStreamChild is released.
|
||||
|
||||
RefPtr<dom::IPCBlobInputStreamChild> actor =
|
||||
new dom::IPCBlobInputStreamChild(aID, aSize);
|
||||
return actor.forget().take();
|
||||
}
|
||||
|
||||
bool BackgroundChildImpl::DeallocPIPCBlobInputStreamChild(
|
||||
dom::PIPCBlobInputStreamChild* aActor) {
|
||||
RefPtr<dom::IPCBlobInputStreamChild> actor =
|
||||
dont_AddRef(static_cast<dom::IPCBlobInputStreamChild*>(aActor));
|
||||
return true;
|
||||
return actor.forget();
|
||||
}
|
||||
|
||||
PFileDescriptorSetChild* BackgroundChildImpl::AllocPFileDescriptorSetChild(
|
||||
|
|
|
@ -116,11 +116,9 @@ class BackgroundChildImpl : public PBackgroundChild {
|
|||
virtual bool DeallocPPendingIPCBlobChild(
|
||||
PPendingIPCBlobChild* aActor) override;
|
||||
|
||||
virtual PIPCBlobInputStreamChild* AllocPIPCBlobInputStreamChild(
|
||||
const nsID& aID, const uint64_t& aSize) override;
|
||||
|
||||
virtual bool DeallocPIPCBlobInputStreamChild(
|
||||
PIPCBlobInputStreamChild* aActor) override;
|
||||
virtual already_AddRefed<PIPCBlobInputStreamChild>
|
||||
AllocPIPCBlobInputStreamChild(const nsID& aID,
|
||||
const uint64_t& aSize) override;
|
||||
|
||||
virtual PTemporaryIPCBlobChild* AllocPTemporaryIPCBlobChild() override;
|
||||
|
||||
|
|
|
@ -605,7 +605,7 @@ bool BackgroundParentImpl::DeallocPTemporaryIPCBlobParent(
|
|||
return true;
|
||||
}
|
||||
|
||||
dom::PIPCBlobInputStreamParent*
|
||||
already_AddRefed<dom::PIPCBlobInputStreamParent>
|
||||
BackgroundParentImpl::AllocPIPCBlobInputStreamParent(const nsID& aID,
|
||||
const uint64_t& aSize) {
|
||||
AssertIsInMainOrSocketProcess();
|
||||
|
@ -613,7 +613,7 @@ BackgroundParentImpl::AllocPIPCBlobInputStreamParent(const nsID& aID,
|
|||
|
||||
RefPtr<dom::IPCBlobInputStreamParent> actor =
|
||||
dom::IPCBlobInputStreamParent::Create(aID, aSize, this);
|
||||
return actor.forget().take();
|
||||
return actor.forget();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
|
@ -627,17 +627,6 @@ BackgroundParentImpl::RecvPIPCBlobInputStreamConstructor(
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
bool BackgroundParentImpl::DeallocPIPCBlobInputStreamParent(
|
||||
dom::PIPCBlobInputStreamParent* aActor) {
|
||||
AssertIsInMainOrSocketProcess();
|
||||
AssertIsOnBackgroundThread();
|
||||
MOZ_ASSERT(aActor);
|
||||
|
||||
RefPtr<dom::IPCBlobInputStreamParent> actor =
|
||||
dont_AddRef(static_cast<dom::IPCBlobInputStreamParent*>(aActor));
|
||||
return true;
|
||||
}
|
||||
|
||||
PFileDescriptorSetParent* BackgroundParentImpl::AllocPFileDescriptorSetParent(
|
||||
const FileDescriptor& aFileDescriptor) {
|
||||
AssertIsInMainOrSocketProcess();
|
||||
|
|
|
@ -137,16 +137,14 @@ class BackgroundParentImpl : public PBackgroundParent {
|
|||
virtual bool DeallocPPendingIPCBlobParent(
|
||||
PPendingIPCBlobParent* aActor) override;
|
||||
|
||||
virtual PIPCBlobInputStreamParent* AllocPIPCBlobInputStreamParent(
|
||||
const nsID& aID, const uint64_t& aSize) override;
|
||||
virtual already_AddRefed<PIPCBlobInputStreamParent>
|
||||
AllocPIPCBlobInputStreamParent(const nsID& aID,
|
||||
const uint64_t& aSize) override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult RecvPIPCBlobInputStreamConstructor(
|
||||
PIPCBlobInputStreamParent* aActor, const nsID& aID,
|
||||
const uint64_t& aSize) override;
|
||||
|
||||
virtual bool DeallocPIPCBlobInputStreamParent(
|
||||
PIPCBlobInputStreamParent* aActor) override;
|
||||
|
||||
virtual PTemporaryIPCBlobParent* AllocPTemporaryIPCBlobParent() override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult RecvPTemporaryIPCBlobConstructor(
|
||||
|
|
Загрузка…
Ссылка в новой задаче