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

Side by Side Diff: chrome/browser/prefs/pref_service.cc

Issue 11360014: Only check if a 'new' preference already exists in checking builds (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
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 #include "chrome/browser/prefs/pref_service.h" 5 #include "chrome/browser/prefs/pref_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 } 780 }
781 781
782 void PrefService::RegisterPreference(const char* path, 782 void PrefService::RegisterPreference(const char* path,
783 Value* default_value, 783 Value* default_value,
784 PrefSyncStatus sync_status) { 784 PrefSyncStatus sync_status) {
785 DCHECK(CalledOnValidThread()); 785 DCHECK(CalledOnValidThread());
786 786
787 // The main code path takes ownership, but most don't. We'll be safe. 787 // The main code path takes ownership, but most don't. We'll be safe.
788 scoped_ptr<Value> scoped_value(default_value); 788 scoped_ptr<Value> scoped_value(default_value);
789 789
790 if (FindPreference(path)) { 790 DCHECK(!FindPreference(path)) << "Tried to register duplicate pref " << path;
791 NOTREACHED() << "Tried to register duplicate pref " << path;
792 return;
793 }
794 791
795 base::Value::Type orig_type = default_value->GetType(); 792 base::Value::Type orig_type = default_value->GetType();
796 DCHECK(orig_type != Value::TYPE_NULL && orig_type != Value::TYPE_BINARY) << 793 DCHECK(orig_type != Value::TYPE_NULL && orig_type != Value::TYPE_BINARY) <<
797 "invalid preference type: " << orig_type; 794 "invalid preference type: " << orig_type;
798 795
799 // For ListValue and DictionaryValue with non empty default, empty value 796 // For ListValue and DictionaryValue with non empty default, empty value
800 // for |path| needs to be persisted in |user_pref_store_|. So that 797 // for |path| needs to be persisted in |user_pref_store_|. So that
801 // non empty default is not used when user sets an empty ListValue or 798 // non empty default is not used when user sets an empty ListValue or
802 // DictionaryValue. 799 // DictionaryValue.
803 bool needs_empty_value = false; 800 bool needs_empty_value = false;
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str()); 1057 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str());
1061 } 1058 }
1062 1059
1063 bool PrefService::Preference::IsUserModifiable() const { 1060 bool PrefService::Preference::IsUserModifiable() const {
1064 return pref_value_store()->PrefValueUserModifiable(name_.c_str()); 1061 return pref_value_store()->PrefValueUserModifiable(name_.c_str());
1065 } 1062 }
1066 1063
1067 bool PrefService::Preference::IsExtensionModifiable() const { 1064 bool PrefService::Preference::IsExtensionModifiable() const {
1068 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str()); 1065 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str());
1069 } 1066 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698