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

Side by Side Diff: base/pickle.cc

Issue 1966983003: Generate param traits size methods for IPC files in content/ (and traits it depends on). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix owners Created 4 years, 7 months 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 | « base/pickle.h ('k') | content/common/cc_messages.h » ('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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 void PickleSizer::AddData(int length) { 224 void PickleSizer::AddData(int length) {
225 CHECK_GE(length, 0); 225 CHECK_GE(length, 0);
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() {
235 // From IPC::Message::WriteAttachment
236 AddBool();
237 AddInt();
238 }
239
234 template <size_t length> void PickleSizer::AddBytesStatic() { 240 template <size_t length> void PickleSizer::AddBytesStatic() {
235 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()));
236 AddBytes(length); 242 AddBytes(length);
237 } 243 }
238 244
239 template void PickleSizer::AddBytesStatic<2>(); 245 template void PickleSizer::AddBytesStatic<2>();
240 template void PickleSizer::AddBytesStatic<4>(); 246 template void PickleSizer::AddBytesStatic<4>();
241 template void PickleSizer::AddBytesStatic<8>(); 247 template void PickleSizer::AddBytesStatic<8>();
242 248
243 Pickle::Attachment::Attachment() {} 249 Pickle::Attachment::Attachment() {}
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 474
469 inline void Pickle::WriteBytesCommon(const void* data, size_t length) { 475 inline void Pickle::WriteBytesCommon(const void* data, size_t length) {
470 DCHECK_NE(kCapacityReadOnly, capacity_after_header_) 476 DCHECK_NE(kCapacityReadOnly, capacity_after_header_)
471 << "oops: pickle is readonly"; 477 << "oops: pickle is readonly";
472 MSAN_CHECK_MEM_IS_INITIALIZED(data, length); 478 MSAN_CHECK_MEM_IS_INITIALIZED(data, length);
473 void* write = ClaimUninitializedBytesInternal(length); 479 void* write = ClaimUninitializedBytesInternal(length);
474 memcpy(write, data, length); 480 memcpy(write, data, length);
475 } 481 }
476 482
477 } // namespace base 483 } // namespace base
OLDNEW
« no previous file with comments | « base/pickle.h ('k') | content/common/cc_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698