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

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

Issue 390233003: Decrement CreateDoubleValue count (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 5 months 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 | « base/prefs/pref_value_map.h ('k') | base/prefs/pref_value_map_unittest.cc » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/pref_value_map.h" 5 #include "base/prefs/pref_value_map.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 bool PrefValueMap::GetInteger(const std::string& key, int* value) const { 114 bool PrefValueMap::GetInteger(const std::string& key, int* value) const {
115 const base::Value* stored_value = NULL; 115 const base::Value* stored_value = NULL;
116 return GetValue(key, &stored_value) && stored_value->GetAsInteger(value); 116 return GetValue(key, &stored_value) && stored_value->GetAsInteger(value);
117 } 117 }
118 118
119 void PrefValueMap::SetInteger(const std::string& key, const int value) { 119 void PrefValueMap::SetInteger(const std::string& key, const int value) {
120 SetValue(key, new base::FundamentalValue(value)); 120 SetValue(key, new base::FundamentalValue(value));
121 } 121 }
122 122
123 void PrefValueMap::SetDouble(const std::string& key, const double value) {
124 SetValue(key, new base::FundamentalValue(value));
125 }
126
123 void PrefValueMap::GetDifferingKeys( 127 void PrefValueMap::GetDifferingKeys(
124 const PrefValueMap* other, 128 const PrefValueMap* other,
125 std::vector<std::string>* differing_keys) const { 129 std::vector<std::string>* differing_keys) const {
126 differing_keys->clear(); 130 differing_keys->clear();
127 131
128 // Walk over the maps in lockstep, adding everything that is different. 132 // Walk over the maps in lockstep, adding everything that is different.
129 Map::const_iterator this_pref(prefs_.begin()); 133 Map::const_iterator this_pref(prefs_.begin());
130 Map::const_iterator other_pref(other->prefs_.begin()); 134 Map::const_iterator other_pref(other->prefs_.begin());
131 while (this_pref != prefs_.end() && other_pref != other->prefs_.end()) { 135 while (this_pref != prefs_.end() && other_pref != other->prefs_.end()) {
132 const int diff = this_pref->first.compare(other_pref->first); 136 const int diff = this_pref->first.compare(other_pref->first);
(...skipping 10 matching lines...) Expand all
143 ++other_pref; 147 ++other_pref;
144 } 148 }
145 } 149 }
146 150
147 // Add the remaining entries. 151 // Add the remaining entries.
148 for ( ; this_pref != prefs_.end(); ++this_pref) 152 for ( ; this_pref != prefs_.end(); ++this_pref)
149 differing_keys->push_back(this_pref->first); 153 differing_keys->push_back(this_pref->first);
150 for ( ; other_pref != other->prefs_.end(); ++other_pref) 154 for ( ; other_pref != other->prefs_.end(); ++other_pref)
151 differing_keys->push_back(other_pref->first); 155 differing_keys->push_back(other_pref->first);
152 } 156 }
OLDNEW
« no previous file with comments | « base/prefs/pref_value_map.h ('k') | base/prefs/pref_value_map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698