Open Bug 1866217 Opened 5 months ago Updated 2 months ago

Cover temporary storage initialization in OpenStorageDirectory and OpenClientDirectory

Categories

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

task

Tracking

()

ASSIGNED

People

(Reporter: janv, Assigned: janv)

References

(Depends on 2 open bugs, Blocks 2 open bugs)

Details

Attachments

(14 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
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

Quota clients and origin operations currently still have to call EnsureTemporaryStorageIsInitializedInternal method
on the QM IO thread. This should be covered by OpenStorageDirectory and OpenClientDirectory instead.

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
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: