| OLD | NEW |
| 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 Loading... |
| 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) { | 187 Value& Value::operator=(Value&& that) { |
| 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 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 } | 1324 } |
| 1326 | 1325 |
| 1327 std::ostream& operator<<(std::ostream& out, const Value::Type& type) { | 1326 std::ostream& operator<<(std::ostream& out, const Value::Type& type) { |
| 1328 if (static_cast<int>(type) < 0 || | 1327 if (static_cast<int>(type) < 0 || |
| 1329 static_cast<size_t>(type) >= arraysize(kTypeNames)) | 1328 static_cast<size_t>(type) >= arraysize(kTypeNames)) |
| 1330 return out << "Invalid Type (index = " << static_cast<int>(type) << ")"; | 1329 return out << "Invalid Type (index = " << static_cast<int>(type) << ")"; |
| 1331 return out << Value::GetTypeName(type); | 1330 return out << Value::GetTypeName(type); |
| 1332 } | 1331 } |
| 1333 | 1332 |
| 1334 } // namespace base | 1333 } // namespace base |
| OLD | NEW |