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

Side by Side Diff: chrome/browser/metrics/metrics_service.cc

Issue 10832371: Record the first recorded entropy source instead of the last. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: dchecks Created 8 years, 4 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 | « chrome/browser/metrics/metrics_service.h ('k') | no next file » | 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 //------------------------------------------------------------------------------ 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 10 // A MetricsService instance is typically created at application startup. It
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 std::string MetricsService::GetEntropySource(bool reporting_will_be_enabled) { 542 std::string MetricsService::GetEntropySource(bool reporting_will_be_enabled) {
543 // For metrics reporting-enabled users, we combine the client ID and low 543 // For metrics reporting-enabled users, we combine the client ID and low
544 // entropy source to get the final entropy source. Otherwise, only use the low 544 // entropy source to get the final entropy source. Otherwise, only use the low
545 // entropy source. 545 // entropy source.
546 // This has two useful properties: 546 // This has two useful properties:
547 // 1) It makes the entropy source less identifiable for parties that do not 547 // 1) It makes the entropy source less identifiable for parties that do not
548 // know the low entropy source. 548 // know the low entropy source.
549 // 2) It makes the final entropy source resettable. 549 // 2) It makes the final entropy source resettable.
550 std::string low_entropy_source = base::IntToString(GetLowEntropySource()); 550 std::string low_entropy_source = base::IntToString(GetLowEntropySource());
551 if (reporting_will_be_enabled) { 551 if (reporting_will_be_enabled) {
552 entropy_source_returned_ = LAST_ENTROPY_HIGH; 552 if (entropy_source_returned_ == LAST_ENTROPY_NONE)
553 entropy_source_returned_ = LAST_ENTROPY_HIGH;
554 DCHECK_EQ(LAST_ENTROPY_HIGH, entropy_source_returned_);
553 return client_id_ + low_entropy_source; 555 return client_id_ + low_entropy_source;
554 } 556 }
555 entropy_source_returned_ = LAST_ENTROPY_LOW; 557 if (entropy_source_returned_ == LAST_ENTROPY_NONE)
558 entropy_source_returned_ = LAST_ENTROPY_LOW;
559 DCHECK_EQ(LAST_ENTROPY_LOW, entropy_source_returned_);
556 return low_entropy_source; 560 return low_entropy_source;
557 } 561 }
558 562
559 void MetricsService::ForceClientIdCreation() { 563 void MetricsService::ForceClientIdCreation() {
560 if (!client_id_.empty()) 564 if (!client_id_.empty())
561 return; 565 return;
562 PrefService* pref = g_browser_process->local_state(); 566 PrefService* pref = g_browser_process->local_state();
563 client_id_ = pref->GetString(prefs::kMetricsClientID); 567 client_id_ = pref->GetString(prefs::kMetricsClientID);
564 if (!client_id_.empty()) 568 if (!client_id_.empty())
565 return; 569 return;
(...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after
1909 if (local_state) { 1913 if (local_state) {
1910 const PrefService::Preference* uma_pref = 1914 const PrefService::Preference* uma_pref =
1911 local_state->FindPreference(prefs::kMetricsReportingEnabled); 1915 local_state->FindPreference(prefs::kMetricsReportingEnabled);
1912 if (uma_pref) { 1916 if (uma_pref) {
1913 bool success = uma_pref->GetValue()->GetAsBoolean(&result); 1917 bool success = uma_pref->GetValue()->GetAsBoolean(&result);
1914 DCHECK(success); 1918 DCHECK(success);
1915 } 1919 }
1916 } 1920 }
1917 return result; 1921 return result;
1918 } 1922 }
OLDNEW
« no previous file with comments | « chrome/browser/metrics/metrics_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698