Commit Graph

66 Commits

Author SHA1 Message Date
Jan Varga
db860e9fc8 Bug 1702600 - Change ToInteger to ToInteger64 in ClientUsageArray::Deserialize; r=dom-storage-reviewers,jstutte
We use uint64_t for usages internally, but the deserializing function was using
ToInteger which can handle only 32bit integers. The problem became more visible
after increasing the group limit from 2GB to 10GB, but it was possible to
experience the problem even before that because persisted origins are not
limited by the group limit.

Differential Revision: https://phabricator.services.mozilla.com/D148480
2022-06-07 15:01:54 +00:00
Jens Stutte
9a43ab4a20 Bug 1726714: Move IsShuttingDownOn(Non)BackgroundThread functions to Client base class. r=dom-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D140802
2022-04-14 15:05:36 +00:00
Kagami Sascha Rosylight
4e53acadb8 Bug 1723050 - Part 23: Replace typedef by using in dom/quota/ r=dom-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D121321
2021-08-16 17:05:42 +00:00
Simon Giesecke
4770f0ab47 Bug 708901 - Migrate to nsTHashSet in dom/quota. r=dom-storage-reviewers,janv
Depends on D108599

Differential Revision: https://phabricator.services.mozilla.com/D108600
2021-03-23 10:36:35 +00:00
Jan Varga
102110c895 Bug 1686031 - Rename GroupAndOrigin to OriginMetadata; r=dom-storage-reviewers,sg
Differential Revision: https://phabricator.services.mozilla.com/D104970
2021-02-12 14:03:28 +00:00
Jan Varga
532a52efb4 Bug 1690025 - Move DirectoryLock class to a separate file; r=dom-storage-reviewers,sg
Differential Revision: https://phabricator.services.mozilla.com/D104154
2021-02-09 10:42:22 +00:00
Simon Giesecke
c719baddfe Bug 1681670 - Move shutdown timeout handling to QuotaManager. r=dom-workers-and-storage-reviewers,janv
Instead of having a separate timer for each quota client, we can use a single
timer in the QuotaManager for handling timeouts of all quota clients. The
original shutdown timeout of the quota manager itself can now be removed,
as AbortOperations is already called through InitiateShutdownWorkThreads on
each quota client.

This also moves MaybeRecordShutdownStep to the QuotaManager, which allows
easier access through the singleton instance returned by QuotaManager::GetRef.

Differential Revision: https://phabricator.services.mozilla.com/D98073
2020-12-15 17:15:27 +00:00
Simon Giesecke
fca4853b55 Bug 1679542 - Get rid of *QUOTA_NAMESPACE* macros and stop including QuotaCommon.h everywhere. r=dom-workers-and-storage-reviewers,ttung
Differential Revision: https://phabricator.services.mozilla.com/D98077
2020-12-15 10:26:08 +00:00
Mihai Alexandru Michis
e5a138305c Backed out changeset 547a95c0bb90 (bug 1666214) for causing talos failures.
CLOSED TREE
2020-12-09 22:08:57 +02:00
Simon Giesecke
6337fc87d5 Bug 1666214 - Move shutdown timeout handling to QuotaManager. r=dom-workers-and-storage-reviewers,janv
Instead of having a separate timer for each quota client, we can use a single
timer in the QuotaManager for handling timeouts of all quota clients. The
original shutdown timeout of the quota manager itself can now be removed,
as AbortOperations is already called through InitiateShutdownWorkThreads on
each quota client.

This also moves MaybeRecordShutdownStep to the QuotaManager, which allows
easier access through the singleton instance returned by QuotaManager::GetRef.

Differential Revision: https://phabricator.services.mozilla.com/D98073
2020-12-09 13:03:36 +00:00
Jan Varga
190d6c669b Bug 1680031 - Abort operations for given directory lock ids; r=dom-workers-and-storage-reviewers,sg
This patch changes the way how we abort operations when clearing of data is
requested. Instead of aborting all operations for given origin, we now abort
all operations for given directory locks which are blocking clearing of data.

