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

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

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 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_PICKLE_BUFFER_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_PICKLE_BUFFER_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_PICKLE_BUFFER_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_PICKLE_BUFFER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/pickle.h" 9 #include "base/pickle.h"
10 #include "mojo/public/cpp/bindings/lib/buffer.h" 10 #include "mojo/public/cpp/bindings/lib/buffer.h"
(...skipping 20 matching lines...) Expand all
31 } 31 }
32 32
33 size_t data_num_bytes() const { return payload_size(); } 33 size_t data_num_bytes() const { return payload_size(); }
34 34
35 // Resizes and zeroes the underlying Pickle's capacity. 35 // Resizes and zeroes the underlying Pickle's capacity.
36 void AllocData(uint32_t num_bytes); 36 void AllocData(uint32_t num_bytes);
37 37
38 // Resizes the underlying Pickle's capacity without zeroing. 38 // Resizes the underlying Pickle's capacity without zeroing.
39 void AllocUninitializedData(uint32_t num_bytes); 39 void AllocUninitializedData(uint32_t num_bytes);
40 40
41 // Buffer:
42 PickleBuffer* AsPickleBuffer() override;
43
41 private: 44 private:
42 // Buffer implementation. Note that this may grow the Pickle's capacity if 45 // Buffer implementation. Note that this may grow the Pickle's capacity if
43 // necessary, but you can avoid this by calling AllocData to preallocate when 46 // necessary, but you can avoid this by calling AllocData to preallocate when
44 // the final buffer size is known in advance. 47 // the final buffer size is known in advance.
45 // 48 //
46 // This guarantees that the returned data is aligned on an 8-byte boundary. 49 // This guarantees that the returned data is aligned on an 8-byte boundary.
47 void* Allocate(size_t num_bytes) override; 50 void* Allocate(size_t num_bytes) override;
48 51
49 // TODO(rockot): Stop wasting 8 bytes per buffer. 52 // TODO(rockot): Stop wasting 8 bytes per buffer.
50 // 53 //
(...skipping 19 matching lines...) Expand all
70 // claim memory. 73 // claim memory.
71 size_t allocation_cursor_ = 0; 74 size_t allocation_cursor_ = 0;
72 75
73 DISALLOW_COPY_AND_ASSIGN(PickleBuffer); 76 DISALLOW_COPY_AND_ASSIGN(PickleBuffer);
74 }; 77 };
75 78
76 } // namespace internal 79 } // namespace internal
77 } // namespace mojo 80 } // namespace mojo
78 81
79 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_PICKLE_BUFFER_H_ 82 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_PICKLE_BUFFER_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/native_serialization.h ('k') | mojo/public/cpp/bindings/lib/pickle_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698