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

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

Issue 9016010: Implement pref_value_map swap function. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | « chrome/browser/prefs/pref_value_map.h ('k') | chrome/browser/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 "chrome/browser/prefs/pref_value_map.h" 5 #include "chrome/browser/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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 62 }
63 63
64 return false; 64 return false;
65 } 65 }
66 66
67 void PrefValueMap::Clear() { 67 void PrefValueMap::Clear() {
68 STLDeleteValues(&prefs_); 68 STLDeleteValues(&prefs_);
69 prefs_.clear(); 69 prefs_.clear();
70 } 70 }
71 71
72 void PrefValueMap::Swap(PrefValueMap* other) {
73 prefs_.swap(other->prefs_);
74 }
75
72 PrefValueMap::iterator PrefValueMap::begin() { 76 PrefValueMap::iterator PrefValueMap::begin() {
73 return prefs_.begin(); 77 return prefs_.begin();
74 } 78 }
75 79
76 PrefValueMap::iterator PrefValueMap::end() { 80 PrefValueMap::iterator PrefValueMap::end() {
77 return prefs_.end(); 81 return prefs_.end();
78 } 82 }
79 83
80 PrefValueMap::const_iterator PrefValueMap::begin() const { 84 PrefValueMap::const_iterator PrefValueMap::begin() const {
81 return prefs_.begin(); 85 return prefs_.begin();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 ++other_pref; 142 ++other_pref;
139 } 143 }
140 } 144 }
141 145
142 // Add the remaining entries. 146 // Add the remaining entries.
143 for ( ; this_pref != prefs_.end(); ++this_pref) 147 for ( ; this_pref != prefs_.end(); ++this_pref)
144 differing_keys->push_back(this_pref->first); 148 differing_keys->push_back(this_pref->first);
145 for ( ; other_pref != other->prefs_.end(); ++other_pref) 149 for ( ; other_pref != other->prefs_.end(); ++other_pref)
146 differing_keys->push_back(other_pref->first); 150 differing_keys->push_back(other_pref->first);
147 } 151 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_value_map.h ('k') | chrome/browser/prefs/pref_value_map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698