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

Unified Diff: chrome/browser/profiles/profile_manager.cc

Issue 7210006: AppCaches which belong to hosted apps are not protected from deletion (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Clearing appcaches & waiting in Shutdown(). Created 9 years, 5 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/profiles/profile_manager.cc
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
index ab966c96752f7955680d58fbb5ea769565a1b999..015fcaaa7cffd802c15d45fd70ed1d2e612d5b58 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -12,6 +12,7 @@
#include "base/path_service.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
+#include "base/synchronization/waitable_event.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/prefs/pref_service.h"
@@ -575,3 +576,19 @@ bool ProfileManager::IsMultipleProfilesEnabled() {
return CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles);
#endif
}
+
+void ProfileManager::ClearAppCaches() {
+ // The WaitableEvent returned by Profile::ClearAppCache() is alive as long as
+ // the Profile is alive. In the future, the Profiles will be deleted earlier
+ // than currently (see
+ // http://code.google.com/p/chromium/issues/detail?id=88586 ). In that case,
+ // Profile::ClearAppCache() must be called when the deletion of the Profile is
+ // initiated, and the Profile can only be deleted after it has finished. A
+ // WaitableEventWatcher can be used for detecting when it has finished.
+ std::map<FilePath, linked_ptr<ProfileInfo> >::iterator it;
+ for (it = profiles_info_.begin(); it != profiles_info_.end(); ++it) {
+ base::WaitableEvent* event = it->second->profile->ClearAppCache();
+ if (event)
+ event->Wait();
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698