OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SYSTEM_BUFFER_H_ | 5 #ifndef MOJO_PUBLIC_CPP_SYSTEM_BUFFER_H_ |
6 #define MOJO_PUBLIC_CPP_SYSTEM_BUFFER_H_ | 6 #define MOJO_PUBLIC_CPP_SYSTEM_BUFFER_H_ |
7 | 7 |
8 #include <assert.h> | 8 #include <assert.h> |
9 | 9 |
10 #include "mojo/public/c/system/buffer.h" | 10 #include "mojo/public/c/system/buffer.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 explicit SharedBuffer(uint64_t num_bytes); | 86 explicit SharedBuffer(uint64_t num_bytes); |
87 SharedBuffer(uint64_t num_bytes, | 87 SharedBuffer(uint64_t num_bytes, |
88 const MojoCreateSharedBufferOptions& options); | 88 const MojoCreateSharedBufferOptions& options); |
89 ~SharedBuffer(); | 89 ~SharedBuffer(); |
90 | 90 |
91 ScopedSharedBufferHandle handle; | 91 ScopedSharedBufferHandle handle; |
92 }; | 92 }; |
93 | 93 |
94 inline SharedBuffer::SharedBuffer(uint64_t num_bytes) { | 94 inline SharedBuffer::SharedBuffer(uint64_t num_bytes) { |
95 MojoResult result MOJO_ALLOW_UNUSED = | 95 MojoResult result MOJO_ALLOW_UNUSED = |
96 CreateSharedBuffer(NULL, num_bytes, &handle); | 96 CreateSharedBuffer(nullptr, num_bytes, &handle); |
97 assert(result == MOJO_RESULT_OK); | 97 assert(result == MOJO_RESULT_OK); |
98 } | 98 } |
99 | 99 |
100 inline SharedBuffer::SharedBuffer( | 100 inline SharedBuffer::SharedBuffer( |
101 uint64_t num_bytes, | 101 uint64_t num_bytes, |
102 const MojoCreateSharedBufferOptions& options) { | 102 const MojoCreateSharedBufferOptions& options) { |
103 MojoResult result MOJO_ALLOW_UNUSED = | 103 MojoResult result MOJO_ALLOW_UNUSED = |
104 CreateSharedBuffer(&options, num_bytes, &handle); | 104 CreateSharedBuffer(&options, num_bytes, &handle); |
105 assert(result == MOJO_RESULT_OK); | 105 assert(result == MOJO_RESULT_OK); |
106 } | 106 } |
107 | 107 |
108 inline SharedBuffer::~SharedBuffer() { | 108 inline SharedBuffer::~SharedBuffer() { |
109 } | 109 } |
110 | 110 |
111 } // namespace mojo | 111 } // namespace mojo |
112 | 112 |
113 #endif // MOJO_PUBLIC_CPP_SYSTEM_BUFFER_H_ | 113 #endif // MOJO_PUBLIC_CPP_SYSTEM_BUFFER_H_ |
OLD | NEW |