diff options
author | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-30 20:32:07 +0000 |
---|---|---|
committer | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-30 20:32:07 +0000 |
commit | 7280f2f1c739cdfcd0337c6e040e05799c2b3693 (patch) | |
tree | d85a8df2cad4e31c297fc2ae5b58af401f09116f /base/pickle.cc | |
parent | 54c1529f8d9906e174a4578a5dbdef30b23d21d8 (diff) | |
download | chromium_src-7280f2f1c739cdfcd0337c6e040e05799c2b3693.zip chromium_src-7280f2f1c739cdfcd0337c6e040e05799c2b3693.tar.gz chromium_src-7280f2f1c739cdfcd0337c6e040e05799c2b3693.tar.bz2 |
Remove Pickle::BeginWriteData/TrimWriteData, it's not used
BUG=None
R=jar@chromium.org
Review URL: https://codereview.chromium.org/38693003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231911 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/pickle.cc')
-rw-r--r-- | base/pickle.cc | 50 |
1 files changed, 4 insertions, 46 deletions
diff --git a/base/pickle.cc b/base/pickle.cc index db78a4d..1d06af3 100644 --- a/base/pickle.cc +++ b/base/pickle.cc @@ -153,8 +153,7 @@ bool PickleIterator::ReadBytes(const char** data, int length) { Pickle::Pickle() : header_(NULL), header_size_(sizeof(Header)), - capacity_(0), - variable_buffer_offset_(0) { + capacity_(0) { Resize(kPayloadUnit); header_->payload_size = 0; } @@ -162,8 +161,7 @@ Pickle::Pickle() Pickle::Pickle(int header_size) : header_(NULL), header_size_(AlignInt(header_size, sizeof(uint32))), - capacity_(0), - variable_buffer_offset_(0) { + capacity_(0) { DCHECK_GE(static_cast<size_t>(header_size), sizeof(Header)); DCHECK_LE(header_size, kPayloadUnit); Resize(kPayloadUnit); @@ -173,8 +171,7 @@ Pickle::Pickle(int header_size) Pickle::Pickle(const char* data, size_t data_len) : header_(reinterpret_cast<Header*>(const_cast<char*>(data))), header_size_(0), - capacity_(kCapacityReadOnly), - variable_buffer_offset_(0) { + capacity_(kCapacityReadOnly) { if (data_len >= sizeof(Header)) header_size_ = data_len - header_->payload_size; @@ -192,8 +189,7 @@ Pickle::Pickle(const char* data, size_t data_len) Pickle::Pickle(const Pickle& other) : header_(NULL), header_size_(other.header_size_), - capacity_(0), - variable_buffer_offset_(other.variable_buffer_offset_) { + capacity_(0) { size_t payload_size = header_size_ + other.header_->payload_size; bool resized = Resize(payload_size); CHECK(resized); // Realloc failed. @@ -223,7 +219,6 @@ Pickle& Pickle::operator=(const Pickle& other) { CHECK(resized); // Realloc failed. memcpy(header_, other.header_, other.header_size_ + other.header_->payload_size); - variable_buffer_offset_ = other.variable_buffer_offset_; return *this; } @@ -267,43 +262,6 @@ bool Pickle::WriteBytes(const void* data, int data_len) { return true; } -char* Pickle::BeginWriteData(int length) { - DCHECK_EQ(variable_buffer_offset_, 0U) << - "There can only be one variable buffer in a Pickle"; - - if (length < 0 || !WriteInt(length)) - return NULL; - - char *data_ptr = BeginWrite(length); - if (!data_ptr) - return NULL; - - variable_buffer_offset_ = - data_ptr - reinterpret_cast<char*>(header_) - sizeof(int); - - // EndWrite doesn't necessarily have to be called after the write operation, - // so we call it here to pad out what the caller will eventually write. - EndWrite(data_ptr, length); - return data_ptr; -} - -void Pickle::TrimWriteData(int new_length) { - DCHECK_NE(variable_buffer_offset_, 0U); - - // Fetch the the variable buffer size - int* cur_length = reinterpret_cast<int*>( - reinterpret_cast<char*>(header_) + variable_buffer_offset_); - - if (new_length < 0 || new_length > *cur_length) { - NOTREACHED() << "Invalid length in TrimWriteData."; - return; - } - - // Update the payload size and variable buffer size - header_->payload_size -= (*cur_length - new_length); - *cur_length = new_length; -} - void Pickle::Reserve(size_t additional_capacity) { // Write at a uint32-aligned offset from the beginning of the header. size_t offset = AlignInt(header_->payload_size, sizeof(uint32)); |