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

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: Nit. 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..baa7811a05aca3fd5ed75039ac5f2f8f626e780a
--- /dev/null
+++ b/chrome/browser/prefs/pref_hash_filter.h
@@ -0,0 +1,44 @@
+// 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 PrefHashStore;
+
+namespace base {
+class DictionaryValue;
+class Value;
+} // namespace base
+
+// 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(base::DictionaryValue* pref_store_contents)
+ OVERRIDE;
+ virtual void FilterUpdate(const std::string& path,
+ const base::Value* value) OVERRIDE;
+
+ private:
+ scoped_ptr<PrefHashStore> pref_hash_store_;
+ std::set<std::string> tracked_paths_;
gab 2013/12/12 17:20:58 std::set<const std::string>
erikwright (departed) 2013/12/12 22:02:57 Discussed offline. This would have no impact. Dere
+
+ DISALLOW_COPY_AND_ASSIGN(PrefHashFilter);
+};
+
+#endif // CHROME_BROWSER_PREFS_PREF_HASH_FILTER_H_

Powered by Google App Engine
This is Rietveld 408576698