Differential Revision: https://phabricator.services.mozilla.com/D98609
2020-12-09 08:13:44 +00:00
Simon Giesecke
855f5bda1b Bug 1666214 - Perform shutdown of all quota clients in parallel. r=dom-workers-and-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D96082
2020-12-07 14:49:36 +00:00
Jan Varga
d0583cd4f3 Bug 1680031 - Introduce Client::AbortAllOperations; r=dom-workers-and-storage-reviewers,sg
Client::AbortOperations no longer supports the case when an empty origin string
is passed (which was used to abort all operations).

Differential Revision: https://phabricator.services.mozilla.com/D98344
2020-12-02 16:38:07 +00:00
Simon Giesecke
4d22ecc1f9 Bug 1672369 - Add ability to record intermediate shutdown steps for timeout analysis. r=dom-workers-and-storage-reviewers,ttung,janv
Differential Revision: https://phabricator.services.mozilla.com/D94333
2020-11-30 10:54:29 +00:00
Simon Giesecke
4b58b9d2f9 Bug 1672369 - Change infallible TypeToText to use a return value and remove unused variant. r=dom-workers-and-storage-reviewers,ttung,janv
Differential Revision: https://phabricator.services.mozilla.com/D94319
2020-11-30 10:47:02 +00:00
Simon Giesecke
a6f86031f9 Bug 1672369 - Unify handling shutdown timeout of quota clients. r=dom-workers-and-storage-reviewers,ttung,janv
Differential Revision: https://phabricator.services.mozilla.com/D94318
2020-11-30 10:40:59 +00:00
Simon Giesecke
601d8c1d2b Bug 1672369 - Pull up common ShutdownWorkThreads into QuotaClient. r=dom-workers-and-storage-reviewers,ttung,janv
Differential Revision: https://phabricator.services.mozilla.com/D94298
2020-11-26 09:20:03 +00:00
Simon Giesecke
3dce7c9be3 Bug 1626555 - Make dom/quota buildable outside of unified-build environment. r=andi
Differential Revision: https://phabricator.services.mozilla.com/D94011
2020-10-21 13:16:19 +00:00
Simon Giesecke
859dc0bc1c Bug 1663924 - Replace output parameters by return values on GetInfo* methods. r=dom-workers-and-storage-reviewers,ttung
This also changes all methods that use a pair of group/origin or a tuple of
suffix/group/origin input/output parameters to use a single GroupAndOrigin
resp. QuotaInfo struct input parameter or return value. Also, several types
having a pair or 3-tuple of such data members are changed to use these structs
instead.

Differential Revision: https://phabricator.services.mozilla.com/D91131
2020-10-20 11:46:31 +00:00
Simon Giesecke
bafef4e050 Bug 1641512 - Use Result<UsageInfo, nsresult> as return type of InitOrigin and add separate InitOriginWithoutTracking. r=dom-workers-and-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D77453
2020-06-25 09:31:39 +00:00
Simon Giesecke
9c9a28146f Bug 1641512 - Use Result<UsageInfo, nsresult> as return type of GetUsageForOrigin. r=dom-workers-and-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D77452
2020-06-25 08:34:43 +00:00
Jan Varga
e4107dbb1c Bug 1621916 - Remove unused argument in Client::InitOrigin; r=dom-workers-and-storage-reviewers,sg
Depends on D77070

Differential Revision: https://phabricator.services.mozilla.com/D77072
2020-05-27 15:52:49 +00:00
Jan Varga
76f74647c8 Bug 1619592 - Refactor client type checks using new Client::IsValidType method; r=dom-workers-and-storage-reviewers,sg
This patch moves client type checks to the parameter validation phase. The checks are now done using new Client::IsValidType method.

Differential Revision: https://phabricator.services.mozilla.com/D66948
2020-03-17 13:06:30 +00:00
Simon Giesecke
6e3ce01883 Bug 1613985 - Use default for equivalent-to-default constructors/destructors in dom/quota. r=dom-workers-and-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D62557
2020-02-12 10:25:22 +00:00
Jan Varga
5c3586a6dd Bug 1563023 - Part 7: Implement caching functionality; r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D38817
2019-08-25 01:34:37 +00:00
Jan Varga
29ab2cdd61 Bug 1563023 - Part 6: Simplify iterations over all client types; r=asuth
This patch converts index based client type loops to iterator based client type
loops. This way the static cast is avoided and the loops are simpler and more
readable.

