| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 message_loop_(io_loop), | 53 message_loop_(io_loop), |
| 54 shutdown_event_(shutdown_event), | 54 shutdown_event_(shutdown_event), |
| 55 renderer_ipc_fd_(renderer_ipc_fd) { | 55 renderer_ipc_fd_(renderer_ipc_fd) { |
| 56 #if defined(IPC_MESSAGE_LOG_ENABLED) | 56 #if defined(IPC_MESSAGE_LOG_ENABLED) |
| 57 IPC::Logging::set_log_function_map(&g_log_function_mapping); | 57 IPC::Logging::set_log_function_map(&g_log_function_mapping); |
| 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 // Delay initializing the SyncChannel until after we add filters. This | 64 // Delay initializing the SyncChannel until after we add filters. This |
| 64 // ensures that the filters won't miss any messages received by | 65 // ensures that the filters won't miss any messages received by |
| 65 // the channel. | 66 // the channel. |
| 66 channel_ = | 67 channel_ = |
| 67 IPC::SyncChannel::Create(this, GetIPCMessageLoop(), GetShutdownEvent()); | 68 IPC::SyncChannel::Create(this, GetIPCMessageLoop(), GetShutdownEvent()); |
| 68 channel_->AddFilter(new proxy::PluginMessageFilter( | 69 scoped_refptr<ppapi::proxy::PluginMessageFilter> plugin_filter( |
| 69 NULL, proxy::PluginGlobals::Get()->resource_reply_thread_registrar())); | 70 new ppapi::proxy::PluginMessageFilter( |
| 71 NULL, globals->resource_reply_thread_registrar())); |
| 72 channel_->AddFilter(plugin_filter.get()); |
| 73 globals->RegisterResourceMessageFilters(plugin_filter.get()); |
| 74 |
| 70 channel_->AddFilter( | 75 channel_->AddFilter( |
| 71 new tracing::ChildTraceMessageFilter(message_loop_.get())); | 76 new tracing::ChildTraceMessageFilter(message_loop_.get())); |
| 72 channel_->Init(channel_handle, IPC::Channel::MODE_SERVER, true); | 77 channel_->Init(channel_handle, IPC::Channel::MODE_SERVER, true); |
| 73 } | 78 } |
| 74 | 79 |
| 75 base::MessageLoopProxy* PpapiDispatcher::GetIPCMessageLoop() { | 80 base::MessageLoopProxy* PpapiDispatcher::GetIPCMessageLoop() { |
| 76 return message_loop_.get(); | 81 return message_loop_.get(); |
| 77 } | 82 } |
| 78 | 83 |
| 79 base::WaitableEvent* PpapiDispatcher::GetShutdownEvent() { | 84 base::WaitableEvent* PpapiDispatcher::GetShutdownEvent() { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 NOTREACHED(); | 222 NOTREACHED(); |
| 218 return; | 223 return; |
| 219 } | 224 } |
| 220 std::map<uint32, proxy::PluginDispatcher*>::iterator dispatcher = | 225 std::map<uint32, proxy::PluginDispatcher*>::iterator dispatcher = |
| 221 plugin_dispatchers_.find(id); | 226 plugin_dispatchers_.find(id); |
| 222 if (dispatcher != plugin_dispatchers_.end()) | 227 if (dispatcher != plugin_dispatchers_.end()) |
| 223 dispatcher->second->OnMessageReceived(msg); | 228 dispatcher->second->OnMessageReceived(msg); |
| 224 } | 229 } |
| 225 | 230 |
| 226 } // namespace ppapi | 231 } // namespace ppapi |
| OLD | NEW |