diff options
author | marja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-28 16:35:26 +0000 |
---|---|---|
committer | marja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-28 16:35:26 +0000 |
commit | fd868af50ccaded5e7e216bcb095ba46a4c4270a (patch) | |
tree | 728ca612f9c5eb0e677f83327c537e8b6a6ba4c2 /chrome/browser/profiles/profile_manager.cc | |
parent | c94c954a13437739a27f89e1cc1dbf6afd3934e7 (diff) | |
download | chromium_src-fd868af50ccaded5e7e216bcb095ba46a4c4270a.zip chromium_src-fd868af50ccaded5e7e216bcb095ba46a4c4270a.tar.gz chromium_src-fd868af50ccaded5e7e216bcb095ba46a4c4270a.tar.bz2 |
ProfileManager: Remove CHECKs.
The cause for the "last profile appears multiple times in the last active profile list"
seems to be that several profiles have the same string representation (GetPath().BaseName()).
crbug.com/120112 addresses that problem and this CL works around it.
BUG=114766
TEST=NONE
Review URL: http://codereview.chromium.org/9853010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129426 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/profiles/profile_manager.cc')
-rw-r--r-- | chrome/browser/profiles/profile_manager.cc | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc index 115b9db..b46e1dc 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)); + } } } } |