Differential Revision: https://phabricator.services.mozilla.com/D38629
2019-08-23 04:48:36 +00:00
Jan Varga
93fda2111a Bug 1563023 - Part 5: Rationalize Client::TypeToText and Client::TypeFromText methods; r=asuth
This patch makes it easier to create new Client::TypeTo and Client::TypeFrom
variations by creating generic reusable helpers.

Differential Revision: https://phabricator.services.mozilla.com/D38628
2019-08-23 04:49:14 +00:00
Jan Varga
647ad0fd48 Bug 1563023 - Part 4: Get rid of custom usage tracking in LS by using client usage tracked by QM; r=asuth
This patch gets rid of gUsages in LSNG. This provides better consistency and
makes it easier to cache quota info on disk.
The patch also fixes some edge cases when usage was not adjusted correctly after
a failed file or database operation.

Differential Revision: https://phabricator.services.mozilla.com/D38229
2019-08-23 04:46:14 +00:00
Jan Varga
7537b5a8e4 Bug 1563023 - Part 1: Implement per client usage tracking; r=asuth
This patch adds a fixed-size array of client usages to OriginInfo and modifies
quota tracking APIs to require the client type to be passed in.
A new method ResetUsageForClient is implemented. The method is used during
client-specific origin clearing. ResetUsageForClient is much faster than calling
GetUsageForOrigin and calling DecreaseUsageForOrigin after that.
LockedUsage now has an assertion that verifies that the total sum of client
usages matches total origin usage. This method should be called instead of
touching mUsage directly.
A new assertion is added to GetQuotaObject which verifies that passed file
belongs to the given persistence type, origin, and client.

Differential Revision: https://phabricator.services.mozilla.com/D38028
2019-08-22 13:06:48 +00:00
Tom Tung
015f3efad8 Bug 1514600 - P1 - Notify LS to cleanup the gUsages while storage initialization fails; r=janv
Differential Revision: https://phabricator.services.mozilla.com/D27502
2019-04-29 10:49:58 +00:00
Sylvestre Ledru
893cfb7019 Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D28329
2019-04-22 16:35:03 +00:00
Jan Varga
69d511b1cc Bug 1541771 - LSNG: Don't cache usage in InitOrigin if it's not for temporary storage initialization; r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D27490
2019-04-15 13:35:38 +02:00
Luke Wagner
5cdae4425c Bug 1520931 - Remove dom/asmjscache (r=ttung)
Differential Revision: https://phabricator.services.mozilla.com/D24985
2019-03-26 16:57:55 -05:00
Tom Tung
4a9e59612b Bug 1423917 - P12 - Return an error if it failed to remove the asmjs directory and move the deprecated client check to InitializeOrigin; r=asuth
The reasons of this patch:
- P9 didn't handle the deletion of deprecated client well. It shouldn't continue
  if the client is failed to be removed. This patch correct this behavior.

- Meanwhile, it's not really good to just crash while finding a deprecated
  client. At least, the client should be removed while finding it before
  crashing the Firefox.

- Besides, if we eventaully only check the deprecated client during the
  initialization. It makes the code simpler to make the deprecated check to
  InitializeOrigin.

Therefore, this patch is a little bit against the P11, but I think it's a right
thing to do here.

Differential Revision: https://phabricator.services.mozilla.com/D24678
2019-03-25 15:15:03 +00:00
Tom Tung
a55a7e655b Bug 1423917 - P11 - Make the deprecated client check only enable after upgrading to the newest version; r=asuth
The previous patches didn't take care of the case there might have an asmjs
folder in the older version. To fix that, this patch makes Client allow to have
asmjs folders in the older version by requesting the callee of TypeFromText()
for passing the current storage version. If the version is lower than the
deprecate version, then the assertion won't be enabled.
The test verfies the fix by adding the older profile an asmjs folder.

