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

Unified Diff: chrome/browser/chrome_browser_main.cc

Issue 50293011: Improve ephemeral profiles clean up code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 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/profiles/profile_impl.cc » ('j') | chrome/browser/profiles/profile_manager.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_browser_main.cc
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index 7c341da961a6d68209eac6a1441ad6aba9cca355..87425693948fb27f1334156efc65fbd235c0f76e 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -202,6 +202,8 @@ using content::BrowserThread;
namespace {
+const int64 kEphemeralProfilesCleanUpDelaySec = 10;
+
// This function provides some ways to test crash and assertion handling
// behavior of the program.
void HandleTestParameters(const CommandLine& command_line) {
@@ -1042,9 +1044,18 @@ void ChromeBrowserMainParts::PreProfileInit() {
if (profile_cache.ProfileIsEphemeralAtIndex(i))
profiles_to_delete.push_back(profile_cache.GetPathOfProfileAtIndex(i));
}
- for (size_t i = 0;i < profiles_to_delete.size(); ++i) {
- profile_manager->ScheduleProfileForDeletion(
- profiles_to_delete[i], ProfileManager::CreateCallback());
+
+ if (profiles_to_delete.size()) {
+ for (size_t i = 0;i < profiles_to_delete.size(); ++i) {
+ profile_manager->ScheduleProfileForDeletion(
+ profiles_to_delete[i], ProfileManager::CreateCallback());
+ }
+ // Clean up the profiles soon after browser start, but not immediately not
+ // to delay browser start-up.
rpetterson 2013/11/04 18:18:59 Was there noticeable slow down for startup without
pastarmovj 2013/11/05 08:58:17 To be honest I have never tried. Since I need to p
jochen (gone - plz use gerrit) 2013/11/05 13:03:25 I don't think we should do that, unless you have d
pastarmovj 2013/11/05 16:11:02 After discussing this with Jochen. I can see the p
+ BrowserThread::PostDelayedTask(
+ BrowserThread::FILE, FROM_HERE,
+ base::Bind(&ProfileManager::CleanUpStaleProfiles, profiles_to_delete),
+ base::TimeDelta::FromSeconds(kEphemeralProfilesCleanUpDelaySec));
}
#endif // OS_ANDROID
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_impl.cc » ('j') | chrome/browser/profiles/profile_manager.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698