All present uses of the call-site arguments to MozPromise's methods
supply static strings. However, this is nowhere enforced. Do so.
Additionally, since this is the third or fourth time the present author
alone has personally implemented such an enforcement mechanism, create a
helper class to simplify doing so.
No functional changes.
Differential Revision: https://phabricator.services.mozilla.com/D207462
Both use cases of the getter of the WritableFileStream pointer are already handling the case where the result is null. In the debug-only check of whether all streams are closed, null result is possible, as evidenced by the bug. When the streams are closed at shutdown, we assume that closing takes place only once and the result is not null but since the second closing can be handled as a no-op, it is not necessary enforce this expectation, following declarative API design.
Differential Revision: https://phabricator.services.mozilla.com/D202589
Some quota clients currently use the BaseVFS (instead of QuotaVFS) during
origin initialization which makes sense at first glance (there's no need to
track usage when temporary storage is only being initialized).
However, QuotaVFS provides other important functionality besides quota checks
which is the overridden xFullPathname method. The overridden implementation is
needed to avoid file path normalization on Windows.
This patch changes relevant quota clients to always use QuotaVFS, even during
origin initialization to take advantage of the overriden xFullPathname method.
There will be no quota checks during origin initialization just like before
because the passed directory lock id is -1. GetQuotaObject will return nullptr
in that case.
Depends on D198187
Differential Revision: https://phabricator.services.mozilla.com/D198188
There are two similar GetStorageConnection overloads. The only difference is
that they use different mozIStorageService methods for database opening.
The overloads can be easilly merged into just one method, so database opening
will be done using mozIStorageService::GetDatabaseFileURL even when called
from FileSystemQuotaClient::InitOrigin.
Depends on D194519
Differential Revision: https://phabricator.services.mozilla.com/D198186
One of the goals of the asynchronous temporary storage initialization is to
call EnsureTemporaryStorageIsInitialized only from InitTemporaryStorageOp.
Calling from other places including quota clients will be disallowed by
changing the method to a private method. The private nature of the method
should be emphasized by adding the Internal suffix.
Differential Revision: https://phabricator.services.mozilla.com/D188332
AddCallbacksWithCycleCollectedArgs prevents potential cycle. (I'm assuming `this` and `newPage` cannot make cycle here)
Also making FileSystemDirectoryIterator::Impl as refcountable to safely capture `this`.
Differential Revision: https://phabricator.services.mozilla.com/D182940
OPFS currently creates a client directory lock first and then when the
client directorylock is acquired, it bounces to the QuotaManager I/O thread
where it ensures that storage is initialized. This can be now replaced by just
calling QuotaManager::OpenClientDirectory.
Changes done in this patch:
- replaced QuotaManager::CreateDirectoryLock call with
QuotaManager::OpenClientDirectory
- removed EnsureStorageIsInitializedInternal call from
EnsureFileSystemDirectory
Differential Revision: https://phabricator.services.mozilla.com/D186114
TestFileSystemQuotaClient tests currently call InitializeStorage before calling
CreateRegisteredDataManager. However, CreateRegisteredDataManager calls
FileSystemDataManager::GetOrCreateFileSystemDataManager which ensures storage
is initialized, so the prior InitializeStorage call can be removed.
Changes done in this patch:
- removed all calls to InitializeStorage
- removed InitializeStorage method
Differential Revision: https://phabricator.services.mozilla.com/D186113
OriginOperationBase currently uses manual dispatching of runnables controlled
by a state machine which is not that easy to understand and requires many
helper methods. Additionally, OriginOperationBase can be destroyed off the
PBackground thread which makes it hard to hold PBackground only objects.
Changes done in this patch:
- changed OriginOperationBase to not inherit from Runnable
- changed OriginOperationBase to be created and destroyed on the PBackground thread only
- replaced the manual dispatching of runnables with a MozPromise chain
- removed OriginOperationBase::Dispatch
- changed pure virtual method OriginOperationBase::Open to return a MozPromise
- changed FinalizeOriginEvictionOp to be always created on the PBackground
thread only (as a consequence of similar changes done to OriginOperationBase)
Differential Revision: https://phabricator.services.mozilla.com/D185641
CreateDirectoryLock currently takes three separate arguments which can be
expressed as just one argument.
Changes done in this patch:
- QuotaManager::CreateDirectoryLock changed to take just client metadata
- all call sites updated to reflect the changed signature
Differential Revision: https://phabricator.services.mozilla.com/D185568
One of the goals of bug 1749504 is to call EnsureStorageIsInitialized only from
InitOp. Calling from other places including quota clients will be disallowed
by changing the method to a private method. The private nature of the method
should be emphasized by adding the Internal suffix.
Changes done in this patch:
- IsStorageInitialized renamed to IsStorageInitializedInternal
- AssertStorageIsInitialized renamed to AssertStorageIsInitializedInternal
- EnsureStorageIsInitialized renamed to EnsureStorageIsInitializedInternal
Differential Revision: https://phabricator.services.mozilla.com/D185547