| 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_MESSAGE_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 uint8_t* mutable_payload() { return const_cast<uint8_t*>(payload()); } | 77 uint8_t* mutable_payload() { return const_cast<uint8_t*>(payload()); } |
| 78 uint32_t payload_num_bytes() const { | 78 uint32_t payload_num_bytes() const { |
| 79 MOJO_DCHECK(buffer_->data_num_bytes() >= header()->num_bytes); | 79 MOJO_DCHECK(buffer_->data_num_bytes() >= header()->num_bytes); |
| 80 return buffer_->data_num_bytes() - header()->num_bytes; | 80 return buffer_->data_num_bytes() - header()->num_bytes; |
| 81 } | 81 } |
| 82 | 82 |
| 83 // Access the handles. | 83 // Access the handles. |
| 84 const std::vector<Handle>* handles() const { return &handles_; } | 84 const std::vector<Handle>* handles() const { return &handles_; } |
| 85 std::vector<Handle>* mutable_handles() { return &handles_; } | 85 std::vector<Handle>* mutable_handles() { return &handles_; } |
| 86 | 86 |
| 87 // Access the underlying Buffer interface. | 87 // Access the underlying internal::Buffer interface. |
| 88 internal::Buffer* buffer() { return buffer_.get(); } | 88 internal::Buffer* buffer() { return buffer_.get(); } |
| 89 | 89 |
| 90 private: | 90 private: |
| 91 void Initialize(); | 91 void Initialize(); |
| 92 void CloseHandles(); | 92 void CloseHandles(); |
| 93 | 93 |
| 94 scoped_ptr<internal::PickleBuffer> buffer_; | 94 scoped_ptr<internal::PickleBuffer> buffer_; |
| 95 std::vector<Handle> handles_; | 95 std::vector<Handle> handles_; |
| 96 | 96 |
| 97 MOJO_DISALLOW_COPY_AND_ASSIGN(Message); | 97 MOJO_DISALLOW_COPY_AND_ASSIGN(Message); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 // otherwise returns an error code if something went wrong. | 164 // otherwise returns an error code if something went wrong. |
| 165 // | 165 // |
| 166 // NOTE: The message hasn't been validated and may be malformed! | 166 // NOTE: The message hasn't been validated and may be malformed! |
| 167 MojoResult ReadAndDispatchMessage(MessagePipeHandle handle, | 167 MojoResult ReadAndDispatchMessage(MessagePipeHandle handle, |
| 168 MessageReceiver* receiver, | 168 MessageReceiver* receiver, |
| 169 bool* receiver_result); | 169 bool* receiver_result); |
| 170 | 170 |
| 171 } // namespace mojo | 171 } // namespace mojo |
| 172 | 172 |
| 173 #endif // MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_ | 173 #endif // MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_ |
| OLD | NEW |