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

Unified Diff: chrome/browser/prefs/pref_metrics_service.h

Issue 90563003: Fix a race condition in preference metric reporting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to Gab's comments. Created 7 years 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/prefs/pref_metrics_service.h
diff --git a/chrome/browser/prefs/pref_metrics_service.h b/chrome/browser/prefs/pref_metrics_service.h
index 3a4bc4fcbc358d65a2823a3a3095113b6cc0795c..15d48ceae100cd8a362b8cf12a34a48c7361956a 100644
--- a/chrome/browser/prefs/pref_metrics_service.h
+++ b/chrome/browser/prefs/pref_metrics_service.h
@@ -8,25 +8,32 @@
#include <map>
#include <string>
+#include "base/basictypes.h"
+#include "base/callback.h"
+#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/singleton.h"
#include "base/memory/weak_ptr.h"
#include "base/prefs/pref_change_registrar.h"
#include "chrome/browser/prefs/synced_pref_change_registrar.h"
-#include "chrome/browser/profiles/profile.h"
#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
#include "components/browser_context_keyed_service/browser_context_keyed_service_factory.h"
+namespace base {
+class Value;
+} // namespace base
+
+namespace content {
+class BrowserContext;
+} // namespace content
+
+class Profile;
gab 2013/12/06 17:23:38 nit: Pro after Pre
class PrefRegistrySimple;
+class PrefService;
// PrefMetricsService is responsible for recording prefs-related UMA stats.
class PrefMetricsService : public BrowserContextKeyedService {
public:
- enum HashedPrefStyle {
- HASHED_PREF_STYLE_NEW,
- HASHED_PREF_STYLE_DEPRECATED,
- };
-
explicit PrefMetricsService(Profile* profile);
virtual ~PrefMetricsService();
@@ -49,22 +56,15 @@ class PrefMetricsService : public BrowserContextKeyedService {
content::BrowserContext* context) const OVERRIDE;
};
- // Registers preferences in local state.
- static void RegisterPrefs(PrefRegistrySimple* registry);
-
private:
friend class PrefMetricsServiceTest;
// Function to log a Value to a histogram
- typedef base::Callback<void(const std::string&, const Value*)>
+ typedef base::Callback<void(const std::string&, const base::Value*)>
LogHistogramValueCallback;
// For unit testing only.
- PrefMetricsService(Profile* profile,
- PrefService* local_settings,
- const std::string& device_id,
- const char** tracked_pref_paths,
- int tracked_pref_path_count);
+ PrefMetricsService(Profile* profile, PrefService* local_settings);
// Record prefs state on browser context creation.
void RecordLaunchPrefs();
@@ -85,43 +85,16 @@ class PrefMetricsService : public BrowserContextKeyedService {
// Callback for a boolean pref change histogram.
void LogBooleanPrefChange(const std::string& histogram_name,
- const Value* value);
+ const base::Value* value);
// Callback for an integer pref change histogram.
void LogIntegerPrefChange(int boundary_value,
const std::string& histogram_name,
- const Value* value);
-
- // Callback to receive a unique device_id.
- void GetDeviceIdCallback(const std::string& device_id);
-
- // Checks the tracked preferences against their last known values and reports
- // any discrepancies. This must be called after |device_id| has been set.
- void CheckTrackedPreferences();
-
- // Updates the hash of the tracked preference in local state. This must be
- // called after |device_id| has been set.
- void UpdateTrackedPreference(const char* path);
-
- // Computes an MD5 hash for the given preference value. |value| can be
- // NULL which will result in the unique hash representing NULL for the pref
- // at |path|.
- std::string GetHashedPrefValue(
- const char* path,
- const base::Value* value,
- HashedPrefStyle desired_style);
-
- void InitializePrefObservers();
+ const base::Value* value);
Profile* profile_;
PrefService* prefs_;
PrefService* local_state_;
- std::string profile_name_;
- std::string pref_hash_seed_;
- std::string device_id_;
- const char** tracked_pref_paths_;
- const int tracked_pref_path_count_;
- bool checked_tracked_prefs_;
PrefChangeRegistrar pref_registrar_;
scoped_ptr<SyncedPrefChangeRegistrar> synced_pref_change_registrar_;

Powered by Google App Engine
This is Rietveld 408576698