Commit 453890db authored by ivankr@chromium.org's avatar ivankr@chromium.org

[cros] UMA for profile image download times.

BUG=None
TEST=Manual with chrome://histograms

Review URL: http://codereview.chromium.org/8638007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111125 0039d316-1c4b-4281-b951-d872f2087c98
parent f3371353
......@@ -98,6 +98,16 @@ enum ProfileDownloadResult {
kDownloadResultsCount
};
// Time histogram name for the default profile image download.
const char kProfileDownloadDefaultTime[] =
"UserImage.ProfileDownloadDefaultTime";
// Time histogram name for a failed profile image download.
const char kProfileDownloadFailureTime[] =
"UserImage.ProfileDownloadFailureTime";
// Time histogram name for a successful profile image download.
const char ProfileDownloadSuccessTime[] =
"UserImage.ProfileDownloadSuccessTime";
// Used to handle the asynchronous response of deleting a cryptohome directory.
class RemoveAttempt : public CryptohomeLibrary::Delegate {
public:
......@@ -473,9 +483,9 @@ void UserManager::DownloadProfileImage() {
return;
}
profile_image_load_start_time_ = base::Time::Now();
profile_image_downloader_.reset(new ProfileDownloader(this));
profile_image_downloader_->Start();
profile_image_load_start_time_ = base::Time::Now();
}
void UserManager::Observe(int type,
......@@ -819,15 +829,26 @@ Profile* UserManager::GetBrowserProfile() {
void UserManager::OnDownloadComplete(ProfileDownloader* downloader,
bool success) {
ProfileDownloadResult result;
if (!success)
std::string time_histogram_name;
if (!success) {
result = kDownloadFailure;
else if (downloader->GetProfilePicture().isNull())
time_histogram_name = kProfileDownloadFailureTime;
} else if (downloader->GetProfilePicture().isNull()) {
result = kDownloadDefault;
else
time_histogram_name = kProfileDownloadDefaultTime;
} else {
result = kDownloadSuccess;
time_histogram_name = ProfileDownloadSuccessTime;
}
UMA_HISTOGRAM_ENUMERATION("UserImage.ProfileDownloadResult",
result, kDownloadResultsCount);
DCHECK(!profile_image_load_start_time_.is_null());
base::TimeDelta delta = base::Time::Now() - profile_image_load_start_time_;
VLOG(1) << "Profile image download time: " << delta.InSecondsF();
UMA_HISTOGRAM_TIMES(time_histogram_name, delta);
if (result == kDownloadSuccess) {
// Check if this image is not the same as already downloaded.
std::string new_image_data_url =
......
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