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

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

Issue 33753002: Sooper experimental refactoring of the profile info cache. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 7 years, 2 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/gaia_info_update_service.cc ('k') | chrome/browser/profiles/profile_info_cache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_impl.cc
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 8b6afe1160dfdf9afa3c0da05a21cadc5656aafe..44061d3f90e5df3c9aa5c67b6567edcf85e67f60 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -1165,33 +1165,36 @@ GURL ProfileImpl::GetHomePage() {
void ProfileImpl::UpdateProfileUserNameCache() {
ProfileManager* profile_manager = g_browser_process->profile_manager();
ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
- size_t index = cache.GetIndexOfProfileWithPath(GetPath());
- if (index != std::string::npos) {
+ ProfileInfoEntry entry;
+ if (cache.GetInfoForProfile(GetPath(), &entry)) {
std::string user_name =
GetPrefs()->GetString(prefs::kGoogleServicesUsername);
- cache.SetUserNameOfProfileAtIndex(index, UTF8ToUTF16(user_name));
+ entry.set_user_name(UTF8ToUTF16(user_name));
+ cache.SetInfoForProfile(entry);
}
}
void ProfileImpl::UpdateProfileNameCache() {
ProfileManager* profile_manager = g_browser_process->profile_manager();
ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
- size_t index = cache.GetIndexOfProfileWithPath(GetPath());
- if (index != std::string::npos) {
+ ProfileInfoEntry entry;
+ if (cache.GetInfoForProfile(GetPath(), &entry)) {
std::string profile_name =
GetPrefs()->GetString(prefs::kProfileName);
- cache.SetNameOfProfileAtIndex(index, UTF8ToUTF16(profile_name));
+ entry.set_name(UTF8ToUTF16(profile_name));
+ cache.SetInfoForProfile(entry);
}
}
void ProfileImpl::UpdateProfileAvatarCache() {
ProfileManager* profile_manager = g_browser_process->profile_manager();
ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
- size_t index = cache.GetIndexOfProfileWithPath(GetPath());
- if (index != std::string::npos) {
+ ProfileInfoEntry entry;
+ if (cache.GetInfoForProfile(GetPath(), &entry)) {
size_t avatar_index =
GetPrefs()->GetInteger(prefs::kProfileAvatarIndex);
- cache.SetAvatarIconOfProfileAtIndex(index, avatar_index);
+ entry.set_icon_index(avatar_index);
+ cache.SetInfoForProfile(entry);
}
}
« no previous file with comments | « chrome/browser/profiles/gaia_info_update_service.cc ('k') | chrome/browser/profiles/profile_info_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698