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

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: Also filter 'empty loads' as in new run or corrupted pref file scenarios. 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
« no previous file with comments | « chrome/browser/prefs/pref_hash_calculator_unittest.cc ('k') | chrome/browser/prefs/pref_hash_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
+
+ DISALLOW_COPY_AND_ASSIGN(PrefHashFilter);
+};
+
+#endif // CHROME_BROWSER_PREFS_PREF_HASH_FILTER_H_
« no previous file with comments | « chrome/browser/prefs/pref_hash_calculator_unittest.cc ('k') | chrome/browser/prefs/pref_hash_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698