Chromium Code Reviews| 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..511049773b1d33f64f21655c190d6f117f7279e5 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) { |
|
sail
2012/03/26 16:15:48
It seems like one source of problems is that brows
marja
2012/03/27 08:18:00
That should not be a problem if the strings are un
|
| - 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,10 @@ 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(), |
|
Bernhard Bauer
2012/03/27 08:35:51
Why are you calling std::remove() *and* erase()? O
marja
2012/03/27 08:57:20
std::remove() arranges the elements so that the re
Bernhard Bauer
2012/03/27 09:13:52
Couldn't you achieve the same thing with `active_p
marja
2012/03/27 09:29:31
Done.
|
| profile), |
| active_profiles_.end()); |
| - CHECK(std::find(active_profiles_.begin(), active_profiles_.end(), |
| - profile) == active_profiles_.end()); |
| update_active_profiles = true; |
| } |
| break; |
| @@ -565,27 +559,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) == |
|
marja
2012/03/27 08:18:00
<<< this was the CHECK that seems to fire; the CHE
|
| - 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)); |
| + } |
| } |
| } |
| } |