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 "components/nacl/loader/nacl_ipc_adapter.h" | 5 #include "components/nacl/loader/nacl_ipc_adapter.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 } | 471 } |
472 | 472 |
473 task_runner_->PostTask(FROM_HERE, | 473 task_runner_->PostTask(FROM_HERE, |
474 base::Bind(&NaClIPCAdapter::CloseChannelOnIOThread, this)); | 474 base::Bind(&NaClIPCAdapter::CloseChannelOnIOThread, this)); |
475 } | 475 } |
476 | 476 |
477 NaClDesc* NaClIPCAdapter::MakeNaClDesc() { | 477 NaClDesc* NaClIPCAdapter::MakeNaClDesc() { |
478 return MakeNaClDescCustom(this); | 478 return MakeNaClDescCustom(this); |
479 } | 479 } |
480 | 480 |
481 #if defined(OS_POSIX) | |
482 base::ScopedFD NaClIPCAdapter::TakeClientFileDescriptor() { | |
483 return io_thread_data_.channel_->TakeClientFileDescriptor(); | |
484 } | |
485 #endif | |
486 | |
487 bool NaClIPCAdapter::OnMessageReceived(const IPC::Message& msg) { | 481 bool NaClIPCAdapter::OnMessageReceived(const IPC::Message& msg) { |
488 uint32_t type = msg.type(); | 482 uint32_t type = msg.type(); |
489 | 483 |
490 if (type == IPC_REPLY_ID) { | 484 if (type == IPC_REPLY_ID) { |
491 int id = IPC::SyncMessage::GetMessageId(msg); | 485 int id = IPC::SyncMessage::GetMessageId(msg); |
492 IOThreadData::PendingSyncMsgMap::iterator it = | 486 IOThreadData::PendingSyncMsgMap::iterator it = |
493 io_thread_data_.pending_sync_msgs_.find(id); | 487 io_thread_data_.pending_sync_msgs_.find(id); |
494 DCHECK(it != io_thread_data_.pending_sync_msgs_.end()); | 488 DCHECK(it != io_thread_data_.pending_sync_msgs_.end()); |
495 if (it != io_thread_data_.pending_sync_msgs_.end()) { | 489 if (it != io_thread_data_.pending_sync_msgs_.end()) { |
496 type = it->second; | 490 type = it->second; |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 header.flags = msg.flags(); | 842 header.flags = msg.flags(); |
849 header.num_fds = static_cast<uint16_t>(rewritten_msg->desc_count()); | 843 header.num_fds = static_cast<uint16_t>(rewritten_msg->desc_count()); |
850 | 844 |
851 rewritten_msg->SetData(header, msg.payload(), msg.payload_size()); | 845 rewritten_msg->SetData(header, msg.payload(), msg.payload_size()); |
852 locked_data_.to_be_received_.push(rewritten_msg); | 846 locked_data_.to_be_received_.push(rewritten_msg); |
853 } | 847 } |
854 | 848 |
855 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags) { | 849 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags) { |
856 return TranslatePepperFileReadWriteOpenFlags(pp_open_flags); | 850 return TranslatePepperFileReadWriteOpenFlags(pp_open_flags); |
857 } | 851 } |
OLD | NEW |