OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/proxy/plugin_dispatcher.h" | 5 #include "ppapi/proxy/plugin_dispatcher.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "ipc/ipc_message.h" | 11 #include "ipc/ipc_message.h" |
12 #include "ipc/ipc_sync_channel.h" | 12 #include "ipc/ipc_sync_channel.h" |
13 #include "gpu/common/gpu_trace_event.h" | 13 #include "base/debug/trace_event.h" |
14 #include "ppapi/c/pp_errors.h" | 14 #include "ppapi/c/pp_errors.h" |
15 #include "ppapi/proxy/interface_proxy.h" | 15 #include "ppapi/proxy/interface_proxy.h" |
16 #include "ppapi/proxy/plugin_message_filter.h" | 16 #include "ppapi/proxy/plugin_message_filter.h" |
17 #include "ppapi/proxy/plugin_var_serialization_rules.h" | 17 #include "ppapi/proxy/plugin_var_serialization_rules.h" |
18 #include "ppapi/proxy/ppapi_messages.h" | 18 #include "ppapi/proxy/ppapi_messages.h" |
19 #include "ppapi/proxy/ppp_class_proxy.h" | 19 #include "ppapi/proxy/ppp_class_proxy.h" |
20 | 20 |
21 #if defined(OS_POSIX) | 21 #if defined(OS_POSIX) |
22 #include "base/eintr_wrapper.h" | 22 #include "base/eintr_wrapper.h" |
23 #include "ipc/ipc_channel_posix.h" | 23 #include "ipc/ipc_channel_posix.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 channel()->AddFilter( | 79 channel()->AddFilter( |
80 new PluginMessageFilter(delegate->GetGloballySeenInstanceIDSet())); | 80 new PluginMessageFilter(delegate->GetGloballySeenInstanceIDSet())); |
81 return true; | 81 return true; |
82 } | 82 } |
83 | 83 |
84 bool PluginDispatcher::IsPlugin() const { | 84 bool PluginDispatcher::IsPlugin() const { |
85 return true; | 85 return true; |
86 } | 86 } |
87 | 87 |
88 bool PluginDispatcher::Send(IPC::Message* msg) { | 88 bool PluginDispatcher::Send(IPC::Message* msg) { |
89 GPU_TRACE_EVENT2("ppapi proxy", "PluginDispatcher::Send", | 89 TRACE_EVENT2("ppapi proxy", "PluginDispatcher::Send", |
90 "Class", IPC_MESSAGE_ID_CLASS(msg->type()), | 90 "Class", IPC_MESSAGE_ID_CLASS(msg->type()), |
91 "Line", IPC_MESSAGE_ID_LINE(msg->type())); | 91 "Line", IPC_MESSAGE_ID_LINE(msg->type())); |
92 // We always want plugin->renderer messages to arrive in-order. If some sync | 92 // We always want plugin->renderer messages to arrive in-order. If some sync |
93 // and some async messages are send in response to a synchronous | 93 // and some async messages are send in response to a synchronous |
94 // renderer->plugin call, the sync reply will be processed before the async | 94 // renderer->plugin call, the sync reply will be processed before the async |
95 // reply, and everything will be confused. | 95 // reply, and everything will be confused. |
96 // | 96 // |
97 // Allowing all async messages to unblock the renderer means more reentrancy | 97 // Allowing all async messages to unblock the renderer means more reentrancy |
98 // there but gives correct ordering. | 98 // there but gives correct ordering. |
99 msg->set_unblock(true); | 99 msg->set_unblock(true); |
100 return Dispatcher::Send(msg); | 100 return Dispatcher::Send(msg); |
101 } | 101 } |
102 | 102 |
103 bool PluginDispatcher::OnMessageReceived(const IPC::Message& msg) { | 103 bool PluginDispatcher::OnMessageReceived(const IPC::Message& msg) { |
104 GPU_TRACE_EVENT2("ppapi proxy", "PluginDispatcher::OnMessageReceived", | 104 TRACE_EVENT2("ppapi proxy", "PluginDispatcher::OnMessageReceived", |
105 "Class", IPC_MESSAGE_ID_CLASS(msg.type()), | 105 "Class", IPC_MESSAGE_ID_CLASS(msg.type()), |
106 "Line", IPC_MESSAGE_ID_LINE(msg.type())); | 106 "Line", IPC_MESSAGE_ID_LINE(msg.type())); |
107 // Handle common control messages. | 107 // Handle common control messages. |
108 if (Dispatcher::OnMessageReceived(msg)) | 108 if (Dispatcher::OnMessageReceived(msg)) |
109 return true; | 109 return true; |
110 | 110 |
111 if (msg.routing_id() == MSG_ROUTING_CONTROL) { | 111 if (msg.routing_id() == MSG_ROUTING_CONTROL) { |
112 // Handle some plugin-specific control messages. | 112 // Handle some plugin-specific control messages. |
113 bool handled = true; | 113 bool handled = true; |
114 IPC_BEGIN_MESSAGE_MAP(PluginDispatcher, msg) | 114 IPC_BEGIN_MESSAGE_MAP(PluginDispatcher, msg) |
115 IPC_MESSAGE_HANDLER(PpapiMsg_SupportsInterface, OnMsgSupportsInterface) | 115 IPC_MESSAGE_HANDLER(PpapiMsg_SupportsInterface, OnMsgSupportsInterface) |
116 IPC_END_MESSAGE_MAP() | 116 IPC_END_MESSAGE_MAP() |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 if (!interface_functions) | 234 if (!interface_functions) |
235 return; | 235 return; |
236 target_proxies_[info->id].reset( | 236 target_proxies_[info->id].reset( |
237 info->create_proxy(this, interface_functions)); | 237 info->create_proxy(this, interface_functions)); |
238 *result = true; | 238 *result = true; |
239 } | 239 } |
240 | 240 |
241 } // namespace proxy | 241 } // namespace proxy |
242 } // namespace pp | 242 } // namespace pp |
243 | 243 |
OLD | NEW |