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

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

Issue 11411227: Garbage collect extensions only if there are no pending extension installs that could still be usin… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/extensions/pending_extension_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index fac49f28d5d64d1bae52185f2c766a52f764ca9a..edad2907856a78f8418e08b93ff02dbdb9fd5e7e 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -180,6 +180,9 @@ static const int kMaxExtensionAcknowledgePromptCount = 3;
// Wait this many seconds after an extensions becomes idle before updating it.
static const int kUpdateIdleDelay = 5;
+// Wait this many seconds before trying to garbage collect extensions again.
+static const int kGarbageCollectRetryDelay = 30;
James Cook 2012/11/28 18:15:29 optional nit: Constants in anonymous namespace don
+
const char* kNaClPluginMimeType = "application/x-nacl";
static bool IsSyncableExtension(const Extension& extension) {
@@ -1994,6 +1997,17 @@ void ExtensionService::GarbageCollectExtensions() {
if (extension_prefs_->pref_service()->ReadOnly())
return;
+ if (pending_extension_manager()->HasPendingExtensions()) {
+ // Don't garbage collect while there are pending installations, which may
+ // be using the temporary installation directory. Try to garbage collect
+ // again later.
+ MessageLoop::current()->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&ExtensionService::GarbageCollectExtensions, AsWeakPtr()),
+ base::TimeDelta::FromSeconds(kGarbageCollectRetryDelay));
+ return;
+ }
+
scoped_ptr<extensions::ExtensionPrefs::ExtensionsInfo> info(
extension_prefs_->GetInstalledExtensionsInfo());
« no previous file with comments | « no previous file | chrome/browser/extensions/pending_extension_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698