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

Side by Side Diff: ppapi/proxy/plugin_dispatcher.cc

Issue 704913002: PPAPI: Make GetProxiedInterface not re-enter the plugin (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make SimulateInputEvent test message asynchronous. Created 6 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 // plugin making pepper calls on a different thread. 216 // plugin making pepper calls on a different thread.
217 ProxyAutoLock lock; 217 ProxyAutoLock lock;
218 TRACE_EVENT2("ppapi proxy", "PluginDispatcher::OnMessageReceived", 218 TRACE_EVENT2("ppapi proxy", "PluginDispatcher::OnMessageReceived",
219 "Class", IPC_MESSAGE_ID_CLASS(msg.type()), 219 "Class", IPC_MESSAGE_ID_CLASS(msg.type()),
220 "Line", IPC_MESSAGE_ID_LINE(msg.type())); 220 "Line", IPC_MESSAGE_ID_LINE(msg.type()));
221 221
222 if (msg.routing_id() == MSG_ROUTING_CONTROL) { 222 if (msg.routing_id() == MSG_ROUTING_CONTROL) {
223 // Handle some plugin-specific control messages. 223 // Handle some plugin-specific control messages.
224 bool handled = true; 224 bool handled = true;
225 IPC_BEGIN_MESSAGE_MAP(PluginDispatcher, msg) 225 IPC_BEGIN_MESSAGE_MAP(PluginDispatcher, msg)
226 IPC_MESSAGE_HANDLER(PpapiMsg_SupportsInterface, OnMsgSupportsInterface) 226 IPC_MESSAGE_HANDLER(PpapiMsg_IsInterfaceSupported,
227 OnMsgIsInterfaceSupported)
227 IPC_MESSAGE_HANDLER(PpapiMsg_SetPreferences, OnMsgSetPreferences) 228 IPC_MESSAGE_HANDLER(PpapiMsg_SetPreferences, OnMsgSetPreferences)
228 IPC_MESSAGE_UNHANDLED(handled = false); 229 IPC_MESSAGE_UNHANDLED(handled = false);
229 IPC_END_MESSAGE_MAP() 230 IPC_END_MESSAGE_MAP()
230 if (handled) 231 if (handled)
231 return true; 232 return true;
232 } 233 }
233 return Dispatcher::OnMessageReceived(msg); 234 return Dispatcher::OnMessageReceived(msg);
234 } 235 }
235 236
236 void PluginDispatcher::OnChannelError() { 237 void PluginDispatcher::OnChannelError() {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 i != temp_map.end(); ++i) { 291 i != temp_map.end(); ++i) {
291 if (i->second == this) { 292 if (i->second == this) {
292 // Synthesize an "instance destroyed" message, this will notify the 293 // Synthesize an "instance destroyed" message, this will notify the
293 // plugin and also remove it from our list of tracked plugins. 294 // plugin and also remove it from our list of tracked plugins.
294 PpapiMsg_PPPInstance_DidDestroy msg(API_ID_PPP_INSTANCE, i->first); 295 PpapiMsg_PPPInstance_DidDestroy msg(API_ID_PPP_INSTANCE, i->first);
295 OnMessageReceived(msg); 296 OnMessageReceived(msg);
296 } 297 }
297 } 298 }
298 } 299 }
299 300
300 void PluginDispatcher::OnMsgSupportsInterface( 301 void PluginDispatcher::OnMsgIsInterfaceSupported(
301 const std::string& interface_name, 302 const std::string& interface_name,
302 bool* result) { 303 bool* result) {
303 *result = !!GetPluginInterface(interface_name); 304 *result = !!GetPluginInterface(interface_name);
304 305
305 // Do fallback for PPP_Instance. This is a hack here and if we have more 306 // Do fallback for PPP_Instance. This is a hack here and if we have more
306 // cases like this it should be generalized. The PPP_Instance proxy always 307 // cases like this it should be generalized. The PPP_Instance proxy always
307 // proxies the 1.1 interface, and then does fallback to 1.0 inside the 308 // proxies the 1.1 interface, and then does fallback to 1.0 inside the
308 // plugin process (see PPP_Instance_Proxy). So here we return true for 309 // plugin process (see PPP_Instance_Proxy). So here we return true for
309 // supporting the 1.1 interface if either 1.1 or 1.0 is supported. 310 // supporting the 1.1 interface if either 1.1 or 1.0 is supported.
310 if (!*result && interface_name == PPP_INSTANCE_INTERFACE) 311 if (!*result && interface_name == PPP_INSTANCE_INTERFACE)
311 *result = !!GetPluginInterface(PPP_INSTANCE_INTERFACE_1_0); 312 *result = !!GetPluginInterface(PPP_INSTANCE_INTERFACE_1_0);
312 } 313 }
313 314
314 void PluginDispatcher::OnMsgSetPreferences(const Preferences& prefs) { 315 void PluginDispatcher::OnMsgSetPreferences(const Preferences& prefs) {
315 // The renderer may send us preferences more than once (currently this 316 // The renderer may send us preferences more than once (currently this
316 // happens every time a new plugin instance is created). Since we don't have 317 // happens every time a new plugin instance is created). Since we don't have
317 // a way to signal to the plugin that the preferences have changed, changing 318 // a way to signal to the plugin that the preferences have changed, changing
318 // the default fonts and such in the middle of a running plugin could be 319 // the default fonts and such in the middle of a running plugin could be
319 // confusing to it. As a result, we never allow the preferences to be changed 320 // confusing to it. As a result, we never allow the preferences to be changed
320 // once they're set. The user will have to restart to get new font prefs 321 // once they're set. The user will have to restart to get new font prefs
321 // propogated to plugins. 322 // propogated to plugins.
322 if (!received_preferences_) { 323 if (!received_preferences_) {
323 received_preferences_ = true; 324 received_preferences_ = true;
324 preferences_ = prefs; 325 preferences_ = prefs;
325 } 326 }
326 } 327 }
327 328
328 } // namespace proxy 329 } // namespace proxy
329 } // namespace ppapi 330 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698