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 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "ipc/message_filter.h" | 9 #include "ipc/message_filter.h" |
10 #include "native_client/src/public/chrome_main.h" | 10 #include "native_client/src/public/chrome_main.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 ~EOFMessageFilter() override {} | 31 ~EOFMessageFilter() override {} |
32 }; | 32 }; |
33 | 33 |
34 } | 34 } |
35 | 35 |
36 NaClTrustedListener::NaClTrustedListener( | 36 NaClTrustedListener::NaClTrustedListener( |
37 const IPC::ChannelHandle& handle, | 37 const IPC::ChannelHandle& handle, |
38 base::SingleThreadTaskRunner* ipc_task_runner, | 38 base::SingleThreadTaskRunner* ipc_task_runner, |
39 base::WaitableEvent* shutdown_event) | 39 base::WaitableEvent* shutdown_event) |
40 : channel_handle_(handle) { | 40 : channel_handle_(handle) { |
41 channel_ = IPC::SyncChannel::Create(handle, | 41 channel_ = |
42 IPC::Channel::MODE_SERVER, | 42 IPC::SyncChannel::Create(handle, IPC::Channel::MODE_SERVER, this, |
43 this, | 43 ipc_task_runner, true, /* create_channel_now */ |
44 ipc_task_runner, | 44 shutdown_event); |
45 true, /* create_channel_now */ | |
46 shutdown_event).Pass(); | |
47 channel_->AddFilter(new EOFMessageFilter()); | 45 channel_->AddFilter(new EOFMessageFilter()); |
48 } | 46 } |
49 | 47 |
50 NaClTrustedListener::~NaClTrustedListener() { | 48 NaClTrustedListener::~NaClTrustedListener() { |
51 } | 49 } |
52 | 50 |
53 IPC::ChannelHandle NaClTrustedListener::TakeClientChannelHandle() { | 51 IPC::ChannelHandle NaClTrustedListener::TakeClientChannelHandle() { |
54 IPC::ChannelHandle handle = channel_handle_; | 52 IPC::ChannelHandle handle = channel_handle_; |
55 #if defined(OS_POSIX) | 53 #if defined(OS_POSIX) |
56 handle.socket = | 54 handle.socket = |
57 base::FileDescriptor(channel_->TakeClientFileDescriptor()); | 55 base::FileDescriptor(channel_->TakeClientFileDescriptor()); |
58 #endif | 56 #endif |
59 return handle; | 57 return handle; |
60 } | 58 } |
61 | 59 |
62 bool NaClTrustedListener::OnMessageReceived(const IPC::Message& msg) { | 60 bool NaClTrustedListener::OnMessageReceived(const IPC::Message& msg) { |
63 return false; | 61 return false; |
64 } | 62 } |
65 | 63 |
66 bool NaClTrustedListener::Send(IPC::Message* msg) { | 64 bool NaClTrustedListener::Send(IPC::Message* msg) { |
67 return channel_->Send(msg); | 65 return channel_->Send(msg); |
68 } | 66 } |
OLD | NEW |