OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_MESSAGE_LIB_MESSAGE_BUFFER_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_LIB_MESSAGE_BUFFER_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_LIB_MESSAGE_BUFFER_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_LIB_MESSAGE_BUFFER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 ~MessageBuffer() override; | 29 ~MessageBuffer() override; |
30 | 30 |
31 void* data() const { return buffer_; } | 31 void* data() const { return buffer_; } |
32 uint32_t data_num_bytes() const { return data_num_bytes_; } | 32 uint32_t data_num_bytes() const { return data_num_bytes_; } |
33 | 33 |
34 // Buffer: | 34 // Buffer: |
35 void* Allocate(size_t delta) override; | 35 void* Allocate(size_t delta) override; |
36 | 36 |
37 ScopedMessageHandle TakeMessage() { return std::move(message_); } | 37 ScopedMessageHandle TakeMessage() { return std::move(message_); } |
38 | 38 |
| 39 void NotifyBadMessage(const std::string& error); |
| 40 |
39 private: | 41 private: |
40 uint32_t data_num_bytes_ = 0; | 42 uint32_t data_num_bytes_ = 0; |
41 ScopedMessageHandle message_; | 43 ScopedMessageHandle message_; |
42 void* buffer_; | 44 void* buffer_; |
43 | 45 |
44 uint32_t bytes_claimed_ = 0; | 46 uint32_t bytes_claimed_ = 0; |
45 | 47 |
46 DISALLOW_COPY_AND_ASSIGN(MessageBuffer); | 48 DISALLOW_COPY_AND_ASSIGN(MessageBuffer); |
47 }; | 49 }; |
48 | 50 |
49 } // namespace internal | 51 } // namespace internal |
50 } // namespace mojo | 52 } // namespace mojo |
51 | 53 |
52 #endif // MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_LIB_MESSAGE_BUFFER_H_ | 54 #endif // MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_LIB_MESSAGE_BUFFER_H_ |
OLD | NEW |