| 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_listener.h" | 5 #include "components/nacl/loader/nacl_listener.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 | 9 |
| 10 #if defined(OS_POSIX) | 10 #if defined(OS_POSIX) |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 } else { | 237 } else { |
| 238 // This thread does not own the channel. | 238 // This thread does not own the channel. |
| 239 return filter_->Send(msg); | 239 return filter_->Send(msg); |
| 240 } | 240 } |
| 241 } | 241 } |
| 242 | 242 |
| 243 void NaClListener::Listen() { | 243 void NaClListener::Listen() { |
| 244 std::string channel_name = | 244 std::string channel_name = |
| 245 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 245 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 246 switches::kProcessChannelID); | 246 switches::kProcessChannelID); |
| 247 channel_.reset(new IPC::SyncChannel( | 247 channel_ = IPC::SyncChannel::Create( |
| 248 this, io_thread_.message_loop_proxy().get(), &shutdown_event_)); | 248 this, io_thread_.message_loop_proxy().get(), &shutdown_event_); |
| 249 filter_ = new IPC::SyncMessageFilter(&shutdown_event_); | 249 filter_ = new IPC::SyncMessageFilter(&shutdown_event_); |
| 250 channel_->AddFilter(filter_.get()); | 250 channel_->AddFilter(filter_.get()); |
| 251 channel_->Init(channel_name, IPC::Channel::MODE_CLIENT, true); | 251 channel_->InitClient(channel_name, true); |
| 252 main_loop_ = base::MessageLoop::current(); | 252 main_loop_ = base::MessageLoop::current(); |
| 253 main_loop_->Run(); | 253 main_loop_->Run(); |
| 254 } | 254 } |
| 255 | 255 |
| 256 bool NaClListener::OnMessageReceived(const IPC::Message& msg) { | 256 bool NaClListener::OnMessageReceived(const IPC::Message& msg) { |
| 257 bool handled = true; | 257 bool handled = true; |
| 258 IPC_BEGIN_MESSAGE_MAP(NaClListener, msg) | 258 IPC_BEGIN_MESSAGE_MAP(NaClListener, msg) |
| 259 IPC_MESSAGE_HANDLER(NaClProcessMsg_Start, OnStart) | 259 IPC_MESSAGE_HANDLER(NaClProcessMsg_Start, OnStart) |
| 260 IPC_MESSAGE_UNHANDLED(handled = false) | 260 IPC_MESSAGE_UNHANDLED(handled = false) |
| 261 IPC_END_MESSAGE_MAP() | 261 IPC_END_MESSAGE_MAP() |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 args->debug_stub_server_port_selected_handler_func = | 471 args->debug_stub_server_port_selected_handler_func = |
| 472 DebugStubPortSelectedHandler; | 472 DebugStubPortSelectedHandler; |
| 473 #endif | 473 #endif |
| 474 #if defined(OS_LINUX) | 474 #if defined(OS_LINUX) |
| 475 args->prereserved_sandbox_size = prereserved_sandbox_size_; | 475 args->prereserved_sandbox_size = prereserved_sandbox_size_; |
| 476 #endif | 476 #endif |
| 477 | 477 |
| 478 NaClChromeMainStartApp(nap, args); | 478 NaClChromeMainStartApp(nap, args); |
| 479 NOTREACHED(); | 479 NOTREACHED(); |
| 480 } | 480 } |
| OLD | NEW |