Differential Revision: https://phabricator.services.mozilla.com/D24542
2019-03-23 07:56:02 +00:00
Tom Tung
d4d4d03561 Bug 1423917 - P9 - Remove asmjs client in the 2_1to2_2 upgrade for QuotaManager; r=luke
Differential Revision: https://phabricator.services.mozilla.com/D21732
2019-03-13 15:59:34 +00:00
Jan Varga
e0bb3bdf6f Bug 1526891 - Part 11: Initiate asynchronous deletion of unreferenced files in IDB databases directly on the PBackground thread instead of going through the main thread; r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D20920
2019-02-23 17:25:48 +01:00
Sylvestre Ledru
e5a134f73a Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset
2018-11-30 11:46:48 +01:00
Jan Varga
b5e4132671 Bug 1286798 - Part 47: Add AboutToClearOrigins() method to the quota client interface; r=asuth 2018-11-29 21:49:46 +01:00
Jan Varga
dde095681d Bug 1286798 - Part 14: Enhance clearStoragesForPrincipal() to support clearing of storages for specific quota client; r=asuth
See also bug 1402254, original patch by baku.
2018-11-29 21:47:58 +01:00
Jan Varga
b62c1fd481 Bug 1286798 - Part 4: Basic integration with QuotaManager; r=asuth
This adds a new quota client implementation, but only implements ShutdownWorkThreads.
At shutdown we wait for all running operations to finish including database actors which are closed by using an extra IPC message which avoids races between the parent and child.
Databases are dropped on the child side as soon as they are not used (e.g. after unlinking by the cycle collector).
2018-11-29 21:47:24 +01:00
Jan Varga
4abefb63c2 Bug 1361330 - Part 4: Core implementation; r=asuth 2018-08-20 14:33:03 +02:00
Jan Varga
44fc7013c4 Bug 1470811 - Update FF 62 to know about upcoming new quota client; r=asuth 2018-06-29 09:58:09 +02:00
Chris Peterson
f7ceeaf5cf Bug 1469769 - Part 6: Replace non-failing NS_NOTREACHED with MOZ_ASSERT_UNREACHABLE. r=froydnj
This patch is an automatic replacement of s/NS_NOTREACHED/MOZ_ASSERT_UNREACHABLE/. Reindenting long lines and whitespace fixups follow in patch 6b.

MozReview-Commit-ID: 5UQVHElSpCr
2018-06-17 22:43:11 -07:00
Andrew Sutherland
dd0f1f64ec Bug 1404344 - Part 1: Alias QuotaManager schema 3.0 to 2.1. r=janv
To improve the Firefox 57 to 56 downgrade scenario, have 57 and 58
re-number the version 3.0 schema introduced by bug 1290481 to
version 2.1.  Firefox 56's Quota Manager will recognize the minor
schema version and accept the schema from the future.
2017-10-03 10:02:27 -04:00
Tom Tung
c6849638fc Bug 1290481 - P6: Upgrade QuotaManager to v3.0 for adding directory padding file to existing DOM Cache directory. r=bkelly, janv
MozReview-Commit-ID: KlVsaGhpABk
2017-07-18 18:54:20 +08:00
Jan Varga
11a69e579f Bug 1348660 - Part 3: Separate the canceled state out of UsageInfo; r=btseng 2017-03-22 12:13:54 +01:00
Jan Varga
145f008886 Bug 1339081 - Part 21: Rename file manager directories as part of new upgrade helper; r=asuth 2017-03-06 18:40:31 +01:00
Kartikaya Gupta
a2a492cb06 Bug 1312319 - Add a NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING macro and replace existing pure-virtual AddRef/Release declarations. r=froydnj
MozReview-Commit-ID: 5yt3O4Hoois
2017-01-25 14:51:34 -05:00
Jan Varga
c0c8eca8b9 Bug 1261491 - Intermittent test_quotaExceeded_recovery.js | application crashed [@ mozilla::dom::IndexedDatabaseManager::Notify]; r=khuey 2016-07-18 18:51:54 +02:00