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

Unified Diff: chrome/browser/prefs/pref_service.cc

Issue 11365112: Change PrefStore::ReadResult to a boolean. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/prefs/command_line_pref_store_unittest.cc ('k') | chrome/browser/prefs/pref_value_store.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/pref_service.cc
diff --git a/chrome/browser/prefs/pref_service.cc b/chrome/browser/prefs/pref_service.cc
index 1eb80b4a76ce15149a345acd904b2ffaacdf951e..06d5b79a5ade2834547cb3ac79e8de4c985ac218 100644
--- a/chrome/browser/prefs/pref_service.cc
+++ b/chrome/browser/prefs/pref_service.cc
@@ -731,7 +731,7 @@ const base::Value* PrefService::GetUserPrefValue(const char* path) const {
// Look for an existing preference in the user store. If it doesn't
// exist, return NULL.
base::Value* value = NULL;
- if (user_pref_store_->GetMutableValue(path, &value) != PrefStore::READ_OK)
+ if (!user_pref_store_->GetMutableValue(path, &value))
return NULL;
if (!value->IsType(pref->GetType())) {
@@ -746,7 +746,7 @@ const base::Value* PrefService::GetDefaultPrefValue(const char* path) const {
DCHECK(CalledOnValidThread());
// Lookup the preference in the default store.
const base::Value* value = NULL;
- if (default_store_->GetValue(path, &value) != PrefStore::READ_OK) {
+ if (!default_store_->GetValue(path, &value)) {
NOTREACHED() << "Default value missing for pref: " << path;
return NULL;
}
@@ -789,7 +789,7 @@ void PrefService::RegisterPreference(const char* path,
// The main code path takes ownership, but most don't. We'll be safe.
scoped_ptr<Value> scoped_value(default_value);
- DCHECK(!FindPreference(path)) << "Tried to register duplicate pref " << path;
+ CHECK(!FindPreference(path)) << "Tried to register duplicate pref " << path;
base::Value::Type orig_type = default_value->GetType();
DCHECK(orig_type != Value::TYPE_NULL && orig_type != Value::TYPE_BINARY) <<
@@ -824,10 +824,8 @@ void PrefService::UnregisterPreference(const char* path) {
DCHECK(CalledOnValidThread());
PreferenceMap::iterator it = prefs_map_.find(path);
- if (it == prefs_map_.end()) {
- NOTREACHED() << "Trying to unregister an unregistered pref: " << path;
- return;
- }
+ CHECK(it != prefs_map_.end()) << "Trying to unregister an unregistered pref: "
+ << path;
prefs_map_.erase(it);
default_store_->RemoveDefaultValue(path);
@@ -932,7 +930,7 @@ Value* PrefService::GetMutableUserPref(const char* path,
// Look for an existing preference in the user store. If it doesn't
// exist or isn't the correct type, create a new user preference.
Value* value = NULL;
- if (user_pref_store_->GetMutableValue(path, &value) != PrefStore::READ_OK ||
+ if (!user_pref_store_->GetMutableValue(path, &value) ||
!value->IsType(type)) {
if (type == Value::TYPE_DICTIONARY) {
value = new DictionaryValue;
« no previous file with comments | « chrome/browser/prefs/command_line_pref_store_unittest.cc ('k') | chrome/browser/prefs/pref_value_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698