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

Side by Side Diff: chrome/browser/profiles/gaia_info_update_service.cc

Issue 1746993002: Stop chrome from logging profile counts too many times at startup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/profiles/gaia_info_update_service.h" 5 #include "chrome/browser/profiles/gaia_info_update_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 last_updated_ = base::Time::FromInternalValue( 46 last_updated_ = base::Time::FromInternalValue(
47 prefs->GetInt64(prefs::kProfileGAIAInfoUpdateTime)); 47 prefs->GetInt64(prefs::kProfileGAIAInfoUpdateTime));
48 ScheduleNextUpdate(); 48 ScheduleNextUpdate();
49 } 49 }
50 50
51 GAIAInfoUpdateService::~GAIAInfoUpdateService() { 51 GAIAInfoUpdateService::~GAIAInfoUpdateService() {
52 DCHECK(!profile_) << "Shutdown not called before dtor"; 52 DCHECK(!profile_) << "Shutdown not called before dtor";
53 } 53 }
54 54
55 void GAIAInfoUpdateService::Update() { 55 void GAIAInfoUpdateService::Update() {
56 // UMA Profile Metrics should be logged regularly.
57 ProfileMetrics::LogNumberOfProfiles(g_browser_process->profile_manager());
58
59 // The user must be logged in. 56 // The user must be logged in.
60 SigninManagerBase* signin_manager = 57 SigninManagerBase* signin_manager =
61 SigninManagerFactory::GetForProfile(profile_); 58 SigninManagerFactory::GetForProfile(profile_);
62 if (!signin_manager->IsAuthenticated()) 59 if (!signin_manager->IsAuthenticated())
63 return; 60 return;
64 61
65 if (profile_image_downloader_) 62 if (profile_image_downloader_)
66 return; 63 return;
67 profile_image_downloader_.reset(new ProfileDownloader(this)); 64 profile_image_downloader_.reset(new ProfileDownloader(this));
68 profile_image_downloader_->Start(); 65 profile_image_downloader_->Start();
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 const base::TimeDelta desired_delta = 194 const base::TimeDelta desired_delta =
198 base::TimeDelta::FromHours(kUpdateIntervalHours); 195 base::TimeDelta::FromHours(kUpdateIntervalHours);
199 const base::TimeDelta update_delta = base::Time::Now() - last_updated_; 196 const base::TimeDelta update_delta = base::Time::Now() - last_updated_;
200 197
201 base::TimeDelta delta; 198 base::TimeDelta delta;
202 if (update_delta < base::TimeDelta() || update_delta > desired_delta) 199 if (update_delta < base::TimeDelta() || update_delta > desired_delta)
203 delta = base::TimeDelta::FromSeconds(kMinUpdateIntervalSeconds); 200 delta = base::TimeDelta::FromSeconds(kMinUpdateIntervalSeconds);
204 else 201 else
205 delta = desired_delta - update_delta; 202 delta = desired_delta - update_delta;
206 203
204 // UMA Profile Metrics should be logged regularly. Logging is not performed
205 // in Update() because it is a public method and may be called at any time.
206 // These metrics should logged only on this schedule.
207 //
208 // In mac perf tests, the browser process pointer may be null.
209 if (g_browser_process)
210 ProfileMetrics::LogNumberOfProfiles(g_browser_process->profile_manager());
211
207 timer_.Start(FROM_HERE, delta, this, &GAIAInfoUpdateService::Update); 212 timer_.Start(FROM_HERE, delta, this, &GAIAInfoUpdateService::Update);
208 } 213 }
209 214
210 void GAIAInfoUpdateService::GoogleSigninSucceeded( 215 void GAIAInfoUpdateService::GoogleSigninSucceeded(
211 const std::string& account_id, 216 const std::string& account_id,
212 const std::string& username, 217 const std::string& username,
213 const std::string& password) { 218 const std::string& password) {
214 OnUsernameChanged(username); 219 OnUsernameChanged(username);
215 } 220 }
216 221
217 void GAIAInfoUpdateService::GoogleSignedOut(const std::string& account_id, 222 void GAIAInfoUpdateService::GoogleSignedOut(const std::string& account_id,
218 const std::string& username) { 223 const std::string& username) {
219 OnUsernameChanged(std::string()); 224 OnUsernameChanged(std::string());
220 } 225 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698