| 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 <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 }; | 218 }; |
| 219 | 219 |
| 220 void NaClListener::Listen() { | 220 void NaClListener::Listen() { |
| 221 std::string channel_name = | 221 std::string channel_name = |
| 222 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 222 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 223 switches::kProcessChannelID); | 223 switches::kProcessChannelID); |
| 224 channel_ = IPC::SyncChannel::Create(this, io_thread_.task_runner().get(), | 224 channel_ = IPC::SyncChannel::Create(this, io_thread_.task_runner().get(), |
| 225 &shutdown_event_); | 225 &shutdown_event_); |
| 226 filter_ = channel_->CreateSyncMessageFilter(); | 226 filter_ = channel_->CreateSyncMessageFilter(); |
| 227 channel_->AddFilter(new FileTokenMessageFilter()); | 227 channel_->AddFilter(new FileTokenMessageFilter()); |
| 228 channel_->Init(channel_name, IPC::Channel::MODE_CLIENT, true); | |
| 229 IPC::AttachmentBroker* global = IPC::AttachmentBroker::GetGlobal(); | 228 IPC::AttachmentBroker* global = IPC::AttachmentBroker::GetGlobal(); |
| 230 if (global && !global->IsPrivilegedBroker()) | 229 if (global && !global->IsPrivilegedBroker()) |
| 231 global->RegisterBrokerCommunicationChannel(channel_.get()); | 230 global->RegisterBrokerCommunicationChannel(channel_.get()); |
| 231 channel_->Init(channel_name, IPC::Channel::MODE_CLIENT, true); |
| 232 main_loop_ = base::MessageLoop::current(); | 232 main_loop_ = base::MessageLoop::current(); |
| 233 main_loop_->Run(); | 233 main_loop_->Run(); |
| 234 } | 234 } |
| 235 | 235 |
| 236 bool NaClListener::OnMessageReceived(const IPC::Message& msg) { | 236 bool NaClListener::OnMessageReceived(const IPC::Message& msg) { |
| 237 bool handled = true; | 237 bool handled = true; |
| 238 IPC_BEGIN_MESSAGE_MAP(NaClListener, msg) | 238 IPC_BEGIN_MESSAGE_MAP(NaClListener, msg) |
| 239 IPC_MESSAGE_HANDLER(NaClProcessMsg_AddPrefetchedResource, | 239 IPC_MESSAGE_HANDLER(NaClProcessMsg_AddPrefetchedResource, |
| 240 OnAddPrefetchedResource) | 240 OnAddPrefetchedResource) |
| 241 IPC_MESSAGE_HANDLER(NaClProcessMsg_Start, OnStart) | 241 IPC_MESSAGE_HANDLER(NaClProcessMsg_Start, OnStart) |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 } | 447 } |
| 448 | 448 |
| 449 void NaClListener::OnFileTokenResolved( | 449 void NaClListener::OnFileTokenResolved( |
| 450 uint64_t token_lo, | 450 uint64_t token_lo, |
| 451 uint64_t token_hi, | 451 uint64_t token_hi, |
| 452 IPC::PlatformFileForTransit ipc_fd, | 452 IPC::PlatformFileForTransit ipc_fd, |
| 453 base::FilePath file_path) { | 453 base::FilePath file_path) { |
| 454 resolved_cb_.Run(ipc_fd, file_path); | 454 resolved_cb_.Run(ipc_fd, file_path); |
| 455 resolved_cb_.Reset(); | 455 resolved_cb_.Reset(); |
| 456 } | 456 } |
| OLD | NEW |