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 #include "ipc/mojo/ipc_channel_mojo_readers.h" | 5 #include "ipc/mojo/ipc_channel_mojo_readers.h" |
6 | 6 |
7 #include "ipc/mojo/ipc_channel_mojo.h" | 7 #include "ipc/mojo/ipc_channel_mojo.h" |
8 #include "mojo/embedder/embedder.h" | 8 #include "mojo/embedder/embedder.h" |
9 | 9 |
10 #if defined(OS_POSIX) && !defined(OS_NACL) | 10 #if defined(OS_POSIX) && !defined(OS_NACL) |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 owner_->OnPipeError(this); | 131 owner_->OnPipeError(this); |
132 } | 132 } |
133 | 133 |
134 bool MessageReader::Send(scoped_ptr<Message> message) { | 134 bool MessageReader::Send(scoped_ptr<Message> message) { |
135 DCHECK(IsValid()); | 135 DCHECK(IsValid()); |
136 | 136 |
137 message->TraceMessageBegin(); | 137 message->TraceMessageBegin(); |
138 std::vector<MojoHandle> handles; | 138 std::vector<MojoHandle> handles; |
139 #if defined(OS_POSIX) && !defined(OS_NACL) | 139 #if defined(OS_POSIX) && !defined(OS_NACL) |
140 MojoResult read_result = | 140 MojoResult read_result = |
141 ChannelMojo::ReadFromFileDescriptorSet(*message, &handles); | 141 ChannelMojo::ReadFromFileDescriptorSet(message.get(), &handles); |
142 if (read_result != MOJO_RESULT_OK) { | 142 if (read_result != MOJO_RESULT_OK) { |
143 std::for_each(handles.begin(), handles.end(), &MojoClose); | 143 std::for_each(handles.begin(), handles.end(), &MojoClose); |
144 CloseWithError(read_result); | 144 CloseWithError(read_result); |
145 return false; | 145 return false; |
146 } | 146 } |
147 #endif | 147 #endif |
148 MojoResult write_result = | 148 MojoResult write_result = |
149 MojoWriteMessage(handle(), | 149 MojoWriteMessage(handle(), |
150 message->data(), | 150 message->data(), |
151 static_cast<uint32>(message->size()), | 151 static_cast<uint32>(message->size()), |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 312 |
313 MojoResult result = RespondHelloRequest(handle_buffer[0]); | 313 MojoResult result = RespondHelloRequest(handle_buffer[0]); |
314 if (result != MOJO_RESULT_OK) { | 314 if (result != MOJO_RESULT_OK) { |
315 DLOG(ERROR) << "Failed to respond Hello request. Closing: " << result; | 315 DLOG(ERROR) << "Failed to respond Hello request. Closing: " << result; |
316 CloseWithError(result); | 316 CloseWithError(result); |
317 } | 317 } |
318 } | 318 } |
319 | 319 |
320 } // namespace internal | 320 } // namespace internal |
321 } // namespace IPC | 321 } // namespace IPC |
OLD | NEW |