Closed Bug 1866217 Opened 2 years ago Closed 1 year ago

Introduce PersistenceScope class à la OriginScope

Categories

(Core :: Storage: Quota Manager, task, P1)

task

Tracking

()

RESOLVED FIXED
131 Branch
Tracking Status
firefox131 --- fixed

People

(Reporter: janv, Assigned: janv)

References

(Blocks 1 open bug)

Details

Attachments

(7 files, 7 obsolete files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

Directory locks currently only support specifying a concrete persistence type or all persistence types. There are situations like temporary storage
initialization when multiple persistence types need to be specified. It would be possible to create multiple directory locks for that, but that would also introduce non-trivial additional complexity. A new PersistenceScope class in the style of OriginScope will make it easy to specify multiple persistence types.

Summary: Cover temporary storage and origin initialization in OpenStorageDirectory and OpenClientDirectory → Cover temporary storage initialization in OpenStorageDirectory and OpenClientDirectory
Blocks: 1866402

Cached origin usage can be currently obtained by passing fromMemory=true to
nsIQuotaManagerService::GetUsageForPrincipal. However, supporting both ways of
getting origin on one operation is not ideal for sevaral reasons. The return
value is a plain integer in the case of cached origin usage and getting cached
origin usage in theory doesn't have to go the QM IO thread. So it would be
better to have a dedicated method for that.

Depends on D194542

There's now a dedicated nsIQuotaManagerService::GetCachedUsageForPrincipal
method for getting cached origin usage. All callers of
nsIQuotaManagerService::GetUsageForPrincipal which want to get cached origin
usage for given principal can be now converted to call the new method.

Depends on D195360

Directory locks currently only support specifying a concrete persistence type
or all persistence types. There are situations like temporary storage
initialization when multiple persistence types need to be specified. It would
be possible to create multiple directory locks for that, but that would also
introduce non-trivial additional complexity. A new PersistenceScope class in
the style of OriginScope will makes it easy to specify multiple persistence
types. Support for actual persistence type sets will be added in a separate
patch, this patch just adds basic functionality.

Depends on D195365

Nullable<PersistenceType> only allows to specify a concrete persistence type or
all persistence types while PersistenceScope is intended to allow specification
of multiple persistence types as well. Support for that will be added in a
separate patch. This patch is about using the new type especially in directory
locks.

Depends on D195366

Temporary storage initialization can finally lock only specific repositories
instead of locking all repositories (actual temporary storage initialization
locking chagnes will be done in a separate patch).

Depends on D195373

Temporary storage initialization currently uses a directory lock over all
repositories which blocks any exclusive directory locks for the persistent
repository for now reason.

Depends on D195374

QuotaManager::OpenClientDirectory can now detect the requested persistence type
and initializa temporary storage if it's needed.

Depends on D195389

QuotaManager::OpenClientDirectory already makes sure that temporary storage
is initialized so all these calls are now redundant.

Depends on D195390

QuotaManager::OpenStorageDirectory can now detect the requested persistence
scope and initialize temporary storage if it's needed.

Depends on D195391

Attachment #9366769 - Attachment description: Bug 1866217 - Remove QuotaManager::EnsureTemporaryStorageIsInitializedInternal calls from quota clients; r=#dom-storage → Bug 1866217 - Remove QuotaManager::EnsureTemporaryStorageIsInitializedInternal calls from places where a directory lock is obtained via QuotaManager::OpenClientDirectory; r=#dom-storage

QuotaManager::OpenStorageDirectory already makes sure that temporary storage
is initialized so all these calls are now redundant.

Depends on D195393

The goal to call QuotaManager::EnsureTemporaryStorageIsInitializedInternal only
from InitTemporaryStorageOp has been achieved. It's now easy to change the
method to be a private method.

Depends on D195395

TestQuotaManager.cpp is getting big and the use of the Await helper reduces the
size of the file significantly and also make the tests more readable.

Depends on D195396

These additional tests are mainly to improve code coverage of
QuotaManager::InitializeTemporaryStorage method.

Depends on D195399

Depends on: 1873140
Depends on: 1883353
Depends on: 1903186
No longer depends on: 1883353
Keywords: leave-open
Pushed by jvarga@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d70ebc8c1c45 Add a dedicated method for getting cached origin usage; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/31f3c500ec27 Replace some nsIQuotaManagerService::GetUsageForPrincipal calls with nsIQuotaManagerService::GetCachedUsageForPrincipal; r=dom-storage-reviewers,jari
Pushed by jvarga@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b2ccb09583e3 Change nsIQuotaManagerService::GetUsageForPrincipal to support getting origin usage only by inspecting disk; r=dom-storage-reviewers,jari
Pushed by jvarga@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d20d53aeb69a Introduce PersistenceScope class à la OriginScope; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/a18fea81cdd6 Replace uses of Nullable<PersistenceType> type with PersistenceScope; r=dom-storage-reviewers,jari
Pushed by jvarga@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/441d2c47e27f Add support for persistence type sets to PersistenceScope; r=dom-storage-reviewers,jari
Pushed by jvarga@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f0bd45addadc Scope temporary storage initialization to temporary and default repository only; r=dom-storage-reviewers,jari
Pushed by jvarga@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/97190135be72 Add support for initializing temporary storage to QuotaManager::OpenClientDirectory; r=dom-storage-reviewers,jari
Blocks: 1913561
No longer blocks: 1866402
Flags: needinfo?(jvarga)
Summary: Cover temporary storage initialization in OpenStorageDirectory and OpenClientDirectory → Introduce PersistenceScope class à la OriginScope
No longer depends on: 1808294

Comment on attachment 9366768 [details]
Bug 1866217 - Add support for initializing temporary storage to QuotaManager::OpenClientDirectory; r=#dom-storage

Revision D195390 was moved to bug 1913561. Setting attachment 9366768 [details] to obsolete.

Attachment #9366768 - Attachment is obsolete: true

Comment on attachment 9366769 [details]
Bug 1866217 - Remove QuotaManager::EnsureTemporaryStorageIsInitializedInternal calls from places where a directory lock is obtained via QuotaManager::OpenClientDirectory; r=#dom-storage

Revision D195391 was moved to bug 1913561. Setting attachment 9366769 [details] to obsolete.

Attachment #9366769 - Attachment is obsolete: true

Comment on attachment 9366771 [details]
Bug 1866217 - Add support for initializing temporary storage to QuotaManager::OpenStorageDirectory; r=#dom-storage

Revision D195393 was moved to bug 1913561. Setting attachment 9366771 [details] to obsolete.

Attachment #9366771 - Attachment is obsolete: true

Comment on attachment 9366777 [details]
Bug 1866217 - Remove QuotaManager::EnsureTemporaryStorageIsInitializedInternal calls from places where a directory lock is obtained via QuotaManager::OpenStorageDirectory; r=#dom-storage

Revision D195395 was moved to bug 1913561. Setting attachment 9366777 [details] to obsolete.

Attachment #9366777 - Attachment is obsolete: true

Comment on attachment 9366782 [details]
Bug 1866217 - Change QuotaManager::EnsureTemporaryStorageIsInitializedInternal to be a private method; r=#dom-storage

Revision D195396 was moved to bug 1913561. Setting attachment 9366782 [details] to obsolete.

Attachment #9366782 - Attachment is obsolete: true

Comment on attachment 9366785 [details]
Bug 1866217 - Update QuotaManager gtests to use Await instead of manual spinning of the event loop; r=#dom-storage

Revision D195399 was moved to bug 1913561. Setting attachment 9366785 [details] to obsolete.

Attachment #9366785 - Attachment is obsolete: true

Comment on attachment 9366787 [details]
Bug 1866217 - Add more tests for QuotaManager::InitializeTemporaryStorage method; r=#dom-storage

Revision D195400 was moved to bug 1913561. Setting attachment 9366787 [details] to obsolete.

Attachment #9366787 - Attachment is obsolete: true
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 131 Branch
Blocks: 1913679
No longer blocks: 1913561
See Also: → 1920456
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: