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

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

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
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 #include "base/prefs/default_pref_store.h" 5 #include "base/prefs/default_pref_store.h"
6 #include "base/logging.h"
battre 2012/11/07 11:50:49 not necessary
6 7
7 using base::Value; 8 using base::Value;
8 9
9 DefaultPrefStore::DefaultPrefStore() {} 10 DefaultPrefStore::DefaultPrefStore() {}
10 11
12 PrefStore::ReadResult DefaultPrefStore::GetValue(
13 const std::string& key,
14 const base::Value** result) const {
15 return prefs_.GetValue(key, result) ? READ_OK : READ_NO_VALUE;
16 }
17
11 void DefaultPrefStore::SetDefaultValue(const std::string& key, Value* value) { 18 void DefaultPrefStore::SetDefaultValue(const std::string& key, Value* value) {
12 CHECK(GetValue(key, NULL) == READ_NO_VALUE); 19 CHECK(GetValue(key, NULL) == READ_NO_VALUE);
13 SetValue(key, value); 20 prefs_.SetValue(key, value);
14 } 21 }
15 22
16 void DefaultPrefStore::RemoveDefaultValue(const std::string& key) { 23 void DefaultPrefStore::RemoveDefaultValue(const std::string& key) {
17 CHECK(GetValue(key, NULL) == READ_OK); 24 CHECK(GetValue(key, NULL) == READ_OK);
18 RemoveValue(key); 25 prefs_.RemoveValue(key);
19 } 26 }
20 27
21 base::Value::Type DefaultPrefStore::GetType(const std::string& key) const { 28 base::Value::Type DefaultPrefStore::GetType(const std::string& key) const {
22 const Value* value; 29 const Value* value;
23 return GetValue(key, &value) == READ_OK ? value->GetType() : Value::TYPE_NULL; 30 return GetValue(key, &value) == READ_OK ? value->GetType() : Value::TYPE_NULL;
24 } 31 }
25 32
33 DefaultPrefStore::const_iterator DefaultPrefStore::begin() const {
34 return prefs_.begin();
35 }
36
37 DefaultPrefStore::const_iterator DefaultPrefStore::end() const {
38 return prefs_.end();
39 }
40
26 DefaultPrefStore::~DefaultPrefStore() {} 41 DefaultPrefStore::~DefaultPrefStore() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698