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

Side by Side Diff: base/values.cc

Issue 2797283002: Fixing std::swap(x, x) in base. (Closed)
Patch Set: Rebase. Created 3 years, 8 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
« no previous file with comments | « base/process/process_posix.cc ('k') | base/values_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) 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/values.h" 5 #include "base/values.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } else { 178 } else {
179 // This is not a self assignment because the type_ doesn't match. 179 // This is not a self assignment because the type_ doesn't match.
180 InternalCleanup(); 180 InternalCleanup();
181 InternalCopyConstructFrom(that); 181 InternalCopyConstructFrom(that);
182 } 182 }
183 183
184 return *this; 184 return *this;
185 } 185 }
186 186
187 Value& Value::operator=(Value&& that) noexcept { 187 Value& Value::operator=(Value&& that) noexcept {
188 DCHECK(this != &that) << "attempt to self move assign.";
189 InternalCleanup(); 188 InternalCleanup();
190 InternalMoveConstructFrom(std::move(that)); 189 InternalMoveConstructFrom(std::move(that));
191 190
192 return *this; 191 return *this;
193 } 192 }
194 193
195 Value::~Value() { 194 Value::~Value() {
196 InternalCleanup(); 195 InternalCleanup();
197 } 196 }
198 197
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 } 1342 }
1344 1343
1345 std::ostream& operator<<(std::ostream& out, const Value::Type& type) { 1344 std::ostream& operator<<(std::ostream& out, const Value::Type& type) {
1346 if (static_cast<int>(type) < 0 || 1345 if (static_cast<int>(type) < 0 ||
1347 static_cast<size_t>(type) >= arraysize(kTypeNames)) 1346 static_cast<size_t>(type) >= arraysize(kTypeNames))
1348 return out << "Invalid Type (index = " << static_cast<int>(type) << ")"; 1347 return out << "Invalid Type (index = " << static_cast<int>(type) << ")";
1349 return out << Value::GetTypeName(type); 1348 return out << Value::GetTypeName(type);
1350 } 1349 }
1351 1350
1352 } // namespace base 1351 } // namespace base
OLDNEW
« no previous file with comments | « base/process/process_posix.cc ('k') | base/values_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698