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

Side by Side Diff: chrome/browser/prefs/pref_hash_store.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 6 years, 12 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_PREFS_PREF_HASH_STORE_H_
6 #define CHROME_BROWSER_PREFS_PREF_HASH_STORE_H_
7
8 #include <string>
9
10 #include "base/memory/scoped_ptr.h"
11
12 class PrefHashTracker;
13
14 namespace base {
15 class Value;
16 } // namespace base
17
18 // Stores hashes of and verifies preference values. To use, first call
19 // |InitializeTrackedValue| with each preference that should be tracked. Then
20 // call |OnPrefValueChanged| to update the hash store when preference values
21 // change.
22 class PrefHashStore {
23 public:
24 virtual ~PrefHashStore() {}
25
26 enum ValueState {
27 // The preference value corresponds to its stored hash.
28 UNCHANGED,
29 // The preference has been cleared since the last hash.
30 CLEARED,
31 // The preference value corresponds to its stored hash, which was calculated
32 // using a legacy hash algorithm.
33 MIGRATED,
34 // The preference value has been changed since the last hash.
35 CHANGED,
36 // No stored hash exists for the preference value.
37 UNKNOWN_VALUE,
38 };
39
40 // Checks |initial_value| against the existing stored value hash.
41 virtual ValueState CheckValue(
42 const std::string& path, const base::Value* initial_value) const = 0;
43
44 // Stores a hash of the current value of the preference at |path|.
45 virtual void StoreHash(const std::string& path,
46 const base::Value* value) = 0;
47 };
48
49 #endif // CHROME_BROWSER_PREFS_PREF_HASH_STORE_H_
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_hash_filter_unittest.cc ('k') | chrome/browser/prefs/pref_hash_store_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698