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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 private: | 255 private: |
256 ~FileTokenMessageFilter() override {} | 256 ~FileTokenMessageFilter() override {} |
257 }; | 257 }; |
258 | 258 |
259 void NaClListener::Listen() { | 259 void NaClListener::Listen() { |
260 std::string channel_name = | 260 std::string channel_name = |
261 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 261 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
262 switches::kProcessChannelID); | 262 switches::kProcessChannelID); |
263 channel_ = IPC::SyncChannel::Create(this, io_thread_.task_runner().get(), | 263 channel_ = IPC::SyncChannel::Create(this, io_thread_.task_runner().get(), |
264 &shutdown_event_); | 264 &shutdown_event_); |
265 filter_ = new IPC::SyncMessageFilter(&shutdown_event_); | 265 filter_ = channel_->CreateSyncMessageFilter(); |
266 channel_->AddFilter(filter_.get()); | |
267 channel_->AddFilter(new FileTokenMessageFilter()); | 266 channel_->AddFilter(new FileTokenMessageFilter()); |
268 channel_->Init(channel_name, IPC::Channel::MODE_CLIENT, true); | 267 channel_->Init(channel_name, IPC::Channel::MODE_CLIENT, true); |
269 main_loop_ = base::MessageLoop::current(); | 268 main_loop_ = base::MessageLoop::current(); |
270 main_loop_->Run(); | 269 main_loop_->Run(); |
271 } | 270 } |
272 | 271 |
273 bool NaClListener::OnMessageReceived(const IPC::Message& msg) { | 272 bool NaClListener::OnMessageReceived(const IPC::Message& msg) { |
274 bool handled = true; | 273 bool handled = true; |
275 IPC_BEGIN_MESSAGE_MAP(NaClListener, msg) | 274 IPC_BEGIN_MESSAGE_MAP(NaClListener, msg) |
276 IPC_MESSAGE_HANDLER(NaClProcessMsg_AddPrefetchedResource, | 275 IPC_MESSAGE_HANDLER(NaClProcessMsg_AddPrefetchedResource, |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 } | 495 } |
497 | 496 |
498 void NaClListener::OnFileTokenResolved( | 497 void NaClListener::OnFileTokenResolved( |
499 uint64_t token_lo, | 498 uint64_t token_lo, |
500 uint64_t token_hi, | 499 uint64_t token_hi, |
501 IPC::PlatformFileForTransit ipc_fd, | 500 IPC::PlatformFileForTransit ipc_fd, |
502 base::FilePath file_path) { | 501 base::FilePath file_path) { |
503 resolved_cb_.Run(ipc_fd, file_path); | 502 resolved_cb_.Run(ipc_fd, file_path); |
504 resolved_cb_.Reset(); | 503 resolved_cb_.Reset(); |
505 } | 504 } |
OLD | NEW |