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

Unified Diff: chrome/browser/metrics/metrics_service.cc

Issue 213363004: Resetting metrics ids on clump detection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/metrics/metrics_service.cc
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc
index a313c4514051b636009db4616c10559f98a64ca5..0360d7c1556c8b2a6d485d7eb770aecbf4f98025 100644
--- a/chrome/browser/metrics/metrics_service.cc
+++ b/chrome/browser/metrics/metrics_service.cc
@@ -163,6 +163,8 @@
#include "chrome/browser/metrics/metrics_service.h"
+#include "base/debug/stack_trace.h"
+
#include <algorithm>
#include "base/bind.h"
@@ -631,8 +633,12 @@ MetricsService::CreateEntropyProvider(ReportingState reporting_state) {
}
void MetricsService::ForceClientIdCreation() {
+ DVLOG(2) << "\n\nCreating client id\n\n";
+ base::debug::StackTrace st;
+ // DVLOG(2) << st.ToString();
if (!client_id_.empty())
return;
+ DVLOG(2) << "\n\nActually creating id\n\n";
PrefService* pref = g_browser_process->local_state();
client_id_ = pref->GetString(prefs::kMetricsClientID);
if (!client_id_.empty())
@@ -1186,6 +1192,9 @@ void MetricsService::GetUptimes(PrefService* pref,
}
int MetricsService::GetLowEntropySource() {
+ DVLOG(2) << "\n\nGetting LES\n\n";
+ base::debug::StackTrace st;
+ // DVLOG(2) << st.ToString();
// Note that the default value for the low entropy source and the default pref
// value are both kLowEntropySourceNotSet, which is used to identify if the
// value has been set or not.
@@ -1862,6 +1871,7 @@ void MetricsService::RegisterSyntheticFieldTrial(
}
void MetricsService::CheckForClonedInstall() {
+ DVLOG(2) << "\n\nChecking for cloned installs\n\n";
DCHECK(!cloned_install_detector_);
metrics::MachineIdProvider* provider =
@@ -1876,6 +1886,19 @@ void MetricsService::CheckForClonedInstall() {
cloned_install_detector_->CheckForClonedInstall(local_state);
}
+void MetricsService::ResetVariationsState() {
+ PrefService* local_state = g_browser_process->local_state();
+ DCHECK(local_state->GetBoolean(prefs::kMetricsCloneDetected));
+ DCHECK(client_id_.empty());
+ DCHECK(low_entropy_source_ == kLowEntropySourceNotSet);
+
+ DVLOG(2) << "\n\nresetting variatinos state\n\n";
+
+ local_state->ClearPref(prefs::kMetricsClientID);
+ local_state->ClearPref(prefs::kMetricsLowEntropySource);
+ local_state->SetBoolean(prefs::kMetricsCloneDetected, false);
Alexei Svitkine (slow) 2014/03/26 21:34:50 Why not ClearPref()?
jwd 2014/03/28 16:23:49 Done.
+}
+
void MetricsService::GetCurrentSyntheticFieldTrials(
std::vector<chrome_variations::ActiveGroupId>* synthetic_trials) {
DCHECK(synthetic_trials);

Powered by Google App Engine
This is Rietveld 408576698