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

Unified Diff: chrome/browser/prefs/pref_hash_filter.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. 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_hash_filter.h
diff --git a/chrome/browser/prefs/pref_hash_filter.h b/chrome/browser/prefs/pref_hash_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..489a50c070a47fff2adc5e45eb576ce1b0a61f48
--- /dev/null
+++ b/chrome/browser/prefs/pref_hash_filter.h
@@ -0,0 +1,39 @@
+// Copyright (c) 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_FILTER_H_
+#define CHROME_BROWSER_PREFS_PREF_HASH_FILTER_H_
+
+#include <set>
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/prefs/pref_filter.h"
+
+class PersistentPrefStore;
+class PrefHashStore;
+
+// Intercepts preference values as they are loaded from disk and verifies them
+// using a PrefHashStore. Keeps the PrefHashStore contents up to date as values
+// are changed.
+class PrefHashFilter : public PrefFilter {
+ public:
+ explicit PrefHashFilter(scoped_ptr<PrefHashStore> pref_hash_store);
+ virtual ~PrefHashFilter();
+
+ // PrefFilter implementation.
+ virtual void FilterOnLoad(PersistentPrefStore* pref_store) OVERRIDE;
+ virtual void FilterUpdate(PersistentPrefStore* pref_store,
+ const std::string& path) OVERRIDE;
+
+ private:
+ scoped_ptr<PrefHashStore> pref_hash_store_;
+ std::set<std::string> tracked_paths_;
+
+ DISALLOW_COPY_AND_ASSIGN(PrefHashFilter);
+};
+
+#endif // CHROME_BROWSER_PREFS_PREF_HASH_FILTER_H_

Powered by Google App Engine
This is Rietveld 408576698