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

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

Issue 90563003: Fix a race condition in preference metric reporting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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_hash_store_impl.h
diff --git a/chrome/browser/prefs/pref_hash_store_impl.h b/chrome/browser/prefs/pref_hash_store_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..f247a58f83072a414dacb1b8830f783580669769
--- /dev/null
+++ b/chrome/browser/prefs/pref_hash_store_impl.h
@@ -0,0 +1,52 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_PREFS_PREF_HASH_STORE_IMPL_H_
+#define CHROME_BROWSER_PREFS_PREF_HASH_STORE_IMPL_H_
+
+#include <string>
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/prefs/pref_hash_calculator.h"
+#include "chrome/browser/prefs/pref_hash_store.h"
+
+class PrefService;
+
+namespace base {
+class Value;
+} // namespace base
+
+// Implements PrefHashStoreImpl by storing preference hashes in a PrefService.
+class PrefHashStoreImpl : public PrefHashStore {
+ public:
+ // Constructs a PrefHashStoreImpl that calculates hashes using |seed| and
+ // stores them in |local_state|. Multiple hash stores can use the same
+ // |local_state| with distinct |hash_store_id|s.
+ //
+ // The same |seed| and |hash_store_id| must be used to load and validate
+ // previously stored hashes in |local_state|.
+ PrefHashStoreImpl(const std::string& seed,
+ PrefService* local_state,
+ const std::string& hash_store_id);
+
+ // PrefHashStore implementation.
+ virtual InitializationResult InitializeTrackedValue(
+ const std::string& path, const base::Value* initial_value) OVERRIDE;
+
+ private:
+ class PrefHashTrackerImpl;
gab 2013/11/27 23:43:27 Does this need to be a private class? Could it jus
+
+ // PrefHashStore implementation.
+ virtual scoped_ptr<PrefHashTracker> CompleteInitialization() OVERRIDE;
+
+ PrefService* local_state_;
+ std::string hash_store_id_;
+ PrefHashCalculator pref_hash_calculator_;
+ scoped_ptr<PrefHashTrackerImpl> pref_hash_tracker_;
+
+ DISALLOW_COPY_AND_ASSIGN(PrefHashStoreImpl);
+};
+
+#endif // CHROME_BROWSER_PREFS_PREF_HASH_STORE_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698