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 "components/nacl/loader/nacl_trusted_listener.h" | 5 #include "components/nacl/loader/nacl_trusted_listener.h" |
6 | 6 |
7 #include "base/single_thread_task_runner.h" | 7 #include "base/single_thread_task_runner.h" |
8 | 8 |
9 NaClTrustedListener::NaClTrustedListener( | 9 NaClTrustedListener::NaClTrustedListener( |
10 const IPC::ChannelHandle& handle, | 10 const IPC::ChannelHandle& handle, |
11 base::SingleThreadTaskRunner* ipc_task_runner, | 11 base::SingleThreadTaskRunner* ipc_task_runner, |
12 base::WaitableEvent* shutdown_event) | 12 base::WaitableEvent* shutdown_event) |
13 : channel_handle_(handle) { | 13 : channel_handle_(handle) { |
14 channel_ = IPC::SyncChannel::Create(handle, | 14 channel_ = IPC::SyncChannel::Create(handle, |
15 IPC::Channel::MODE_SERVER, | 15 IPC::Channel::MODE_SERVER, |
16 this, | 16 this, |
17 ipc_task_runner, | 17 ipc_task_runner, |
18 true, /* create_channel_now */ | 18 true, /* create_channel_now */ |
19 shutdown_event).Pass(); | 19 shutdown_event).Pass(); |
20 } | 20 } |
21 | 21 |
22 NaClTrustedListener::~NaClTrustedListener() { | 22 NaClTrustedListener::~NaClTrustedListener() { |
23 } | 23 } |
24 | 24 |
25 IPC::ChannelHandle NaClTrustedListener::TakeClientChannelHandle() { | 25 IPC::ChannelHandle NaClTrustedListener::TakeClientChannelHandle() { |
26 IPC::ChannelHandle handle = channel_handle_; | 26 IPC::ChannelHandle handle = channel_handle_; |
27 #if defined(OS_POSIX) | 27 #if defined(OS_POSIX) |
28 handle.socket = | 28 handle.socket = |
29 base::FileDescriptor(channel_->TakeClientFileDescriptor(), true); | 29 base::FileDescriptor(channel_->TakeClientFileDescriptor()); |
30 #endif | 30 #endif |
31 return handle; | 31 return handle; |
32 } | 32 } |
33 | 33 |
34 bool NaClTrustedListener::OnMessageReceived(const IPC::Message& msg) { | 34 bool NaClTrustedListener::OnMessageReceived(const IPC::Message& msg) { |
35 return false; | 35 return false; |
36 } | 36 } |
37 | 37 |
38 void NaClTrustedListener::OnChannelError() { | 38 void NaClTrustedListener::OnChannelError() { |
39 channel_->Close(); | 39 channel_->Close(); |
40 } | 40 } |
41 | 41 |
42 bool NaClTrustedListener::Send(IPC::Message* msg) { | 42 bool NaClTrustedListener::Send(IPC::Message* msg) { |
43 return channel_->Send(msg); | 43 return channel_->Send(msg); |
44 } | 44 } |
OLD | NEW |