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

Side by Side Diff: components/metrics/metrics_service.cc

Issue 979363003: UMA: use a more frequent upload interval for Chromecast. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removes conditional Created 5 years, 9 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 | « components/metrics/metrics_service.h ('k') | components/metrics/metrics_service_client.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 //------------------------------------------------------------------------------ 5 //------------------------------------------------------------------------------
6 // Description of the life cycle of a instance of MetricsService. 6 // Description of the life cycle of a instance of MetricsService.
7 // 7 //
8 // OVERVIEW 8 // OVERVIEW
9 // 9 //
10 // A MetricsService instance is typically created at application startup. It is 10 // A MetricsService instance is typically created at application startup. It is
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 DisableRecording(); 334 DisableRecording();
335 } 335 }
336 336
337 void MetricsService::InitializeMetricsRecordingState() { 337 void MetricsService::InitializeMetricsRecordingState() {
338 InitializeMetricsState(); 338 InitializeMetricsState();
339 339
340 base::Closure upload_callback = 340 base::Closure upload_callback =
341 base::Bind(&MetricsService::StartScheduledUpload, 341 base::Bind(&MetricsService::StartScheduledUpload,
342 self_ptr_factory_.GetWeakPtr()); 342 self_ptr_factory_.GetWeakPtr());
343 scheduler_.reset( 343 scheduler_.reset(
344 new MetricsReportingScheduler(upload_callback, is_cellular_callback_)); 344 new MetricsReportingScheduler(
345 upload_callback,
346 // MetricsServiceClient outlives MetricsService, and
347 // MetricsReportingScheduler is tied to the lifetime of |this|.
348 base::Bind(&MetricsServiceClient::GetStandardUploadInterval,
349 base::Unretained(client_))));
345 } 350 }
346 351
347 void MetricsService::Start() { 352 void MetricsService::Start() {
348 HandleIdleSinceLastTransmission(false); 353 HandleIdleSinceLastTransmission(false);
349 EnableRecording(); 354 EnableRecording();
350 EnableReporting(); 355 EnableReporting();
351 } 356 }
352 357
353 bool MetricsService::StartIfMetricsReportingEnabled() { 358 bool MetricsService::StartIfMetricsReportingEnabled() {
354 const bool enabled = state_manager_->IsMetricsReportingEnabled(); 359 const bool enabled = state_manager_->IsMetricsReportingEnabled();
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 DCHECK(IsSingleThreaded()); 1222 DCHECK(IsSingleThreaded());
1218 local_state_->SetBoolean(path, value); 1223 local_state_->SetBoolean(path, value);
1219 RecordCurrentState(local_state_); 1224 RecordCurrentState(local_state_);
1220 } 1225 }
1221 1226
1222 void MetricsService::RecordCurrentState(PrefService* pref) { 1227 void MetricsService::RecordCurrentState(PrefService* pref) {
1223 pref->SetInt64(prefs::kStabilityLastTimestampSec, 1228 pref->SetInt64(prefs::kStabilityLastTimestampSec,
1224 base::Time::Now().ToTimeT()); 1229 base::Time::Now().ToTimeT());
1225 } 1230 }
1226 1231
1227 void MetricsService::SetConnectionTypeCallback(
1228 base::Callback<void(bool*)> is_cellular_callback) {
1229 DCHECK(!scheduler_);
1230 is_cellular_callback_ = is_cellular_callback;
1231 }
1232
1233 } // namespace metrics 1232 } // namespace metrics
OLDNEW
« no previous file with comments | « components/metrics/metrics_service.h ('k') | components/metrics/metrics_service_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698