Both methods now run on the PBackground thread, there's no need to have these as
separate methods anymore. The extra state can be now removed as well. This opens
the door for some further optimizations.
Differential Revision: https://phabricator.services.mozilla.com/D189757
FactoryOp::Open now contains no code which can only run on the main thread, so
it can be safely switched to running on the PBackground thread.
Differential Revision: https://phabricator.services.mozilla.com/D189756
InitializeQuotaManager already initializes the storage service on the main
thread, so the initialization in FactoryOp::Open can be just removed.
Differential Revision: https://phabricator.services.mozilla.com/D189755
mLocale is currently initialized in IndexedDatabaseManager::Init which is
called from IndexedDatabaseManager::GetOrCreate if the manager doesn't exist.
This can be a problem when IndexedDatabaseManager::GetOrCreate is called very
early,for example in nsLayoutStatics::Initialize in the parent process.
This is a preparation for moving IndexedDatabaseManager::GetOrCreate from
FactoryOp::Open to InitializeQuotaManager.
Differential Revision: https://phabricator.services.mozilla.com/D189891
FactoryOp::CheckPermission now contains only permission related code and it
always returns PermissionValue::kPermissionAllowed so it can be safely removed.
Differential Revision: https://phabricator.services.mozilla.com/D189754
The reference can be later used to stop already running maintenance (instead of
dispatching a dummy runnable to the connection thread).
Differential Revision: https://phabricator.services.mozilla.com/D201199
The warn only check is supposed to mach the debug only assertion, but it
is actually not in line with the assertion causing a lot of warnings during
test_connection_idle_maintenance.js execution.
Differential Revision: https://phabricator.services.mozilla.com/D200770
The warn only check is supposed to mach the debug only assertion, but it
is actually not in line with the assertion causing a lot of warnings during
test_connection_idle_maintenance.js execution.
Differential Revision: https://phabricator.services.mozilla.com/D200770
FactoryOp::mContentHandle was only needed to get a ContentParent to eventually
kill invalid child processes. This is now ensured directly by IPC_FAIL, so
mContentHandle can be safely replaced with mContentParentId which is still
needed for creation of Database objects (which need it for implementation of
Database::IsOwnedByProcess).
Differential Revision: https://phabricator.services.mozilla.com/D189718
IPC_FAIL returned in PBackground based parent actors now also asynchronously
kills invalid child processes, so there's no need to do it as a factory operation
step (on the main thread).
Differential Revision: https://phabricator.services.mozilla.com/D189717
mChromeWriteAccessAllowed is currently either always false for content
principals or always true for the system principal. There's only one check
in Database::AllocPBackgroundIDBTransactionParent which always passes, so
mChromeWriteAccessAllowed can be safely removed.
Differential Revision: https://phabricator.services.mozilla.com/D189715
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
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
Sorry this is not a particularly easy patch to review. But it should be
mostly straight-forward.
I kept Document::Dispatch mostly for convenience, but could be
cleaned-up too / changed by SchedulerGroup::Dispatch. Similarly maybe
that can just be NS_DispatchToMainThread if we add an NS_IsMainThread
check there or something (to preserve shutdown semantics).
Differential Revision: https://phabricator.services.mozilla.com/D190450
IndexedDB currently creates a universal directory lock first and then when the
universal 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::OpenStorageDirectory.
The elimination of QuotaManager::EnsureStorageIsInitializedInternal calls in
IndexedDB is now complete.
Changes done in this patch:
- replaced QuotaManager::CreateDirectoryLockInternal call with
QuotaManager::OpenStorageDirectory
- removed QuotaManager::EnsureStorageIsInitializedInternal call from
Maintenance::DirectoryWork
- changed Maintenance to not inherit from OpenDirectoryListener
Differential Revision: https://phabricator.services.mozilla.com/D186135
IndexedDB 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.
The database maintenance can't use QuotaManager::OpenClientDirectory, a special
method will have to be added to QuotaManager for that.
Changes done in this patch:
- replaced QuotaManager::CreateDirectoryLock calls with
QuotaManager::OpenClientDirectory calls
- removed QuotaManager::EnsureStorageIsInitializedInternal call from
OpenDatabaseOp::DoDatabaseWork
- changed FactoryOp to not inherit from OpenDirectoryListener
- changed DeleteFilesRunnable to not inherit from OpenDirectoryListener
Differential Revision: https://phabricator.services.mozilla.com/D186120
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