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

Side by Side Diff: base/prefs/default_pref_store.h

Issue 11358123: Rewrite DefaultPrefStore for performance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review changes Created 8 years, 1 month 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
« no previous file with comments | « no previous file | base/prefs/default_pref_store.cc » ('j') | base/prefs/default_pref_store.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_PREFS_DEFAULT_PREF_STORE_H_ 5 #ifndef BASE_PREFS_DEFAULT_PREF_STORE_H_
6 #define BASE_PREFS_DEFAULT_PREF_STORE_H_ 6 #define BASE_PREFS_DEFAULT_PREF_STORE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/prefs/base_prefs_export.h" 10 #include "base/prefs/base_prefs_export.h"
11 #include "base/prefs/value_map_pref_store.h" 11 #include "base/prefs/pref_store.h"
12 #include "base/prefs/pref_value_map.h"
12 #include "base/values.h" 13 #include "base/values.h"
13 14
14 // This PrefStore keeps track of default preference values set when a 15 // This PrefStore keeps track of default preference values set when a
15 // preference is registered with the PrefService. 16 // preference is registered with the PrefService.
16 class BASE_PREFS_EXPORT DefaultPrefStore : public ValueMapPrefStore { 17 class BASE_PREFS_EXPORT DefaultPrefStore : public PrefStore {
17 public: 18 public:
19 typedef PrefValueMap::const_iterator const_iterator;
20
18 DefaultPrefStore(); 21 DefaultPrefStore();
19 22
battre 2012/11/07 11:50:49 nit: // Implementation of PrefStore.
23 virtual ReadResult GetValue(const std::string& key,
24 const base::Value** result) const OVERRIDE;
25
20 // Stores a new |value| for |key|. Assumes ownership of |value|. 26 // Stores a new |value| for |key|. Assumes ownership of |value|.
21 void SetDefaultValue(const std::string& key, Value* value); 27 void SetDefaultValue(const std::string& key, Value* value);
22 28
23 // Removes the value for |key|. 29 // Removes the value for |key|.
24 void RemoveDefaultValue(const std::string& key); 30 void RemoveDefaultValue(const std::string& key);
25 31
26 // Returns the registered type for |key| or Value::TYPE_NULL if the |key| 32 // Returns the registered type for |key| or Value::TYPE_NULL if the |key|
27 // has not been registered. 33 // has not been registered.
28 base::Value::Type GetType(const std::string& key) const; 34 base::Value::Type GetType(const std::string& key) const;
29 35
36 const_iterator begin() const;
37 const_iterator end() const;
38
30 protected: 39 protected:
31 virtual ~DefaultPrefStore(); 40 virtual ~DefaultPrefStore();
32 41
33 private: 42 private:
43 PrefValueMap prefs_;
44
34 DISALLOW_COPY_AND_ASSIGN(DefaultPrefStore); 45 DISALLOW_COPY_AND_ASSIGN(DefaultPrefStore);
35 }; 46 };
36 47
37 #endif // BASE_PREFS_DEFAULT_PREF_STORE_H_ 48 #endif // BASE_PREFS_DEFAULT_PREF_STORE_H_
OLDNEW
« no previous file with comments | « no previous file | base/prefs/default_pref_store.cc » ('j') | base/prefs/default_pref_store.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698