| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ipc_channel_nacl.h" | 5 #include "ipc/ipc_channel_nacl.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <sys/types.h> | 9 #include <sys/types.h> |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| 33 | 33 |
| 34 bool ReadDataOnReaderThread(int pipe, MessageContents* contents) { | 34 bool ReadDataOnReaderThread(int pipe, MessageContents* contents) { |
| 35 DCHECK(pipe >= 0); | 35 DCHECK(pipe >= 0); |
| 36 if (pipe < 0) | 36 if (pipe < 0) |
| 37 return false; | 37 return false; |
| 38 | 38 |
| 39 contents->data.resize(Channel::kReadBufferSize); | 39 contents->data.resize(Channel::kReadBufferSize); |
| 40 contents->fds.resize(MessageAttachmentSet::kMaxDescriptorsPerMessage); | 40 contents->fds.resize(NACL_ABI_IMC_DESC_MAX); |
| 41 | 41 |
| 42 NaClAbiNaClImcMsgIoVec iov = { &contents->data[0], contents->data.size() }; | 42 NaClAbiNaClImcMsgIoVec iov = { &contents->data[0], contents->data.size() }; |
| 43 NaClAbiNaClImcMsgHdr msg = { | 43 NaClAbiNaClImcMsgHdr msg = { |
| 44 &iov, 1, &contents->fds[0], contents->fds.size() | 44 &iov, 1, &contents->fds[0], contents->fds.size() |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 int bytes_read = imc_recvmsg(pipe, &msg, 0); | 47 int bytes_read = imc_recvmsg(pipe, &msg, 0); |
| 48 | 48 |
| 49 if (bytes_read <= 0) { | 49 if (bytes_read <= 0) { |
| 50 // NaClIPCAdapter::BlockingReceive returns -1 when the pipe closes (either | 50 // NaClIPCAdapter::BlockingReceive returns -1 when the pipe closes (either |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 // Channel's methods | 372 // Channel's methods |
| 373 | 373 |
| 374 // static | 374 // static |
| 375 scoped_ptr<Channel> Channel::Create( | 375 scoped_ptr<Channel> Channel::Create( |
| 376 const IPC::ChannelHandle &channel_handle, Mode mode, Listener* listener) { | 376 const IPC::ChannelHandle &channel_handle, Mode mode, Listener* listener) { |
| 377 return scoped_ptr<Channel>( | 377 return scoped_ptr<Channel>( |
| 378 new ChannelNacl(channel_handle, mode, listener)); | 378 new ChannelNacl(channel_handle, mode, listener)); |
| 379 } | 379 } |
| 380 | 380 |
| 381 } // namespace IPC | 381 } // namespace IPC |
| OLD | NEW |