| 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_listener.h" | 5 #include "chrome/nacl/nacl_listener.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 return filter_->Send(msg); | 150 return filter_->Send(msg); |
| 151 } | 151 } |
| 152 } | 152 } |
| 153 | 153 |
| 154 void NaClListener::Listen() { | 154 void NaClListener::Listen() { |
| 155 std::string channel_name = | 155 std::string channel_name = |
| 156 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 156 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 157 switches::kProcessChannelID); | 157 switches::kProcessChannelID); |
| 158 channel_.reset(new IPC::SyncChannel(this, io_thread_.message_loop_proxy(), | 158 channel_.reset(new IPC::SyncChannel(this, io_thread_.message_loop_proxy(), |
| 159 &shutdown_event_)); | 159 &shutdown_event_)); |
| 160 filter_.reset(new IPC::SyncMessageFilter(&shutdown_event_)); | 160 filter_ = new IPC::SyncMessageFilter(&shutdown_event_); |
| 161 channel_->AddFilter(filter_.get()); | 161 channel_->AddFilter(filter_.get()); |
| 162 channel_->Init(channel_name, IPC::Channel::MODE_CLIENT, true); | 162 channel_->Init(channel_name, IPC::Channel::MODE_CLIENT, true); |
| 163 main_loop_ = MessageLoop::current(); | 163 main_loop_ = MessageLoop::current(); |
| 164 main_loop_->Run(); | 164 main_loop_->Run(); |
| 165 } | 165 } |
| 166 | 166 |
| 167 bool NaClListener::OnMessageReceived(const IPC::Message& msg) { | 167 bool NaClListener::OnMessageReceived(const IPC::Message& msg) { |
| 168 bool handled = true; | 168 bool handled = true; |
| 169 IPC_BEGIN_MESSAGE_MAP(NaClListener, msg) | 169 IPC_BEGIN_MESSAGE_MAP(NaClListener, msg) |
| 170 IPC_MESSAGE_HANDLER(NaClProcessMsg_Start, OnMsgStart) | 170 IPC_MESSAGE_HANDLER(NaClProcessMsg_Start, OnMsgStart) |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 CHECK(handles.size() == 1); | 217 CHECK(handles.size() == 1); |
| 218 args->imc_bootstrap_handle = nacl::ToNativeHandle(handles[0]); | 218 args->imc_bootstrap_handle = nacl::ToNativeHandle(handles[0]); |
| 219 args->enable_exception_handling = params.enable_exception_handling; | 219 args->enable_exception_handling = params.enable_exception_handling; |
| 220 args->enable_debug_stub = debug_enabled_; | 220 args->enable_debug_stub = debug_enabled_; |
| 221 #if defined(OS_WIN) | 221 #if defined(OS_WIN) |
| 222 args->broker_duplicate_handle_func = BrokerDuplicateHandle; | 222 args->broker_duplicate_handle_func = BrokerDuplicateHandle; |
| 223 #endif | 223 #endif |
| 224 NaClChromeMainStart(args); | 224 NaClChromeMainStart(args); |
| 225 NOTREACHED(); | 225 NOTREACHED(); |
| 226 } | 226 } |
| OLD | NEW |