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

Unified Diff: chrome/browser/extensions/extension_service.h

Issue 204983020: Remove ExtensionService Garbage-Collecting methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_service.h
diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h
index 3476830ec804eccd7f55f23333e2363f73b211c5..d9ebf11f1d8a8e3d59ea01bdad99e500b04cd5a8 100644
--- a/chrome/browser/extensions/extension_service.h
+++ b/chrome/browser/extensions/extension_service.h
@@ -52,6 +52,7 @@ class BrowserEventRouter;
class ComponentLoader;
class CrxInstaller;
class ExtensionActionStorageManager;
+class ExtensionGarbageCollector;
class ExtensionRegistry;
class ExtensionSystem;
class ExtensionUpdater;
@@ -294,9 +295,6 @@ class ExtensionService
// Reloads all extensions. Does not notify that extensions are ready.
void ReloadExtensionsForTest();
- // Scan the extension directory and clean up the cruft.
- void GarbageCollectExtensions();
-
// Returns true if |url| should get extension api bindings and be permitted
// to make api calls. Note that this is independent of what extension
// permissions the given extension has been granted.
@@ -509,6 +507,14 @@ class ExtensionService
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
+ // Postpone installations so that we don't have to worry about race
+ // conditions.
+ void OnGarbageCollectIsolatedStorageStart();
+
+ // Restart any extension installs which were delayed for isolated storage
+ // garbage collection.
+ void OnGarbageCollectIsolatedStorageFinished();
+
// Record a histogram using the PermissionMessage enum values for each
// permission in |e|.
// NOTE: If this is ever called with high frequency, the implementation may
@@ -528,6 +534,10 @@ class ExtensionService
base::WeakPtr<ExtensionService> AsWeakPtr() { return base::AsWeakPtr(this); }
+ extensions::ExtensionGarbageCollector* garbage_collector() {
+ return garbage_collector_.get();
+ }
+
bool browser_terminating() const { return browser_terminating_; }
// For testing.
@@ -553,15 +563,6 @@ class ExtensionService
void AddUpdateObserver(extensions::UpdateObserver* observer);
void RemoveUpdateObserver(extensions::UpdateObserver* observer);
-#if defined(OS_CHROMEOS)
- void disable_garbage_collection() {
- disable_garbage_collection_ = true;
- }
- void enable_garbage_collection() {
- disable_garbage_collection_ = false;
- }
-#endif
-
private:
// Populates greylist_.
void LoadGreylistFromPrefs();
@@ -623,11 +624,6 @@ class ExtensionService
bool ShouldDelayExtensionUpdate(const std::string& extension_id,
bool wait_for_idle) const;
- // Helper to search storage directories for extensions with isolated storage
- // that have been orphaned by an uninstall.
- void GarbageCollectIsolatedStorage();
- void OnGarbageCollectIsolatedStorageFinished();
-
// extensions::Blacklist::Observer implementation.
virtual void OnBlacklistUpdated() OVERRIDE;
@@ -646,13 +642,6 @@ class ExtensionService
const ExtensionIdSet& unchanged,
const extensions::Blacklist::BlacklistStateMap& state_map);
- // Controls if installs are delayed. See comment for
- // |installs_delayed_for_gc_|.
- void set_installs_delayed_for_gc(bool value) {
- installs_delayed_for_gc_ = value;
- }
- bool installs_delayed_for_gc() const { return installs_delayed_for_gc_; }
-
// Used only by test code.
void UnloadAllExtensionsInternal();
@@ -782,15 +771,11 @@ class ExtensionService
scoped_ptr<extensions::ManagementPolicy::Provider>
shared_module_policy_provider_;
- ObserverList<extensions::UpdateObserver, true> update_observers_;
+ // The ExtensionGarbageCollector to clean up all the garbage that leaks into
+ // the extensions directory.
+ scoped_ptr<extensions::ExtensionGarbageCollector> garbage_collector_;
-#if defined(OS_CHROMEOS)
- // TODO(rkc): HACK alert - this is only in place to allow the
- // kiosk_mode_screensaver to prevent its extension from getting garbage
- // collected. Remove this once KioskModeScreensaver is removed.
- // See crbug.com/280363
- bool disable_garbage_collection_;
-#endif
+ ObserverList<extensions::UpdateObserver, true> update_observers_;
FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
InstallAppsWithUnlimtedStorage);

Powered by Google App Engine
This is Rietveld 408576698