| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "mojo/public/cpp/bindings/message.h" | 5 #include "mojo/public/cpp/bindings/message.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 | 10 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 void* new_buffer = nullptr; | 71 void* new_buffer = nullptr; |
| 72 rv = GetMessageBuffer(new_message.get(), &new_buffer); | 72 rv = GetMessageBuffer(new_message.get(), &new_buffer); |
| 73 CHECK_EQ(rv, MOJO_RESULT_OK); | 73 CHECK_EQ(rv, MOJO_RESULT_OK); |
| 74 | 74 |
| 75 memcpy(new_buffer, data(), data_num_bytes()); | 75 memcpy(new_buffer, data(), data_num_bytes()); |
| 76 buffer_.reset(); | 76 buffer_.reset(); |
| 77 | 77 |
| 78 return new_message; | 78 return new_message; |
| 79 } | 79 } |
| 80 | 80 |
| 81 void Message::NotifyBadMessage(const std::string& error) { |
| 82 buffer_->NotifyBadMessage(error); |
| 83 } |
| 84 |
| 81 void Message::CloseHandles() { | 85 void Message::CloseHandles() { |
| 82 for (std::vector<Handle>::iterator it = handles_.begin(); | 86 for (std::vector<Handle>::iterator it = handles_.begin(); |
| 83 it != handles_.end(); ++it) { | 87 it != handles_.end(); ++it) { |
| 84 if (it->is_valid()) | 88 if (it->is_valid()) |
| 85 CloseRaw(*it); | 89 CloseRaw(*it); |
| 86 } | 90 } |
| 87 } | 91 } |
| 88 | 92 |
| 89 MojoResult ReadMessage(MessagePipeHandle handle, Message* message) { | 93 MojoResult ReadMessage(MessagePipeHandle handle, Message* message) { |
| 90 MojoResult rv; | 94 MojoResult rv; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 111 | 115 |
| 112 if (rv != MOJO_RESULT_OK) | 116 if (rv != MOJO_RESULT_OK) |
| 113 return rv; | 117 return rv; |
| 114 | 118 |
| 115 message->InitializeFromMojoMessage( | 119 message->InitializeFromMojoMessage( |
| 116 std::move(mojo_message), num_bytes, &handles); | 120 std::move(mojo_message), num_bytes, &handles); |
| 117 return MOJO_RESULT_OK; | 121 return MOJO_RESULT_OK; |
| 118 } | 122 } |
| 119 | 123 |
| 120 } // namespace mojo | 124 } // namespace mojo |
| OLD | NEW |