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_BINDINGS_LIB_FIXED_BUFFER_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_FIXED_BUFFER_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_FIXED_BUFFER_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_FIXED_BUFFER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
| 10 #include "base/compiler_specific.h" |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "mojo/public/cpp/bindings/bindings_export.h" |
11 #include "mojo/public/cpp/bindings/lib/buffer.h" | 13 #include "mojo/public/cpp/bindings/lib/buffer.h" |
12 | 14 |
13 namespace mojo { | 15 namespace mojo { |
14 namespace internal { | 16 namespace internal { |
15 | 17 |
16 // FixedBufferForTesting owns its buffer. The Leak method may be used to steal | 18 // FixedBufferForTesting owns its buffer. The Leak method may be used to steal |
17 // the underlying memory. | 19 // the underlying memory. |
18 class FixedBufferForTesting : public Buffer { | 20 class MOJO_CPP_BINDINGS_EXPORT FixedBufferForTesting |
| 21 : NON_EXPORTED_BASE(public Buffer) { |
19 public: | 22 public: |
20 explicit FixedBufferForTesting(size_t size); | 23 explicit FixedBufferForTesting(size_t size); |
21 ~FixedBufferForTesting(); | 24 ~FixedBufferForTesting(); |
22 | 25 |
23 // Returns the internal memory owned by the Buffer to the caller. The Buffer | 26 // Returns the internal memory owned by the Buffer to the caller. The Buffer |
24 // relinquishes its pointer, effectively resetting the state of the Buffer | 27 // relinquishes its pointer, effectively resetting the state of the Buffer |
25 // and leaving the caller responsible for freeing the returned memory address | 28 // and leaving the caller responsible for freeing the returned memory address |
26 // when no longer needed. | 29 // when no longer needed. |
27 void* Leak(); | 30 void* Leak(); |
28 | 31 |
29 private: | 32 private: |
30 DISALLOW_COPY_AND_ASSIGN(FixedBufferForTesting); | 33 DISALLOW_COPY_AND_ASSIGN(FixedBufferForTesting); |
31 }; | 34 }; |
32 | 35 |
33 } // namespace internal | 36 } // namespace internal |
34 } // namespace mojo | 37 } // namespace mojo |
35 | 38 |
36 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_FIXED_BUFFER_H_ | 39 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_FIXED_BUFFER_H_ |
OLD | NEW |