Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: components/nacl/loader/nacl_listener.cc

Issue 1262253004: Let IPC::SyncMessageFilter take advantage of thread-safe Send. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minus some code Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/child/child_thread_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | content/child/child_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698