| 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/system/message_pipe.h" | 5 #include "mojo/system/message_pipe.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "mojo/system/channel.h" | 8 #include "mojo/system/channel.h" |
| 9 #include "mojo/system/local_message_pipe_endpoint.h" | 9 #include "mojo/system/local_message_pipe_endpoint.h" |
| 10 #include "mojo/system/message_in_transit.h" | 10 #include "mojo/system/message_in_transit.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 if (endpoints_[destination_port]) { | 60 if (endpoints_[destination_port]) { |
| 61 if (!endpoints_[destination_port]->OnPeerClose()) | 61 if (!endpoints_[destination_port]->OnPeerClose()) |
| 62 endpoints_[destination_port].reset(); | 62 endpoints_[destination_port].reset(); |
| 63 } | 63 } |
| 64 endpoints_[port].reset(); | 64 endpoints_[port].reset(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 // TODO(vtl): Handle flags. | 67 // TODO(vtl): Handle flags. |
| 68 MojoResult MessagePipe::WriteMessage( | 68 MojoResult MessagePipe::WriteMessage( |
| 69 unsigned port, | 69 unsigned port, |
| 70 const void* bytes, | 70 UserPointer<const void> bytes, |
| 71 uint32_t num_bytes, | 71 uint32_t num_bytes, |
| 72 std::vector<DispatcherTransport>* transports, | 72 std::vector<DispatcherTransport>* transports, |
| 73 MojoWriteMessageFlags flags) { | 73 MojoWriteMessageFlags flags) { |
| 74 DCHECK(port == 0 || port == 1); | 74 DCHECK(port == 0 || port == 1); |
| 75 return EnqueueMessageInternal( | 75 return EnqueueMessageInternal( |
| 76 GetPeerPort(port), | 76 GetPeerPort(port), |
| 77 make_scoped_ptr(new MessageInTransit( | 77 make_scoped_ptr(new MessageInTransit( |
| 78 MessageInTransit::kTypeMessagePipeEndpoint, | 78 MessageInTransit::kTypeMessagePipeEndpoint, |
| 79 MessageInTransit::kSubtypeMessagePipeEndpointData, | 79 MessageInTransit::kSubtypeMessagePipeEndpointData, num_bytes, bytes)), |
| 80 num_bytes, | |
| 81 bytes)), | |
| 82 transports); | 80 transports); |
| 83 } | 81 } |
| 84 | 82 |
| 85 MojoResult MessagePipe::ReadMessage(unsigned port, | 83 MojoResult MessagePipe::ReadMessage(unsigned port, |
| 86 UserPointer<void> bytes, | 84 UserPointer<void> bytes, |
| 87 UserPointer<uint32_t> num_bytes, | 85 UserPointer<uint32_t> num_bytes, |
| 88 DispatcherVector* dispatchers, | 86 DispatcherVector* dispatchers, |
| 89 uint32_t* num_dispatchers, | 87 uint32_t* num_dispatchers, |
| 90 MojoReadMessageFlags flags) { | 88 MojoReadMessageFlags flags) { |
| 91 DCHECK(port == 0 || port == 1); | 89 DCHECK(port == 0 || port == 1); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 MojoResult MessagePipe::HandleControlMessage( | 274 MojoResult MessagePipe::HandleControlMessage( |
| 277 unsigned /*port*/, | 275 unsigned /*port*/, |
| 278 scoped_ptr<MessageInTransit> message) { | 276 scoped_ptr<MessageInTransit> message) { |
| 279 LOG(WARNING) << "Unrecognized MessagePipe control message subtype " | 277 LOG(WARNING) << "Unrecognized MessagePipe control message subtype " |
| 280 << message->subtype(); | 278 << message->subtype(); |
| 281 return MOJO_RESULT_UNKNOWN; | 279 return MOJO_RESULT_UNKNOWN; |
| 282 } | 280 } |
| 283 | 281 |
| 284 } // namespace system | 282 } // namespace system |
| 285 } // namespace mojo | 283 } // namespace mojo |
| OLD | NEW |