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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 base::FilePath file_path) { | 243 base::FilePath file_path) { |
244 CHECK(g_listener); | 244 CHECK(g_listener); |
245 g_listener->OnFileTokenResolved(token_lo, token_hi, ipc_fd, file_path); | 245 g_listener->OnFileTokenResolved(token_lo, token_hi, ipc_fd, file_path); |
246 } | 246 } |
247 private: | 247 private: |
248 ~FileTokenMessageFilter() override {} | 248 ~FileTokenMessageFilter() override {} |
249 }; | 249 }; |
250 | 250 |
251 void NaClListener::Listen() { | 251 void NaClListener::Listen() { |
252 std::string channel_name = | 252 std::string channel_name = |
253 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 253 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
254 switches::kProcessChannelID); | 254 switches::kProcessChannelID); |
255 channel_ = IPC::SyncChannel::Create( | 255 channel_ = IPC::SyncChannel::Create( |
256 this, io_thread_.message_loop_proxy().get(), &shutdown_event_); | 256 this, io_thread_.message_loop_proxy().get(), &shutdown_event_); |
257 filter_ = new IPC::SyncMessageFilter(&shutdown_event_); | 257 filter_ = new IPC::SyncMessageFilter(&shutdown_event_); |
258 channel_->AddFilter(filter_.get()); | 258 channel_->AddFilter(filter_.get()); |
259 channel_->AddFilter(new FileTokenMessageFilter()); | 259 channel_->AddFilter(new FileTokenMessageFilter()); |
260 channel_->Init(channel_name, IPC::Channel::MODE_CLIENT, true); | 260 channel_->Init(channel_name, IPC::Channel::MODE_CLIENT, true); |
261 main_loop_ = base::MessageLoop::current(); | 261 main_loop_ = base::MessageLoop::current(); |
262 main_loop_->Run(); | 262 main_loop_->Run(); |
263 } | 263 } |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 } | 445 } |
446 | 446 |
447 void NaClListener::OnFileTokenResolved( | 447 void NaClListener::OnFileTokenResolved( |
448 uint64_t token_lo, | 448 uint64_t token_lo, |
449 uint64_t token_hi, | 449 uint64_t token_hi, |
450 IPC::PlatformFileForTransit ipc_fd, | 450 IPC::PlatformFileForTransit ipc_fd, |
451 base::FilePath file_path) { | 451 base::FilePath file_path) { |
452 resolved_cb_.Run(ipc_fd, file_path); | 452 resolved_cb_.Run(ipc_fd, file_path); |
453 resolved_cb_.Reset(); | 453 resolved_cb_.Reset(); |
454 } | 454 } |
OLD | NEW |