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

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

Issue 9853010: ProfileManager: Remove CHECKs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review. Created 8 years, 9 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') | no next file » | 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 115b9db735b28ac1c6fd670e013c42a668f0918c..b46e1dc2336259fa0c8b17dfc32beab7e480592c 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -527,8 +527,6 @@ void ProfileManager::Observe(
Profile* profile = browser->profile();
DCHECK(profile);
if (!profile->IsOffTheRecord() && ++browser_counts_[profile] == 1) {
- CHECK(std::find(active_profiles_.begin(), active_profiles_.end(),
- profile) == active_profiles_.end());
active_profiles_.push_back(profile);
update_active_profiles = true;
}
@@ -540,14 +538,8 @@ void ProfileManager::Observe(
Profile* profile = browser->profile();
DCHECK(profile);
if (!profile->IsOffTheRecord() && --browser_counts_[profile] == 0) {
- CHECK(std::find(active_profiles_.begin(), active_profiles_.end(),
- profile) != active_profiles_.end());
- active_profiles_.erase(
- std::remove(active_profiles_.begin(), active_profiles_.end(),
- profile),
- active_profiles_.end());
- CHECK(std::find(active_profiles_.begin(), active_profiles_.end(),
- profile) == active_profiles_.end());
+ active_profiles_.erase(std::find(active_profiles_.begin(),
+ active_profiles_.end(), profile));
update_active_profiles = true;
}
break;
@@ -565,27 +557,18 @@ void ProfileManager::Observe(
profile_list->Clear();
- // Check that the same profile doesn't occur twice in last_opened_profiles.
- {
- std::set<Profile*> active_profiles_set;
- for (std::vector<Profile*>::const_iterator it = active_profiles_.begin();
- it != active_profiles_.end(); ++it) {
- CHECK(active_profiles_set.find(*it) ==
- active_profiles_set.end());
- active_profiles_set.insert(*it);
- }
- }
- // Used for checking that the string representations of the profiles differ.
+ // crbug.com/120112 -> several non-incognito profiles might have the same
+ // GetPath().BaseName(). In that case, we cannot restore both
+ // profiles. Include each base name only once in the last active profile
+ // list.
std::set<std::string> profile_paths;
-
std::vector<Profile*>::const_iterator it;
for (it = active_profiles_.begin(); it != active_profiles_.end(); ++it) {
std::string profile_path = (*it)->GetPath().BaseName().MaybeAsASCII();
- CHECK(profile_paths.find(profile_path) ==
- profile_paths.end());
- profile_paths.insert(profile_path);
- profile_list->Append(
- new StringValue((*it)->GetPath().BaseName().MaybeAsASCII()));
+ if (profile_paths.find(profile_path) == profile_paths.end()) {
+ profile_paths.insert(profile_path);
+ profile_list->Append(new StringValue(profile_path));
+ }
}
}
}
« no previous file with comments | « chrome/browser/profiles/profile_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698