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 "chrome/nacl/nacl_ipc_adapter.h" | 5 #include "chrome/nacl/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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 ))); | 410 ))); |
411 break; | 411 break; |
412 } | 412 } |
413 case ppapi::proxy::SerializedHandle::CHANNEL_HANDLE: { | 413 case ppapi::proxy::SerializedHandle::CHANNEL_HANDLE: { |
414 // Check that this came from a PpapiMsg_CreateNaClChannel message. | 414 // Check that this came from a PpapiMsg_CreateNaClChannel message. |
415 // This code here is only appropriate for that message. | 415 // This code here is only appropriate for that message. |
416 DCHECK(msg.type() == PpapiMsg_CreateNaClChannel::ID); | 416 DCHECK(msg.type() == PpapiMsg_CreateNaClChannel::ID); |
417 IPC::ChannelHandle channel_handle = | 417 IPC::ChannelHandle channel_handle = |
418 IPC::Channel::GenerateVerifiedChannelID("nacl"); | 418 IPC::Channel::GenerateVerifiedChannelID("nacl"); |
419 scoped_refptr<NaClIPCAdapter> ipc_adapter( | 419 scoped_refptr<NaClIPCAdapter> ipc_adapter( |
420 new NaClIPCAdapter(channel_handle, task_runner_)); | 420 new NaClIPCAdapter(channel_handle, task_runner_.get())); |
421 ipc_adapter->ConnectChannel(); | 421 ipc_adapter->ConnectChannel(); |
422 #if defined(OS_POSIX) | 422 #if defined(OS_POSIX) |
423 channel_handle.socket = base::FileDescriptor( | 423 channel_handle.socket = base::FileDescriptor( |
424 ipc_adapter->TakeClientFileDescriptor(), true); | 424 ipc_adapter->TakeClientFileDescriptor(), true); |
425 #endif | 425 #endif |
426 nacl_desc.reset(new NaClDescWrapper(ipc_adapter->MakeNaClDesc())); | 426 nacl_desc.reset(new NaClDescWrapper(ipc_adapter->MakeNaClDesc())); |
427 // Send back a message that the channel was created. | 427 // Send back a message that the channel was created. |
428 scoped_ptr<IPC::Message> response( | 428 scoped_ptr<IPC::Message> response( |
429 new PpapiHostMsg_ChannelCreated(channel_handle)); | 429 new PpapiHostMsg_ChannelCreated(channel_handle)); |
430 task_runner_->PostTask(FROM_HERE, | 430 task_runner_->PostTask(FROM_HERE, |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 header.flags = msg.flags(); | 575 header.flags = msg.flags(); |
576 header.num_fds = static_cast<int>(rewritten_msg->desc_count()); | 576 header.num_fds = static_cast<int>(rewritten_msg->desc_count()); |
577 | 577 |
578 rewritten_msg->SetData(header, msg.payload(), msg.payload_size()); | 578 rewritten_msg->SetData(header, msg.payload(), msg.payload_size()); |
579 locked_data_.to_be_received_.push(rewritten_msg); | 579 locked_data_.to_be_received_.push(rewritten_msg); |
580 } | 580 } |
581 | 581 |
582 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags) { | 582 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags) { |
583 return TranslatePepperFileReadWriteOpenFlags(pp_open_flags); | 583 return TranslatePepperFileReadWriteOpenFlags(pp_open_flags); |
584 } | 584 } |
OLD | NEW |