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 "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "ipc/ipc_message.h" | 12 #include "ipc/ipc_message.h" |
13 #include "ipc/ipc_sync_channel.h" | 13 #include "ipc/ipc_sync_channel.h" |
14 #include "base/debug/trace_event.h" | 14 #include "base/debug/trace_event.h" |
15 #include "ppapi/c/pp_errors.h" | 15 #include "ppapi/c/pp_errors.h" |
16 #include "ppapi/proxy/interface_proxy.h" | 16 #include "ppapi/proxy/interface_proxy.h" |
17 #include "ppapi/proxy/plugin_message_filter.h" | 17 #include "ppapi/proxy/plugin_message_filter.h" |
18 #include "ppapi/proxy/plugin_resource_tracker.h" | 18 #include "ppapi/proxy/plugin_resource_tracker.h" |
19 #include "ppapi/proxy/plugin_var_serialization_rules.h" | 19 #include "ppapi/proxy/plugin_var_serialization_rules.h" |
20 #include "ppapi/proxy/ppapi_messages.h" | 20 #include "ppapi/proxy/ppapi_messages.h" |
21 #include "ppapi/proxy/ppb_char_set_proxy.h" | 21 #include "ppapi/proxy/ppb_char_set_proxy.h" |
22 #include "ppapi/proxy/ppb_cursor_control_proxy.h" | 22 #include "ppapi/proxy/ppb_cursor_control_proxy.h" |
23 #include "ppapi/proxy/ppb_font_proxy.h" | 23 #include "ppapi/proxy/ppb_font_proxy.h" |
24 #include "ppapi/proxy/ppb_instance_proxy.h" | 24 #include "ppapi/proxy/ppb_instance_proxy.h" |
25 #include "ppapi/proxy/ppp_class_proxy.h" | 25 #include "ppapi/proxy/ppp_class_proxy.h" |
26 #include "ppapi/proxy/resource_creation_proxy.h" | 26 #include "ppapi/proxy/resource_creation_proxy.h" |
| 27 #include "ppapi/shared_impl/resource.h" |
27 #include "ppapi/shared_impl/tracker_base.h" | 28 #include "ppapi/shared_impl/tracker_base.h" |
28 | 29 |
29 #if defined(OS_POSIX) | 30 #if defined(OS_POSIX) |
30 #include "base/eintr_wrapper.h" | 31 #include "base/eintr_wrapper.h" |
31 #include "ipc/ipc_channel_posix.h" | 32 #include "ipc/ipc_channel_posix.h" |
32 #endif | 33 #endif |
33 | 34 |
| 35 using ppapi::Resource; |
| 36 |
34 namespace pp { | 37 namespace pp { |
35 namespace proxy { | 38 namespace proxy { |
36 | 39 |
37 namespace { | 40 namespace { |
38 | 41 |
39 typedef std::map<PP_Instance, PluginDispatcher*> InstanceToDispatcherMap; | 42 typedef std::map<PP_Instance, PluginDispatcher*> InstanceToDispatcherMap; |
40 InstanceToDispatcherMap* g_instance_to_dispatcher = NULL; | 43 InstanceToDispatcherMap* g_instance_to_dispatcher = NULL; |
41 | 44 |
42 } // namespace | 45 } // namespace |
43 | 46 |
(...skipping 23 matching lines...) Expand all Loading... |
67 if (!g_instance_to_dispatcher) | 70 if (!g_instance_to_dispatcher) |
68 return NULL; | 71 return NULL; |
69 InstanceToDispatcherMap::iterator found = g_instance_to_dispatcher->find( | 72 InstanceToDispatcherMap::iterator found = g_instance_to_dispatcher->find( |
70 instance); | 73 instance); |
71 if (found == g_instance_to_dispatcher->end()) | 74 if (found == g_instance_to_dispatcher->end()) |
72 return NULL; | 75 return NULL; |
73 return found->second; | 76 return found->second; |
74 } | 77 } |
75 | 78 |
76 // static | 79 // static |
| 80 PluginDispatcher* PluginDispatcher::GetForResource(const Resource* resource) { |
| 81 return GetForInstance(resource->pp_instance()); |
| 82 } |
| 83 |
| 84 // static |
77 const void* PluginDispatcher::GetInterfaceFromDispatcher( | 85 const void* PluginDispatcher::GetInterfaceFromDispatcher( |
78 const char* interface) { | 86 const char* interface) { |
79 // All interfaces the plugin requests of the browser are "PPB". | 87 // All interfaces the plugin requests of the browser are "PPB". |
80 const InterfaceProxy::Info* info = GetPPBInterfaceInfo(interface); | 88 const InterfaceProxy::Info* info = GetPPBInterfaceInfo(interface); |
81 if (!info) | 89 if (!info) |
82 return NULL; | 90 return NULL; |
83 return info->interface_ptr; | 91 return info->interface_ptr; |
84 } | 92 } |
85 | 93 |
86 bool PluginDispatcher::InitPluginWithChannel( | 94 bool PluginDispatcher::InitPluginWithChannel( |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 // once they're set. The user will have to restart to get new font prefs | 311 // once they're set. The user will have to restart to get new font prefs |
304 // propogated to plugins. | 312 // propogated to plugins. |
305 if (!received_preferences_) { | 313 if (!received_preferences_) { |
306 received_preferences_ = true; | 314 received_preferences_ = true; |
307 preferences_ = prefs; | 315 preferences_ = prefs; |
308 } | 316 } |
309 } | 317 } |
310 | 318 |
311 } // namespace proxy | 319 } // namespace proxy |
312 } // namespace pp | 320 } // namespace pp |
OLD | NEW |