diff --git a/dom/simpledb/ActorsChild.h b/dom/simpledb/ActorsChild.h index ba8a77b7ac8d..36a5cdef33e6 100644 --- a/dom/simpledb/ActorsChild.h +++ b/dom/simpledb/ActorsChild.h @@ -34,7 +34,7 @@ class SDBConnectionChild final : public PBackgroundSDBConnectionChild { SDBConnection* mConnection; - NS_DECL_OWNINGTHREAD + NS_INLINE_DECL_REFCOUNTING(SDBConnectionChild, override) public: void AssertIsOnOwningThread() const { @@ -45,7 +45,6 @@ class SDBConnectionChild final : public PBackgroundSDBConnectionChild { // Only created by SDBConnection. explicit SDBConnectionChild(SDBConnection* aConnection); - // Only destroyed by mozilla::ipc::BackgroundChildImpl. ~SDBConnectionChild(); void SendDeleteMeInternal(); diff --git a/dom/simpledb/ActorsParent.cpp b/dom/simpledb/ActorsParent.cpp index 338eb2dc8094..7864cd31f4ae 100644 --- a/dom/simpledb/ActorsParent.cpp +++ b/dom/simpledb/ActorsParent.cpp @@ -128,7 +128,7 @@ class Connection final : public PBackgroundSDBConnectionParent { Connection(PersistenceType aPersistenceType, const PrincipalInfo& aPrincipalInfo); - NS_INLINE_DECL_THREADSAFE_REFCOUNTING(mozilla::dom::Connection) + NS_INLINE_DECL_THREADSAFE_REFCOUNTING(mozilla::dom::Connection, override) Maybe MaybeDirectoryLockRef() const { AssertIsOnBackgroundThread(); @@ -525,9 +525,9 @@ void AllowToCloseConnectionsMatching(const Condition& aCondition) { * Exported functions ******************************************************************************/ -PBackgroundSDBConnectionParent* AllocPBackgroundSDBConnectionParent( - const PersistenceType& aPersistenceType, - const PrincipalInfo& aPrincipalInfo) { +already_AddRefed +AllocPBackgroundSDBConnectionParent(const PersistenceType& aPersistenceType, + const PrincipalInfo& aPrincipalInfo) { AssertIsOnBackgroundThread(); if (NS_WARN_IF(QuotaClient::IsShuttingDownOnBackgroundThread())) { @@ -551,7 +551,7 @@ PBackgroundSDBConnectionParent* AllocPBackgroundSDBConnectionParent( RefPtr actor = new Connection(aPersistenceType, aPrincipalInfo); - return actor.forget().take(); + return actor.forget(); } bool RecvPBackgroundSDBConnectionConstructor( @@ -565,15 +565,6 @@ bool RecvPBackgroundSDBConnectionConstructor( return true; } -bool DeallocPBackgroundSDBConnectionParent( - PBackgroundSDBConnectionParent* aActor) { - AssertIsOnBackgroundThread(); - MOZ_ASSERT(aActor); - - RefPtr actor = dont_AddRef(static_cast(aActor)); - return true; -} - namespace simpledb { already_AddRefed CreateQuotaClient() { diff --git a/dom/simpledb/ActorsParent.h b/dom/simpledb/ActorsParent.h index 9502fe40979c..bba614bbde10 100644 --- a/dom/simpledb/ActorsParent.h +++ b/dom/simpledb/ActorsParent.h @@ -30,7 +30,8 @@ class Client; } // namespace quota -PBackgroundSDBConnectionParent* AllocPBackgroundSDBConnectionParent( +already_AddRefed +AllocPBackgroundSDBConnectionParent( const mozilla::dom::quota::PersistenceType& aPersistenceType, const mozilla::ipc::PrincipalInfo& aPrincipalInfo); @@ -39,9 +40,6 @@ bool RecvPBackgroundSDBConnectionConstructor( const mozilla::dom::quota::PersistenceType& aPersistenceType, const mozilla::ipc::PrincipalInfo& aPrincipalInfo); -bool DeallocPBackgroundSDBConnectionParent( - PBackgroundSDBConnectionParent* aActor); - namespace simpledb { already_AddRefed CreateQuotaClient(); diff --git a/dom/simpledb/PBackgroundSDBConnection.ipdl b/dom/simpledb/PBackgroundSDBConnection.ipdl index e8508f17b81e..729a8e06381d 100644 --- a/dom/simpledb/PBackgroundSDBConnection.ipdl +++ b/dom/simpledb/PBackgroundSDBConnection.ipdl @@ -41,7 +41,7 @@ union SDBRequestParams SDBRequestCloseParams; }; -[ManualDealloc, ChildImpl=virtual, ParentImpl=virtual] +[ChildImpl=virtual, ParentImpl=virtual] protocol PBackgroundSDBConnection { manager PBackground; diff --git a/dom/simpledb/SDBConnection.cpp b/dom/simpledb/SDBConnection.cpp index 25d3273c5524..2551c63acbdf 100644 --- a/dom/simpledb/SDBConnection.cpp +++ b/dom/simpledb/SDBConnection.cpp @@ -192,7 +192,7 @@ nsresult SDBConnection::EnsureBackgroundActor() { return NS_ERROR_FAILURE; } - SDBConnectionChild* actor = new SDBConnectionChild(this); + RefPtr actor = new SDBConnectionChild(this); mBackgroundActor = static_cast( backgroundActor->SendPBackgroundSDBConnectionConstructor( diff --git a/ipc/glue/BackgroundChildImpl.cpp b/ipc/glue/BackgroundChildImpl.cpp index 5a84e4ca5c0f..9ef4a9561167 100644 --- a/ipc/glue/BackgroundChildImpl.cpp +++ b/ipc/glue/BackgroundChildImpl.cpp @@ -177,23 +177,6 @@ bool BackgroundChildImpl::DeallocPBackgroundIndexedDBUtilsChild( return true; } -BackgroundChildImpl::PBackgroundSDBConnectionChild* -BackgroundChildImpl::AllocPBackgroundSDBConnectionChild( - const PersistenceType& aPersistenceType, - const PrincipalInfo& aPrincipalInfo) { - MOZ_CRASH( - "PBackgroundSDBConnectionChild actor should be manually " - "constructed!"); -} - -bool BackgroundChildImpl::DeallocPBackgroundSDBConnectionChild( - PBackgroundSDBConnectionChild* aActor) { - MOZ_ASSERT(aActor); - - delete aActor; - return true; -} - BackgroundChildImpl::PBackgroundLSDatabaseChild* BackgroundChildImpl::AllocPBackgroundLSDatabaseChild( const PrincipalInfo& aPrincipalInfo, const uint32_t& aPrivateBrowsingId, diff --git a/ipc/glue/BackgroundChildImpl.h b/ipc/glue/BackgroundChildImpl.h index 1e86b60e033c..1e0200bd7c2e 100644 --- a/ipc/glue/BackgroundChildImpl.h +++ b/ipc/glue/BackgroundChildImpl.h @@ -57,13 +57,6 @@ class BackgroundChildImpl : public PBackgroundChild { virtual bool DeallocPBackgroundIndexedDBUtilsChild( PBackgroundIndexedDBUtilsChild* aActor) override; - virtual PBackgroundSDBConnectionChild* AllocPBackgroundSDBConnectionChild( - const PersistenceType& aPersistenceType, - const PrincipalInfo& aPrincipalInfo) override; - - virtual bool DeallocPBackgroundSDBConnectionChild( - PBackgroundSDBConnectionChild* aActor) override; - virtual PBackgroundLSDatabaseChild* AllocPBackgroundLSDatabaseChild( const PrincipalInfo& aPrincipalInfo, const uint32_t& aPrivateBrowsingId, const uint64_t& aDatastoreId) override; diff --git a/ipc/glue/BackgroundParentImpl.cpp b/ipc/glue/BackgroundParentImpl.cpp index 694ff0507fea..5fb0b8a46764 100644 --- a/ipc/glue/BackgroundParentImpl.cpp +++ b/ipc/glue/BackgroundParentImpl.cpp @@ -244,7 +244,7 @@ mozilla::ipc::IPCResult BackgroundParentImpl::RecvFlushPendingFileDeletions() { return IPC_OK(); } -BackgroundParentImpl::PBackgroundSDBConnectionParent* +already_AddRefed BackgroundParentImpl::AllocPBackgroundSDBConnectionParent( const PersistenceType& aPersistenceType, const PrincipalInfo& aPrincipalInfo) { @@ -271,15 +271,6 @@ BackgroundParentImpl::RecvPBackgroundSDBConnectionConstructor( return IPC_OK(); } -bool BackgroundParentImpl::DeallocPBackgroundSDBConnectionParent( - PBackgroundSDBConnectionParent* aActor) { - AssertIsInMainProcess(); - AssertIsOnBackgroundThread(); - MOZ_ASSERT(aActor); - - return mozilla::dom::DeallocPBackgroundSDBConnectionParent(aActor); -} - BackgroundParentImpl::PBackgroundLSDatabaseParent* BackgroundParentImpl::AllocPBackgroundLSDatabaseParent( const PrincipalInfo& aPrincipalInfo, const uint32_t& aPrivateBrowsingId, diff --git a/ipc/glue/BackgroundParentImpl.h b/ipc/glue/BackgroundParentImpl.h index 43d366c85e74..cfa6830aba59 100644 --- a/ipc/glue/BackgroundParentImpl.h +++ b/ipc/glue/BackgroundParentImpl.h @@ -45,7 +45,8 @@ class BackgroundParentImpl : public PBackgroundParent { mozilla::ipc::IPCResult RecvFlushPendingFileDeletions() override; - PBackgroundSDBConnectionParent* AllocPBackgroundSDBConnectionParent( + already_AddRefed + AllocPBackgroundSDBConnectionParent( const PersistenceType& aPersistenceType, const PrincipalInfo& aPrincipalInfo) override; @@ -54,9 +55,6 @@ class BackgroundParentImpl : public PBackgroundParent { const PersistenceType& aPersistenceType, const PrincipalInfo& aPrincipalInfo) override; - bool DeallocPBackgroundSDBConnectionParent( - PBackgroundSDBConnectionParent* aActor) override; - PBackgroundLSDatabaseParent* AllocPBackgroundLSDatabaseParent( const PrincipalInfo& aPrincipalInfo, const uint32_t& aPrivateBrowsingId, const uint64_t& aDatastoreId) override;