Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Issue 2923663002: ExtensionStorageMonitor: use smaller, self-registering StorageObservers (Closed)

Created:
3 years, 6 months ago by ncarter (slow)
Modified:
3 years, 6 months ago
Reviewers:
Devlin, tzik
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, extensions-reviews_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

ExtensionStorageMonitor: use smaller, self-registering StorageObservers Before this change, StorageEventObserver was a single observer that tried to install a single observation per origin. However, this was problematic: - Two hosted apps can have the same storage origin. ExtensionsLoadMultipleTest.Test, for example, sets up a case where this occurs. The second registration would overwrite the state for the first, and it's possible that a dangling pointer would result (if the first registration had should_uma = true, and the second registration had should_uma = false). Also, disabling the second extension would leave the first extension unobserved. - The deregistration code, RemoveStorageObserverForFilter, didn't correctly uninstall the kStorageTypeTemporary filter, causing bug 716426. To fix this StorageEventObserver is broken up into two classes: - SingleExtensionStorageObserver, which monitors the storage usage of one extension. This class registers/deregisters itself as an observer on creation/destruction (RAII pattern). - ExtensionStorageMonitorIOHelper, which keeps a container of SingleExtensionStorageObservers, one per extension. Using RAII allows us to rip out the RemoveStorageObserverForFilter codepath entirely from StorageMonitor and QuotaManager. BUG=716426 TEST=ExtensionStorageMonitorTest Review-Url: https://codereview.chromium.org/2923663002 Cr-Commit-Position: refs/heads/master@{#479546} Committed: https://chromium.googlesource.com/chromium/src/+/e3873dfc2212de0b9b0784315b30b38ce0f46fbc

Patch Set 1 #

Patch Set 2 : Rename. #

Patch Set 3 : Tweak for diff alignment. #

Patch Set 4 : Tweak for patch alignment. #

Patch Set 5 : Fix unittests. #

Patch Set 6 : std::move #

Patch Set 7 : override #

Patch Set 8 : Add two browsertests that fail prior to this change. #

Patch Set 9 : Remove over-aggressive CHECK() on erase. #

Patch Set 10 : Fiddling. #

Total comments: 21

Patch Set 11 : constexpr #

Patch Set 12 : Accidentally a word #

Patch Set 13 : Use 'a'.repeat #

Total comments: 2

Patch Set 14 : Remove lame comment. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+387 lines, -199 lines) Patch
M chrome/browser/extensions/extension_storage_monitor.h View 1 2 3 chunks +5 lines, -4 lines 0 comments Download
M chrome/browser/extensions/extension_storage_monitor.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 9 chunks +143 lines, -137 lines 0 comments Download
M chrome/browser/extensions/extension_storage_monitor_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 7 chunks +161 lines, -16 lines 0 comments Download
A chrome/test/data/extensions/storage_monitor/hosted_apps/common.js View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +51 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/storage_monitor/hosted_apps/one/index.html View 1 2 3 4 5 6 7 1 chunk +11 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/storage_monitor/hosted_apps/two/index.html View 1 2 3 4 5 6 7 1 chunk +11 lines, -0 lines 0 comments Download
M storage/browser/quota/quota_manager.h View 1 chunk +0 lines, -2 lines 0 comments Download
M storage/browser/quota/quota_manager.cc View 1 chunk +0 lines, -6 lines 0 comments Download
M storage/browser/quota/storage_monitor.h View 1 chunk +0 lines, -2 lines 0 comments Download
M storage/browser/quota/storage_monitor.cc View 2 chunks +0 lines, -21 lines 0 comments Download
M storage/browser/quota/storage_monitor_unittest.cc View 1 2 3 4 2 chunks +5 lines, -11 lines 0 comments Download

Messages

Total messages: 53 (45 generated)
ncarter (slow)
devlin: For extension_storage_monitor.cc and tests tzik: For code deletion under storage/ https://codereview.chromium.org/2923663002/diff/180001/chrome/browser/extensions/extension_storage_monitor.cc File chrome/browser/extensions/extension_storage_monitor.cc (left): ...
3 years, 6 months ago (2017-06-12 18:31:29 UTC) #31
Devlin
https://codereview.chromium.org/2923663002/diff/180001/chrome/browser/extensions/extension_storage_monitor.cc File chrome/browser/extensions/extension_storage_monitor.cc (right): https://codereview.chromium.org/2923663002/diff/180001/chrome/browser/extensions/extension_storage_monitor.cc#newcode48 chrome/browser/extensions/extension_storage_monitor.cc:48: const base::TimeDelta kStorageEventRate = base::TimeDelta::FromSeconds(30); is this allowed by ...
3 years, 6 months ago (2017-06-12 20:15:05 UTC) #35
ncarter (slow)
PTAL https://codereview.chromium.org/2923663002/diff/180001/chrome/browser/extensions/extension_storage_monitor.cc File chrome/browser/extensions/extension_storage_monitor.cc (right): https://codereview.chromium.org/2923663002/diff/180001/chrome/browser/extensions/extension_storage_monitor.cc#newcode48 chrome/browser/extensions/extension_storage_monitor.cc:48: const base::TimeDelta kStorageEventRate = base::TimeDelta::FromSeconds(30); On 2017/06/12 20:15:05, ...
3 years, 6 months ago (2017-06-12 22:52:08 UTC) #41
Devlin
extensions lgtm
3 years, 6 months ago (2017-06-13 15:22:47 UTC) #45
tzik
storage lgtm https://codereview.chromium.org/2923663002/diff/240001/chrome/browser/extensions/extension_storage_monitor.cc File chrome/browser/extensions/extension_storage_monitor.cc (right): https://codereview.chromium.org/2923663002/diff/240001/chrome/browser/extensions/extension_storage_monitor.cc#newcode239 chrome/browser/extensions/extension_storage_monitor.cc:239: // Keys are extension IDs. Could you ...
3 years, 6 months ago (2017-06-14 08:46:36 UTC) #46
ncarter (slow)
https://codereview.chromium.org/2923663002/diff/240001/chrome/browser/extensions/extension_storage_monitor.cc File chrome/browser/extensions/extension_storage_monitor.cc (right): https://codereview.chromium.org/2923663002/diff/240001/chrome/browser/extensions/extension_storage_monitor.cc#newcode239 chrome/browser/extensions/extension_storage_monitor.cc:239: // Keys are extension IDs. On 2017/06/14 08:46:36, tzik ...
3 years, 6 months ago (2017-06-14 21:40:35 UTC) #47
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2923663002/260001
3 years, 6 months ago (2017-06-14 21:41:04 UTC) #50
commit-bot: I haz the power
3 years, 6 months ago (2017-06-14 23:44:05 UTC) #53
Message was sent while issue was closed.
Committed patchset #14 (id:260001) as
https://chromium.googlesource.com/chromium/src/+/e3873dfc2212de0b9b0784315b30...

Powered by Google App Engine
This is Rietveld 408576698