Commit 412e510b authored by treib@chromium.org's avatar treib@chromium.org

Fix incorrect usage of ProfileInfoCache in GAIAInfoUpdateService:...

Fix incorrect usage of ProfileInfoCache in GAIAInfoUpdateService: SetGAIANameOfProfileAtIndex may change the profile index.
Also add some warning comments in profile_info_cache.h.

BUG=372381

Review URL: https://codereview.chromium.org/373083002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282095 0039d316-1c4b-4281-b951-d872f2087c98
parent b77a71ca
......@@ -118,10 +118,13 @@ void GAIAInfoUpdateService::OnProfileDownloadSuccess(
return;
cache.SetGAIANameOfProfileAtIndex(profile_index, full_name);
cache.SetGAIAGivenNameOfProfileAtIndex(profile_index, given_name);
// The profile index may have changed.
profile_index = cache.GetIndexOfProfileWithPath(profile_->GetPath());
cache.SetGAIAGivenNameOfProfileAtIndex(profile_index, given_name);
// The profile index may have changed.
profile_index = cache.GetIndexOfProfileWithPath(profile_->GetPath());
if (profile_index == std::string::npos)
return;
if (picture_status == ProfileDownloader::PICTURE_SUCCESS) {
......
......@@ -95,6 +95,7 @@ class ProfileInfoCache : public ProfileInfoInterface,
size_t GetAvatarIconIndexOfProfileAtIndex(size_t index) const;
void SetProfileActiveTimeAtIndex(size_t index);
// Warning: This will re-sort profiles and thus may change indices!
void SetNameOfProfileAtIndex(size_t index, const base::string16& name);
void SetShortcutNameOfProfileAtIndex(size_t index,
const base::string16& name);
......@@ -107,7 +108,9 @@ class ProfileInfoCache : public ProfileInfoInterface,
const std::string& auth);
void SetBackgroundStatusOfProfileAtIndex(size_t index,
bool running_background_apps);
// Warning: This will re-sort profiles and thus may change indices!
void SetGAIANameOfProfileAtIndex(size_t index, const base::string16& name);
// Warning: This will re-sort profiles and thus may change indices!
void SetGAIAGivenNameOfProfileAtIndex(size_t index,
const base::string16& name);
void SetGAIAPictureOfProfileAtIndex(size_t index, const gfx::Image* image);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment