зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1874739 - Part 5: Make PBackgroundSDBConnection refcounted, r=dom-storage-reviewers,janv
This is part of removing [ManualDealloc] from all protocols which manage other protocols. Differential Revision: https://phabricator.services.mozilla.com/D198615
This commit is contained in:
Родитель
4f815c5b58
Коммит
5c1ddd31bc
|
@ -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();
|
||||
|
|
|
@ -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<DirectoryLock&> MaybeDirectoryLockRef() const {
|
||||
AssertIsOnBackgroundThread();
|
||||
|
@ -525,9 +525,9 @@ void AllowToCloseConnectionsMatching(const Condition& aCondition) {
|
|||
* Exported functions
|
||||
******************************************************************************/
|
||||
|
||||
PBackgroundSDBConnectionParent* AllocPBackgroundSDBConnectionParent(
|
||||
const PersistenceType& aPersistenceType,
|
||||
const PrincipalInfo& aPrincipalInfo) {
|
||||
already_AddRefed<PBackgroundSDBConnectionParent>
|
||||
AllocPBackgroundSDBConnectionParent(const PersistenceType& aPersistenceType,
|
||||
const PrincipalInfo& aPrincipalInfo) {
|
||||
AssertIsOnBackgroundThread();
|
||||
|
||||
if (NS_WARN_IF(QuotaClient::IsShuttingDownOnBackgroundThread())) {
|
||||
|
@ -551,7 +551,7 @@ PBackgroundSDBConnectionParent* AllocPBackgroundSDBConnectionParent(
|
|||
|
||||
RefPtr<Connection> 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<Connection> actor = dont_AddRef(static_cast<Connection*>(aActor));
|
||||
return true;
|
||||
}
|
||||
|
||||
namespace simpledb {
|
||||
|
||||
already_AddRefed<mozilla::dom::quota::Client> CreateQuotaClient() {
|
||||
|
|
|
@ -30,7 +30,8 @@ class Client;
|
|||
|
||||
} // namespace quota
|
||||
|
||||
PBackgroundSDBConnectionParent* AllocPBackgroundSDBConnectionParent(
|
||||
already_AddRefed<PBackgroundSDBConnectionParent>
|
||||
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<mozilla::dom::quota::Client> CreateQuotaClient();
|
||||
|
|
|
@ -41,7 +41,7 @@ union SDBRequestParams
|
|||
SDBRequestCloseParams;
|
||||
};
|
||||
|
||||
[ManualDealloc, ChildImpl=virtual, ParentImpl=virtual]
|
||||
[ChildImpl=virtual, ParentImpl=virtual]
|
||||
protocol PBackgroundSDBConnection
|
||||
{
|
||||
manager PBackground;
|
||||
|
|
|
@ -192,7 +192,7 @@ nsresult SDBConnection::EnsureBackgroundActor() {
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
SDBConnectionChild* actor = new SDBConnectionChild(this);
|
||||
RefPtr<SDBConnectionChild> actor = new SDBConnectionChild(this);
|
||||
|
||||
mBackgroundActor = static_cast<SDBConnectionChild*>(
|
||||
backgroundActor->SendPBackgroundSDBConnectionConstructor(
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -244,7 +244,7 @@ mozilla::ipc::IPCResult BackgroundParentImpl::RecvFlushPendingFileDeletions() {
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
BackgroundParentImpl::PBackgroundSDBConnectionParent*
|
||||
already_AddRefed<BackgroundParentImpl::PBackgroundSDBConnectionParent>
|
||||
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,
|
||||
|
|
|
@ -45,7 +45,8 @@ class BackgroundParentImpl : public PBackgroundParent {
|
|||
|
||||
mozilla::ipc::IPCResult RecvFlushPendingFileDeletions() override;
|
||||
|
||||
PBackgroundSDBConnectionParent* AllocPBackgroundSDBConnectionParent(
|
||||
already_AddRefed<PBackgroundSDBConnectionParent>
|
||||
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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче