Chromium Code Reviews| 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 "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 499 nacl_desc.reset(new NaClDescWrapper(NaClDescSyncSocketMake( | 499 nacl_desc.reset(new NaClDescWrapper(NaClDescSyncSocketMake( |
| 500 #if defined(OS_WIN) | 500 #if defined(OS_WIN) |
| 501 iter->descriptor() | 501 iter->descriptor() |
| 502 #else | 502 #else |
| 503 iter->descriptor().fd | 503 iter->descriptor().fd |
| 504 #endif | 504 #endif |
| 505 ))); | 505 ))); |
| 506 break; | 506 break; |
| 507 } | 507 } |
| 508 case ppapi::proxy::SerializedHandle::CHANNEL_HANDLE: { | 508 case ppapi::proxy::SerializedHandle::CHANNEL_HANDLE: { |
| 509 // Check that this came from a PpapiMsg_CreateNaClChannel message. | 509 LOG(FATAL) << "Unexpected CreateNaClChannel"; |
| 510 // This code here is only appropriate for that message. | |
| 511 DCHECK(msg.type() == PpapiMsg_CreateNaClChannel::ID); | |
| 512 IPC::ChannelHandle channel_handle = | |
| 513 IPC::Channel::GenerateVerifiedChannelID("nacl"); | |
| 514 scoped_refptr<NaClIPCAdapter> ipc_adapter( | |
| 515 new NaClIPCAdapter(channel_handle, task_runner_.get())); | |
| 516 ipc_adapter->ConnectChannel(); | |
| 517 #if defined(OS_POSIX) | |
| 518 channel_handle.socket = base::FileDescriptor( | |
| 519 ipc_adapter->TakeClientFileDescriptor(), true); | |
| 520 #endif | |
| 521 nacl_desc.reset(new NaClDescWrapper(ipc_adapter->MakeNaClDesc())); | |
| 522 // Send back a message that the channel was created. | |
| 523 scoped_ptr<IPC::Message> response( | |
| 524 new PpapiHostMsg_NaClChannelCreated(channel_handle)); | |
|
Mark Seaborn
2014/02/03 22:59:07
Also remove the definition of PpapiHostMsg_NaClCha
| |
| 525 task_runner_->PostTask(FROM_HERE, | |
| 526 base::Bind(&NaClIPCAdapter::SendMessageOnIOThread, this, | |
| 527 base::Passed(&response))); | |
| 528 break; | 510 break; |
| 529 } | 511 } |
| 530 case ppapi::proxy::SerializedHandle::FILE: { | 512 case ppapi::proxy::SerializedHandle::FILE: { |
| 531 // Create the NaClDesc for the file descriptor. If quota checking is | 513 // Create the NaClDesc for the file descriptor. If quota checking is |
| 532 // required, wrap it in a NaClDescQuota. | 514 // required, wrap it in a NaClDescQuota. |
| 533 NaClDesc* desc = NaClDescIoDescFromHandleAllocCtor( | 515 NaClDesc* desc = NaClDescIoDescFromHandleAllocCtor( |
| 534 #if defined(OS_WIN) | 516 #if defined(OS_WIN) |
| 535 iter->descriptor(), | 517 iter->descriptor(), |
| 536 #else | 518 #else |
| 537 iter->descriptor().fd, | 519 iter->descriptor().fd, |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 687 header.flags = msg.flags(); | 669 header.flags = msg.flags(); |
| 688 header.num_fds = static_cast<int>(rewritten_msg->desc_count()); | 670 header.num_fds = static_cast<int>(rewritten_msg->desc_count()); |
| 689 | 671 |
| 690 rewritten_msg->SetData(header, msg.payload(), msg.payload_size()); | 672 rewritten_msg->SetData(header, msg.payload(), msg.payload_size()); |
| 691 locked_data_.to_be_received_.push(rewritten_msg); | 673 locked_data_.to_be_received_.push(rewritten_msg); |
| 692 } | 674 } |
| 693 | 675 |
| 694 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags) { | 676 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags) { |
| 695 return TranslatePepperFileReadWriteOpenFlags(pp_open_flags); | 677 return TranslatePepperFileReadWriteOpenFlags(pp_open_flags); |
| 696 } | 678 } |
| OLD | NEW |