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

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

Issue 365133005: Refactor SetClientID such that metrics rather than crash backs up the client id in Google Update set (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits:grt Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « components/breakpad/app/breakpad_mac.mm ('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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 } 397 }
398 398
399 void MetricsService::EnableRecording() { 399 void MetricsService::EnableRecording() {
400 DCHECK(IsSingleThreaded()); 400 DCHECK(IsSingleThreaded());
401 401
402 if (recording_active_) 402 if (recording_active_)
403 return; 403 return;
404 recording_active_ = true; 404 recording_active_ = true;
405 405
406 state_manager_->ForceClientIdCreation(); 406 state_manager_->ForceClientIdCreation();
407 client_->SetClientID(state_manager_->client_id()); 407 client_->SetMetricsClientId(state_manager_->client_id());
408 if (!log_manager_.current_log()) 408 if (!log_manager_.current_log())
409 OpenNewLog(); 409 OpenNewLog();
410 410
411 for (size_t i = 0; i < metrics_providers_.size(); ++i) 411 for (size_t i = 0; i < metrics_providers_.size(); ++i)
412 metrics_providers_[i]->OnRecordingEnabled(); 412 metrics_providers_[i]->OnRecordingEnabled();
413 413
414 base::RemoveActionCallback(action_callback_); 414 base::RemoveActionCallback(action_callback_);
415 action_callback_ = base::Bind(&MetricsService::OnUserAction, 415 action_callback_ = base::Bind(&MetricsService::OnUserAction,
416 base::Unretained(this)); 416 base::Unretained(this));
417 base::AddActionCallback(action_callback_); 417 base::AddActionCallback(action_callback_);
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 RecordCurrentState(local_state_); 1205 RecordCurrentState(local_state_);
1206 } 1206 }
1207 1207
1208 void MetricsService::RecordCurrentState(PrefService* pref) { 1208 void MetricsService::RecordCurrentState(PrefService* pref) {
1209 pref->SetInt64(metrics::prefs::kStabilityLastTimestampSec, 1209 pref->SetInt64(metrics::prefs::kStabilityLastTimestampSec,
1210 Time::Now().ToTimeT()); 1210 Time::Now().ToTimeT());
1211 1211
1212 for (size_t i = 0; i < metrics_providers_.size(); ++i) 1212 for (size_t i = 0; i < metrics_providers_.size(); ++i)
1213 metrics_providers_[i]->RecordCurrentState(); 1213 metrics_providers_[i]->RecordCurrentState();
1214 } 1214 }
OLDNEW
« no previous file with comments | « components/breakpad/app/breakpad_mac.mm ('k') | components/metrics/metrics_service_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698