author | Bill McCloskey <billm@mozilla.com> |
Wed, 20 Apr 2016 16:10:32 -0700 | |
changeset 340376 | fff9ee7eaf1072bc237e6eaa48fb4705027cae5b |
parent 340375 | 64fcfbf2da25d2563d53fcb518fa355eb72cb2c5 |
child 340377 | 63f6395614e8085c33d552e8c56e312df5c763a3 |
push id | 1183 |
push user | raliiev@mozilla.com |
push date | Mon, 05 Sep 2016 20:01:49 +0000 |
treeherder | mozilla-release@3148731bed45 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | froydnj |
bugs | 1262671 |
milestone | 49.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
ipc/chromium/src/base/pickle.cc | file | annotate | diff | comparison | revisions | |
ipc/chromium/src/base/pickle.h | file | annotate | diff | comparison | revisions |
--- a/ipc/chromium/src/base/pickle.cc +++ b/ipc/chromium/src/base/pickle.cc @@ -572,33 +572,16 @@ char* Pickle::BeginWriteData(int length) 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(variable_buffer_offset_ != 0); - - // 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::Resize(uint32_t new_capacity) { new_capacity = ConstantAligner<kPayloadUnit>::align(new_capacity); void* p = moz_xrealloc(header_, new_capacity); header_ = reinterpret_cast<Header*>(p); capacity_ = new_capacity; }
--- a/ipc/chromium/src/base/pickle.h +++ b/ipc/chromium/src/base/pickle.h @@ -171,28 +171,16 @@ class Pickle { // Pickle. This saves a copy in cases where the data is not already // available in a buffer. The caller should take care to not write more // than the length it declares it will. Use ReadData to get the data. // Returns NULL on failure. // // The returned pointer will only be valid until the next write operation // on this Pickle. char* BeginWriteData(int length); - - // For Pickles which contain variable length buffers (e.g. those created - // with BeginWriteData), the Pickle can - // be 'trimmed' if the amount of data required is less than originally - // requested. For example, you may have created a buffer with 10K of data, - // but decided to only fill 10 bytes of that data. Use this function - // to trim the buffer so that we don't send 9990 bytes of unused data. - // You cannot increase the size of the variable buffer; only shrink it. - // This function assumes that the length of the variable buffer has - // not been changed. - void TrimWriteData(int length); - void EndRead(void* iter) const { DCHECK(iter == end_of_payload()); } // Payload follows after allocation of Header (header size is customizable). struct Header { uint32_t payload_size; // Specifies the size of the payload. };