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

Side by Side 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: Respond to Gab's comments. 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 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_IMPL_H_
6 #define CHROME_BROWSER_PREFS_PREF_HASH_STORE_IMPL_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/prefs/pref_hash_calculator.h"
14 #include "chrome/browser/prefs/pref_hash_store.h"
15
16 class PrefRegistrySimple;
17 class PrefService;
18
19 namespace base {
20 class Value;
21 } // namespace base
22
23 // Implements PrefHashStoreImpl by storing preference hashes in a PrefService.
24 class PrefHashStoreImpl : public PrefHashStore {
25 public:
26 // Constructs a PrefHashStoreImpl that calculates hashes using
27 // |hash_calculator| and stores them in |local_state|. Multiple hash stores
28 // can use the same |local_state| with distinct |hash_store_id|s.
29 //
30 // The same |hash_calculator| parameters and |hash_store_id| must be used to
31 // load and validate previously stored hashes in |local_state|.
32 //
33 // |local_state| must have previously been passed to |RegisterPrefs|.
34 PrefHashStoreImpl(const PrefHashCalculator& hash_calculator,
35 PrefService* local_state,
gab 2013/12/06 17:23:38 out-params last (this is not really an out-param,
erikwright (departed) 2013/12/09 17:59:40 Done.
36 const std::string& hash_store_id);
37
38 // Registers required local state preferences.
39 static void RegisterPrefs(PrefRegistrySimple* registry);
40
41 // PrefHashStore implementation.
42 virtual ValueState CheckValue(const std::string& path,
43 const base::Value* value) OVERRIDE;
44 virtual void StoreValue(const std::string& path,
45 const base::Value* value) OVERRIDE;
46
47 private:
48 PrefService* local_state_;
49 std::string hash_store_id_;
50 PrefHashCalculator pref_hash_calculator_;
gab 2013/12/06 17:23:38 Same order here as you have in the constructor
erikwright (departed) 2013/12/09 17:59:40 Done.
51
52 DISALLOW_COPY_AND_ASSIGN(PrefHashStoreImpl);
53 };
54
55 #endif // CHROME_BROWSER_PREFS_PREF_HASH_STORE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698