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

Side by Side Diff: mojo/public/cpp/bindings/lib/pickle_buffer.cc

Issue 1518293002: [mojo] Add Mojo bindings support for IPC::ParamTraits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pickle4
Patch Set: Created 5 years 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "mojo/public/cpp/bindings/lib/pickle_buffer.h" 5 #include "mojo/public/cpp/bindings/lib/pickle_buffer.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "mojo/public/cpp/bindings/lib/bindings_serialization.h" 10 #include "mojo/public/cpp/bindings/lib/bindings_serialization.h"
(...skipping 21 matching lines...) Expand all
32 } 32 }
33 33
34 void* PickleBuffer::Allocate(size_t num_bytes) { 34 void* PickleBuffer::Allocate(size_t num_bytes) {
35 // The last allocation may terminate in between 8-byte boundaries. Pad the 35 // The last allocation may terminate in between 8-byte boundaries. Pad the
36 // front of this allocation if that's the case. 36 // front of this allocation if that's the case.
37 size_t padding_bytes = (8 - (payload_size() % 8)) % 8; 37 size_t padding_bytes = (8 - (payload_size() % 8)) % 8;
38 char* p = reinterpret_cast<char*>(ClaimBytes(padding_bytes + num_bytes)); 38 char* p = reinterpret_cast<char*>(ClaimBytes(padding_bytes + num_bytes));
39 return p + padding_bytes; 39 return p + padding_bytes;
40 } 40 }
41 41
42 PickleBuffer* PickleBuffer::AsPickleBuffer() { return this; }
43
42 } // namespace internal 44 } // namespace internal
43 } // namespace mojo 45 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/pickle_buffer.h ('k') | mojo/public/cpp/bindings/lib/string_serialization.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698