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

Side by Side 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: Renamed param. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chrome_browser_main.h" 5 #include "chrome/browser/chrome_browser_main.h"
6 6
7 #if defined(TOOLKIT_GTK) 7 #if defined(TOOLKIT_GTK)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 // First check if any ephemeral profiles are left behind because of browser 1035 // First check if any ephemeral profiles are left behind because of browser
1036 // crash and schedule them for deletion and then proceed with getting the set 1036 // crash and schedule them for deletion and then proceed with getting the set
1037 // of profiles to open. 1037 // of profiles to open.
1038 ProfileInfoCache& profile_cache = profile_manager->GetProfileInfoCache(); 1038 ProfileInfoCache& profile_cache = profile_manager->GetProfileInfoCache();
1039 size_t profiles_count = profile_cache.GetNumberOfProfiles(); 1039 size_t profiles_count = profile_cache.GetNumberOfProfiles();
1040 std::vector<base::FilePath> profiles_to_delete; 1040 std::vector<base::FilePath> profiles_to_delete;
1041 for (size_t i = 0;i < profiles_count; ++i) { 1041 for (size_t i = 0;i < profiles_count; ++i) {
1042 if (profile_cache.ProfileIsEphemeralAtIndex(i)) 1042 if (profile_cache.ProfileIsEphemeralAtIndex(i))
1043 profiles_to_delete.push_back(profile_cache.GetPathOfProfileAtIndex(i)); 1043 profiles_to_delete.push_back(profile_cache.GetPathOfProfileAtIndex(i));
1044 } 1044 }
1045 for (size_t i = 0;i < profiles_to_delete.size(); ++i) { 1045
1046 profile_manager->ScheduleProfileForDeletion( 1046 if (profiles_to_delete.size()) {
1047 profiles_to_delete[i], ProfileManager::CreateCallback()); 1047 for (size_t i = 0;i < profiles_to_delete.size(); ++i) {
1048 profile_manager->ScheduleProfileForDeletion(
1049 profiles_to_delete[i], ProfileManager::CreateCallback());
1050 }
1051 // Clean up stale profiles immediately after browser start.
1052 BrowserThread::PostTask(
1053 BrowserThread::FILE, FROM_HERE,
1054 base::Bind(&ProfileManager::CleanUpStaleProfiles, profiles_to_delete));
1048 } 1055 }
1049 #endif // OS_ANDROID 1056 #endif // OS_ANDROID
1050 1057
1051 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) 1058 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
1052 chrome_extra_parts_[i]->PreProfileInit(); 1059 chrome_extra_parts_[i]->PreProfileInit();
1053 } 1060 }
1054 1061
1055 void ChromeBrowserMainParts::PostProfileInit() { 1062 void ChromeBrowserMainParts::PostProfileInit() {
1056 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PostProfileInit"); 1063 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PostProfileInit");
1057 LaunchDevToolsHandlerIfNeeded(parsed_command_line()); 1064 LaunchDevToolsHandlerIfNeeded(parsed_command_line());
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
1693 chromeos::CrosSettings::Shutdown(); 1700 chromeos::CrosSettings::Shutdown();
1694 #endif 1701 #endif
1695 #endif 1702 #endif
1696 } 1703 }
1697 1704
1698 // Public members: 1705 // Public members:
1699 1706
1700 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { 1707 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) {
1701 chrome_extra_parts_.push_back(parts); 1708 chrome_extra_parts_.push_back(parts);
1702 } 1709 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698