| 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/pickle.h" | 5 #include "base/pickle.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include <algorithm> // for max() | 9 #include <algorithm> // for max() |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 memcpy(header_, other.header_, header_size_ + other.header_->payload_size); | 301 memcpy(header_, other.header_, header_size_ + other.header_->payload_size); |
| 302 } | 302 } |
| 303 | 303 |
| 304 Pickle::~Pickle() { | 304 Pickle::~Pickle() { |
| 305 if (capacity_after_header_ != kCapacityReadOnly) | 305 if (capacity_after_header_ != kCapacityReadOnly) |
| 306 free(header_); | 306 free(header_); |
| 307 } | 307 } |
| 308 | 308 |
| 309 Pickle& Pickle::operator=(const Pickle& other) { | 309 Pickle& Pickle::operator=(const Pickle& other) { |
| 310 if (this == &other) { | 310 if (this == &other) { |
| 311 NOTREACHED(); | |
| 312 return *this; | 311 return *this; |
| 313 } | 312 } |
| 314 if (capacity_after_header_ == kCapacityReadOnly) { | 313 if (capacity_after_header_ == kCapacityReadOnly) { |
| 315 header_ = NULL; | 314 header_ = NULL; |
| 316 capacity_after_header_ = 0; | 315 capacity_after_header_ = 0; |
| 317 } | 316 } |
| 318 if (header_size_ != other.header_size_) { | 317 if (header_size_ != other.header_size_) { |
| 319 free(header_); | 318 free(header_); |
| 320 header_ = NULL; | 319 header_ = NULL; |
| 321 header_size_ = other.header_size_; | 320 header_size_ = other.header_size_; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 | 472 |
| 474 inline void Pickle::WriteBytesCommon(const void* data, size_t length) { | 473 inline void Pickle::WriteBytesCommon(const void* data, size_t length) { |
| 475 DCHECK_NE(kCapacityReadOnly, capacity_after_header_) | 474 DCHECK_NE(kCapacityReadOnly, capacity_after_header_) |
| 476 << "oops: pickle is readonly"; | 475 << "oops: pickle is readonly"; |
| 477 MSAN_CHECK_MEM_IS_INITIALIZED(data, length); | 476 MSAN_CHECK_MEM_IS_INITIALIZED(data, length); |
| 478 void* write = ClaimUninitializedBytesInternal(length); | 477 void* write = ClaimUninitializedBytesInternal(length); |
| 479 memcpy(write, data, length); | 478 memcpy(write, data, length); |
| 480 } | 479 } |
| 481 | 480 |
| 482 } // namespace base | 481 } // namespace base |
| OLD | NEW |