OLD | NEW |
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 "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 #endif | 58 #endif |
59 | 59 |
60 IPC::ChannelHandle channel_handle( | 60 IPC::ChannelHandle channel_handle( |
61 "NaCl IPC", base::FileDescriptor(browser_ipc_fd, false)); | 61 "NaCl IPC", base::FileDescriptor(browser_ipc_fd, false)); |
62 | 62 |
63 proxy::PluginGlobals* globals = proxy::PluginGlobals::Get(); | 63 proxy::PluginGlobals* globals = proxy::PluginGlobals::Get(); |
64 // Delay initializing the SyncChannel until after we add filters. This | 64 // Delay initializing the SyncChannel until after we add filters. This |
65 // ensures that the filters won't miss any messages received by | 65 // ensures that the filters won't miss any messages received by |
66 // the channel. | 66 // the channel. |
67 channel_ = | 67 channel_ = |
68 IPC::SyncChannel::Create(this, GetIPCMessageLoop(), GetShutdownEvent()); | 68 IPC::SyncChannel::Create(this, GetIPCTaskRunner(), GetShutdownEvent()); |
69 scoped_refptr<ppapi::proxy::PluginMessageFilter> plugin_filter( | 69 scoped_refptr<ppapi::proxy::PluginMessageFilter> plugin_filter( |
70 new ppapi::proxy::PluginMessageFilter( | 70 new ppapi::proxy::PluginMessageFilter( |
71 NULL, globals->resource_reply_thread_registrar())); | 71 NULL, globals->resource_reply_thread_registrar())); |
72 channel_->AddFilter(plugin_filter.get()); | 72 channel_->AddFilter(plugin_filter.get()); |
73 globals->RegisterResourceMessageFilters(plugin_filter.get()); | 73 globals->RegisterResourceMessageFilters(plugin_filter.get()); |
74 | 74 |
75 channel_->AddFilter( | 75 channel_->AddFilter( |
76 new tracing::ChildTraceMessageFilter(message_loop_.get())); | 76 new tracing::ChildTraceMessageFilter(message_loop_.get())); |
77 channel_->Init(channel_handle, IPC::Channel::MODE_SERVER, true); | 77 channel_->Init(channel_handle, IPC::Channel::MODE_SERVER, true); |
78 } | 78 } |
79 | 79 |
80 base::MessageLoopProxy* PpapiDispatcher::GetIPCMessageLoop() { | 80 base::SingleThreadTaskRunner* PpapiDispatcher::GetIPCTaskRunner() { |
81 return message_loop_.get(); | 81 return message_loop_.get(); |
82 } | 82 } |
83 | 83 |
84 base::WaitableEvent* PpapiDispatcher::GetShutdownEvent() { | 84 base::WaitableEvent* PpapiDispatcher::GetShutdownEvent() { |
85 return shutdown_event_; | 85 return shutdown_event_; |
86 } | 86 } |
87 | 87 |
88 IPC::PlatformFileForTransit PpapiDispatcher::ShareHandleWithRemote( | 88 IPC::PlatformFileForTransit PpapiDispatcher::ShareHandleWithRemote( |
89 base::PlatformFile handle, | 89 base::PlatformFile handle, |
90 base::ProcessId peer_pid, | 90 base::ProcessId peer_pid, |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 NOTREACHED(); | 222 NOTREACHED(); |
223 return; | 223 return; |
224 } | 224 } |
225 std::map<uint32, proxy::PluginDispatcher*>::iterator dispatcher = | 225 std::map<uint32, proxy::PluginDispatcher*>::iterator dispatcher = |
226 plugin_dispatchers_.find(id); | 226 plugin_dispatchers_.find(id); |
227 if (dispatcher != plugin_dispatchers_.end()) | 227 if (dispatcher != plugin_dispatchers_.end()) |
228 dispatcher->second->OnMessageReceived(msg); | 228 dispatcher->second->OnMessageReceived(msg); |
229 } | 229 } |
230 | 230 |
231 } // namespace ppapi | 231 } // namespace ppapi |
OLD | NEW |