summaryrefslogtreecommitdiffstats
path: root/chrome/browser/profiles/profile_manager.cc
diff options
context:
space:
mode:
authormarja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-22 09:36:54 +0000
committermarja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-22 09:36:54 +0000
commit2563f411947a290c3e18b482ed86f1369158c3e4 (patch)
tree3c5d15330a08c49b3b83a65c8de33b69e90c383e /chrome/browser/profiles/profile_manager.cc
parent09486230cd95bdf348001d5aac0cf84f2ce970a2 (diff)
downloadchromium_src-2563f411947a290c3e18b482ed86f1369158c3e4.zip
chromium_src-2563f411947a290c3e18b482ed86f1369158c3e4.tar.gz
chromium_src-2563f411947a290c3e18b482ed86f1369158c3e4.tar.bz2
More useful CHECKs for the "active profiles contains the same profile many times" problem.
The previous ones prevented chrome from starting up. These will CHECK when the problem occurs. BUG=114766 TEST=NONE Review URL: http://codereview.chromium.org/9418044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123013 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/profiles/profile_manager.cc')
-rw-r--r--chrome/browser/profiles/profile_manager.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
index 8e2d7b9..5da3be7 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -500,6 +500,8 @@ 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;
}
@@ -511,10 +513,14 @@ 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());
update_active_profiles = true;
}
break;
@@ -531,8 +537,26 @@ void ProfileManager::Observe(
ListValue* profile_list = update.Get();
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.
+ 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()));
}