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

Side by Side Diff: ppapi/nacl_irt/ppapi_dispatcher.cc

Issue 1174543002: ppapi: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix V8VarConverterTest. Created 5 years, 6 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 | « ppapi/nacl_irt/ppapi_dispatcher.h ('k') | ppapi/proxy/message_handler.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ppapi/nacl_irt/ppapi_dispatcher.h" 5 #include "ppapi/nacl_irt/ppapi_dispatcher.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/single_thread_task_runner.h"
13 #include "base/synchronization/waitable_event.h" 13 #include "base/synchronization/waitable_event.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "components/tracing/child_trace_message_filter.h" 15 #include "components/tracing/child_trace_message_filter.h"
16 #include "ipc/ipc_channel_handle.h" 16 #include "ipc/ipc_channel_handle.h"
17 #include "ipc/ipc_logging.h" 17 #include "ipc/ipc_logging.h"
18 #include "ipc/ipc_message.h" 18 #include "ipc/ipc_message.h"
19 #include "ppapi/c/ppp.h" 19 #include "ppapi/c/ppp.h"
20 #include "ppapi/c/ppp_instance.h" 20 #include "ppapi/c/ppp_instance.h"
21 #include "ppapi/nacl_irt/manifest_service.h" 21 #include "ppapi/nacl_irt/manifest_service.h"
22 #include "ppapi/nacl_irt/plugin_startup.h" 22 #include "ppapi/nacl_irt/plugin_startup.h"
23 #include "ppapi/proxy/plugin_dispatcher.h" 23 #include "ppapi/proxy/plugin_dispatcher.h"
24 #include "ppapi/proxy/plugin_globals.h" 24 #include "ppapi/proxy/plugin_globals.h"
25 #include "ppapi/proxy/plugin_message_filter.h" 25 #include "ppapi/proxy/plugin_message_filter.h"
26 #include "ppapi/proxy/plugin_proxy_delegate.h" 26 #include "ppapi/proxy/plugin_proxy_delegate.h"
27 #include "ppapi/proxy/ppapi_messages.h" 27 #include "ppapi/proxy/ppapi_messages.h"
28 #include "ppapi/proxy/resource_reply_thread_registrar.h" 28 #include "ppapi/proxy/resource_reply_thread_registrar.h"
29 29
30 namespace ppapi { 30 namespace ppapi {
31 31
32 PpapiDispatcher::PpapiDispatcher(scoped_refptr<base::MessageLoopProxy> io_loop, 32 PpapiDispatcher::PpapiDispatcher(
33 base::WaitableEvent* shutdown_event, 33 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
34 int browser_ipc_fd, 34 base::WaitableEvent* shutdown_event,
35 int renderer_ipc_fd) 35 int browser_ipc_fd,
36 int renderer_ipc_fd)
36 : next_plugin_dispatcher_id_(0), 37 : next_plugin_dispatcher_id_(0),
37 message_loop_(io_loop), 38 task_runner_(io_task_runner),
38 shutdown_event_(shutdown_event), 39 shutdown_event_(shutdown_event),
39 renderer_ipc_fd_(renderer_ipc_fd) { 40 renderer_ipc_fd_(renderer_ipc_fd) {
40 IPC::ChannelHandle channel_handle( 41 IPC::ChannelHandle channel_handle(
41 "NaCl IPC", base::FileDescriptor(browser_ipc_fd, false)); 42 "NaCl IPC", base::FileDescriptor(browser_ipc_fd, false));
42 43
43 proxy::PluginGlobals* globals = proxy::PluginGlobals::Get(); 44 proxy::PluginGlobals* globals = proxy::PluginGlobals::Get();
44 // Delay initializing the SyncChannel until after we add filters. This 45 // Delay initializing the SyncChannel until after we add filters. This
45 // ensures that the filters won't miss any messages received by 46 // ensures that the filters won't miss any messages received by
46 // the channel. 47 // the channel.
47 channel_ = 48 channel_ =
48 IPC::SyncChannel::Create(this, GetIPCTaskRunner(), GetShutdownEvent()); 49 IPC::SyncChannel::Create(this, GetIPCTaskRunner(), GetShutdownEvent());
49 scoped_refptr<ppapi::proxy::PluginMessageFilter> plugin_filter( 50 scoped_refptr<ppapi::proxy::PluginMessageFilter> plugin_filter(
50 new ppapi::proxy::PluginMessageFilter( 51 new ppapi::proxy::PluginMessageFilter(
51 NULL, globals->resource_reply_thread_registrar())); 52 NULL, globals->resource_reply_thread_registrar()));
52 channel_->AddFilter(plugin_filter.get()); 53 channel_->AddFilter(plugin_filter.get());
53 globals->RegisterResourceMessageFilters(plugin_filter.get()); 54 globals->RegisterResourceMessageFilters(plugin_filter.get());
54 55
55 channel_->AddFilter( 56 channel_->AddFilter(new tracing::ChildTraceMessageFilter(task_runner_.get()));
56 new tracing::ChildTraceMessageFilter(message_loop_.get()));
57 channel_->Init(channel_handle, IPC::Channel::MODE_SERVER, true); 57 channel_->Init(channel_handle, IPC::Channel::MODE_SERVER, true);
58 } 58 }
59 59
60 base::SingleThreadTaskRunner* PpapiDispatcher::GetIPCTaskRunner() { 60 base::SingleThreadTaskRunner* PpapiDispatcher::GetIPCTaskRunner() {
61 return message_loop_.get(); 61 return task_runner_.get();
62 } 62 }
63 63
64 base::WaitableEvent* PpapiDispatcher::GetShutdownEvent() { 64 base::WaitableEvent* PpapiDispatcher::GetShutdownEvent() {
65 return shutdown_event_; 65 return shutdown_event_;
66 } 66 }
67 67
68 IPC::PlatformFileForTransit PpapiDispatcher::ShareHandleWithRemote( 68 IPC::PlatformFileForTransit PpapiDispatcher::ShareHandleWithRemote(
69 base::PlatformFile handle, 69 base::PlatformFile handle,
70 base::ProcessId peer_pid, 70 base::ProcessId peer_pid,
71 bool should_close_source) { 71 bool should_close_source) {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 NOTREACHED(); 208 NOTREACHED();
209 return; 209 return;
210 } 210 }
211 std::map<uint32, proxy::PluginDispatcher*>::iterator dispatcher = 211 std::map<uint32, proxy::PluginDispatcher*>::iterator dispatcher =
212 plugin_dispatchers_.find(id); 212 plugin_dispatchers_.find(id);
213 if (dispatcher != plugin_dispatchers_.end()) 213 if (dispatcher != plugin_dispatchers_.end())
214 dispatcher->second->OnMessageReceived(msg); 214 dispatcher->second->OnMessageReceived(msg);
215 } 215 }
216 216
217 } // namespace ppapi 217 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/nacl_irt/ppapi_dispatcher.h ('k') | ppapi/proxy/message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698