| 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();
|
| + }
|
| +}
|
|
|