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

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

Issue 2021253002: Skip profiles in GetLastOpenedProfiles that fail to initialize (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed test code Created 4 years, 6 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
« no previous file with comments | « chrome/browser/profiles/profile_manager.h ('k') | chrome/browser/ui/startup/startup_browser_creator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_manager.cc
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
index 60eeafb6d7a743f2a621e20906fb0ebbf00e0d40..68f1a1c4e83ff7a87fd324f7ffb238405f255b15 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -614,14 +614,18 @@ std::vector<Profile*> ProfileManager::GetLastOpenedProfiles(
std::unique_ptr<base::ListValue> profile_list(
local_state->GetList(prefs::kProfilesLastActive)->DeepCopy());
base::ListValue::const_iterator it;
- std::string profile;
for (it = profile_list->begin(); it != profile_list->end(); ++it) {
- if (!(*it)->GetAsString(&profile) || profile.empty() ||
- profile == base::FilePath(chrome::kSystemProfileDir).AsUTF8Unsafe()) {
+ std::string profile_path;
+ if (!(*it)->GetAsString(&profile_path) ||
+ profile_path.empty() ||
+ profile_path ==
+ base::FilePath(chrome::kSystemProfileDir).AsUTF8Unsafe()) {
LOG(WARNING) << "Invalid entry in " << prefs::kProfilesLastActive;
continue;
}
- to_return.push_back(GetProfile(user_data_dir.AppendASCII(profile)));
+ Profile* profile = GetProfile(user_data_dir.AppendASCII(profile_path));
+ if (profile)
+ to_return.push_back(profile);
}
}
return to_return;
@@ -1334,7 +1338,6 @@ Profile* ProfileManager::CreateAndInitializeProfile(
// which would make Bad Things happen if we returned it.
CHECK(!GetProfileByPathInternal(profile_dir));
Profile* profile = CreateProfileHelper(profile_dir);
- DCHECK(profile);
if (profile) {
bool result = AddProfile(profile);
DCHECK(result);
« no previous file with comments | « chrome/browser/profiles/profile_manager.h ('k') | chrome/browser/ui/startup/startup_browser_creator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698