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

Side by Side Diff: base/pickle.cc

Issue 2504063002: Revert of Remove IPC::BrokerableAttachment. (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | components/nacl/loader/nacl_ipc_adapter.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/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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 AddInt(); 226 AddInt();
227 AddBytes(length); 227 AddBytes(length);
228 } 228 }
229 229
230 void PickleSizer::AddBytes(int length) { 230 void PickleSizer::AddBytes(int length) {
231 payload_size_ += bits::Align(length, sizeof(uint32_t)); 231 payload_size_ += bits::Align(length, sizeof(uint32_t));
232 } 232 }
233 233
234 void PickleSizer::AddAttachment() { 234 void PickleSizer::AddAttachment() {
235 // From IPC::Message::WriteAttachment 235 // From IPC::Message::WriteAttachment
236 AddBool();
236 AddInt(); 237 AddInt();
237 } 238 }
238 239
239 template <size_t length> void PickleSizer::AddBytesStatic() { 240 template <size_t length> void PickleSizer::AddBytesStatic() {
240 DCHECK_LE(length, static_cast<size_t>(std::numeric_limits<int>::max())); 241 DCHECK_LE(length, static_cast<size_t>(std::numeric_limits<int>::max()));
241 AddBytes(length); 242 AddBytes(length);
242 } 243 }
243 244
244 template void PickleSizer::AddBytesStatic<2>(); 245 template void PickleSizer::AddBytesStatic<2>();
245 template void PickleSizer::AddBytesStatic<4>(); 246 template void PickleSizer::AddBytesStatic<4>();
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 474
474 inline void Pickle::WriteBytesCommon(const void* data, size_t length) { 475 inline void Pickle::WriteBytesCommon(const void* data, size_t length) {
475 DCHECK_NE(kCapacityReadOnly, capacity_after_header_) 476 DCHECK_NE(kCapacityReadOnly, capacity_after_header_)
476 << "oops: pickle is readonly"; 477 << "oops: pickle is readonly";
477 MSAN_CHECK_MEM_IS_INITIALIZED(data, length); 478 MSAN_CHECK_MEM_IS_INITIALIZED(data, length);
478 void* write = ClaimUninitializedBytesInternal(length); 479 void* write = ClaimUninitializedBytesInternal(length);
479 memcpy(write, data, length); 480 memcpy(write, data, length);
480 } 481 }
481 482
482 } // namespace base 483 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | components/nacl/loader/nacl_ipc_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698