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

Unified Diff: chrome/browser/chromeos/login/user_manager.cc

Issue 8638007: [cros] UMA for profile image download times. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/user_manager.cc
diff --git a/chrome/browser/chromeos/login/user_manager.cc b/chrome/browser/chromeos/login/user_manager.cc
index b64c68b6df5c8e064f715c5b9948f20d6e7f721f..6e6a3622c90eab80b99c5c18c6b2c514b41ca89b 100644
--- a/chrome/browser/chromeos/login/user_manager.cc
+++ b/chrome/browser/chromeos/login/user_manager.cc
@@ -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 =
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698