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

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

Issue 11419307: Garbage Collect the Storage directory on next profile start after an extension uninstall. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: done done Created 8 years 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 ef7107139658a0e8e952fa39b37ade15b81b3756..56bd1ac91676e2eb24cf74d73364a7b19ece156f 100644
--- a/chrome/browser/extensions/extension_service.h
+++ b/chrome/browser/extensions/extension_service.h
@@ -325,6 +325,10 @@ class ExtensionService
const extensions::Extension* GetExtensionById(const std::string& id,
int include_mask) const;
+ // Returns the site of the given |extension_id|. Suitable for use with
+ // BrowserContext::GetStoragePartitionForSite().
+ GURL GetSiteForExtensionId(const std::string& extension_id);
+
// Looks up a terminated (crashed) extension by ID.
const extensions::Extension*
GetTerminatedExtension(const std::string& id) const;
@@ -780,10 +784,9 @@ class ExtensionService
// the extension is installed, e.g., to update event handlers on background
// pages; and perform other extension install tasks before calling
// AddExtension.
- void AddNewOrUpdatedExtension(
- const extensions::Extension* extension,
- const syncer::StringOrdinal& page_ordinal,
- extensions::Extension::State initial_state);
+ void AddNewOrUpdatedExtension(const extensions::Extension* extension,
+ extensions::Extension::State initial_state,
+ const syncer::StringOrdinal& page_ordinal);
// Handles sending notification that |extension| was loaded.
void NotifyExtensionLoaded(const extensions::Extension* extension);
@@ -847,6 +850,12 @@ 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();
+ void OnNeedsToGarbageCollectIsolatedStorage();
+
// extensions::Blacklist::Observer implementation.
virtual void OnBlacklistUpdated() OVERRIDE;
@@ -855,6 +864,10 @@ class ExtensionService
void ManageBlacklist(const std::set<std::string>& old_blacklisted_ids,
const std::set<std::string>& new_blacklisted_ids);
+ // Controls if installs are delayed. See comment for |installs_delayed_|.
+ void set_installs_delayed(bool value) { installs_delayed_ = value; }
+ bool installs_delayed() const { return installs_delayed_; }
+
// The normal profile associated with this ExtensionService.
Profile* profile_;
@@ -885,8 +898,14 @@ class ExtensionService
// they can easily be un-blacklisted.
ExtensionSet blacklisted_extensions_;
- // The list of extension updates that are waiting to be installed.
- ExtensionSet pending_extension_updates_;
+ // The list of extension updates that have had their installs delayed because
+ // they are waiting for idle.
+ ExtensionSet delayed_updates_for_idle_;
+
+ // The list of extension installs delayed by |installs_delayed_|.
+ // This is a disjoint set from |delayed_updates_for_idle_|. Extensions in
+ // the |delayed_installs_| do not need to wait for idle.
+ ExtensionSet delayed_installs_;
// Hold the set of pending extensions.
extensions::PendingExtensionManager pending_extension_manager_;
@@ -1000,6 +1019,12 @@ class ExtensionService
// decide to abort.
bool browser_terminating_;
+ // Set to true to delay all new extension installations. Acts as a lock
+ // to allow background processing of tasks such as garbage collection of
+ // on-disk state without needing to worry about race conditions caused
+ // by extension installation and reinstallation.
+ bool installs_delayed_;
+
// Whether any extension should be considered for wipeout.
bool wipeout_is_active_;
« no previous file with comments | « chrome/browser/extensions/extension_prefs_unittest.cc ('k') | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698