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/c/ppp_instance.h" | |
16 #include "ppapi/proxy/interface_list.h" | 17 #include "ppapi/proxy/interface_list.h" |
17 #include "ppapi/proxy/interface_proxy.h" | 18 #include "ppapi/proxy/interface_proxy.h" |
18 #include "ppapi/proxy/plugin_message_filter.h" | 19 #include "ppapi/proxy/plugin_message_filter.h" |
19 #include "ppapi/proxy/plugin_resource_tracker.h" | 20 #include "ppapi/proxy/plugin_resource_tracker.h" |
20 #include "ppapi/proxy/plugin_var_serialization_rules.h" | 21 #include "ppapi/proxy/plugin_var_serialization_rules.h" |
21 #include "ppapi/proxy/ppapi_messages.h" | 22 #include "ppapi/proxy/ppapi_messages.h" |
22 #include "ppapi/proxy/ppb_cursor_control_proxy.h" | 23 #include "ppapi/proxy/ppb_cursor_control_proxy.h" |
23 #include "ppapi/proxy/ppb_font_proxy.h" | 24 #include "ppapi/proxy/ppb_font_proxy.h" |
24 #include "ppapi/proxy/ppb_instance_proxy.h" | 25 #include "ppapi/proxy/ppb_instance_proxy.h" |
25 #include "ppapi/proxy/ppp_class_proxy.h" | 26 #include "ppapi/proxy/ppp_class_proxy.h" |
26 #include "ppapi/proxy/resource_creation_proxy.h" | 27 #include "ppapi/proxy/resource_creation_proxy.h" |
27 #include "ppapi/shared_impl/resource.h" | 28 #include "ppapi/shared_impl/resource.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 |
34 namespace ppapi { | 35 namespace ppapi { |
35 namespace proxy { | 36 namespace proxy { |
36 | 37 |
37 namespace { | 38 namespace { |
38 | 39 |
39 typedef std::map<PP_Instance, PluginDispatcher*> InstanceToDispatcherMap; | 40 typedef std::map<PP_Instance, PluginDispatcher*> InstanceToDispatcherMap; |
40 InstanceToDispatcherMap* g_instance_to_dispatcher = NULL; | 41 InstanceToDispatcherMap* g_instance_to_dispatcher = NULL; |
41 | 42 |
42 } // namespace | 43 } // namespace |
43 | 44 |
44 InstanceData::InstanceData() | 45 InstanceData::InstanceData() |
45 : fullscreen(PP_FALSE), | 46 : flash_fullscreen(PP_FALSE), |
46 flash_fullscreen(PP_FALSE), | |
47 mouse_lock_callback(PP_BlockUntilComplete()) { | 47 mouse_lock_callback(PP_BlockUntilComplete()) { |
48 memset(&position, 0, sizeof(position)); | |
49 } | 48 } |
50 | 49 |
51 InstanceData::~InstanceData() { | 50 InstanceData::~InstanceData() { |
52 // Run any pending mouse lock callback to prevent leaks. | 51 // Run any pending mouse lock callback to prevent leaks. |
53 if (mouse_lock_callback.func) | 52 if (mouse_lock_callback.func) |
54 PP_RunAndClearCompletionCallback(&mouse_lock_callback, PP_ERROR_ABORTED); | 53 PP_RunAndClearCompletionCallback(&mouse_lock_callback, PP_ERROR_ABORTED); |
55 } | 54 } |
56 | 55 |
57 PluginDispatcher::PluginDispatcher(base::ProcessHandle remote_process_handle, | 56 PluginDispatcher::PluginDispatcher(base::ProcessHandle remote_process_handle, |
58 GetInterfaceFunc get_interface) | 57 GetInterfaceFunc get_interface) |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
226 PpapiMsg_PPPInstance_DidDestroy msg(API_ID_PPP_INSTANCE, i->first); | 225 PpapiMsg_PPPInstance_DidDestroy msg(API_ID_PPP_INSTANCE, i->first); |
227 OnMessageReceived(msg); | 226 OnMessageReceived(msg); |
228 } | 227 } |
229 } | 228 } |
230 } | 229 } |
231 | 230 |
232 void PluginDispatcher::OnMsgSupportsInterface( | 231 void PluginDispatcher::OnMsgSupportsInterface( |
233 const std::string& interface_name, | 232 const std::string& interface_name, |
234 bool* result) { | 233 bool* result) { |
235 *result = !!GetPluginInterface(interface_name); | 234 *result = !!GetPluginInterface(interface_name); |
235 | |
236 // Do fallback for PPP_Instance. This is a hack here and if we have more | |
237 // cases like this it should be generalized. The PPP_Instance proxy always | |
238 // prroxies the 1.1 interface, and then does fallback to 1.0 inside the | |
dmichael (off chromium)
2011/12/20 19:01:34
prroxies->proxies
| |
239 // plugin process (see PPP_Instance_Proxy). So here we return true for | |
240 // supporting the 1.1 interface if either 1.1 or 1.0 is supported. | |
241 if (!*result && interface_name == PPP_INSTANCE_INTERFACE) | |
242 *result = !!GetPluginInterface(PPP_INSTANCE_INTERFACE_1_0); | |
236 } | 243 } |
237 | 244 |
238 void PluginDispatcher::OnMsgSetPreferences(const Preferences& prefs) { | 245 void PluginDispatcher::OnMsgSetPreferences(const Preferences& prefs) { |
239 // The renderer may send us preferences more than once (currently this | 246 // The renderer may send us preferences more than once (currently this |
240 // happens every time a new plugin instance is created). Since we don't have | 247 // happens every time a new plugin instance is created). Since we don't have |
241 // a way to signal to the plugin that the preferences have changed, changing | 248 // a way to signal to the plugin that the preferences have changed, changing |
242 // the default fonts and such in the middle of a running plugin could be | 249 // the default fonts and such in the middle of a running plugin could be |
243 // confusing to it. As a result, we never allow the preferences to be changed | 250 // confusing to it. As a result, we never allow the preferences to be changed |
244 // once they're set. The user will have to restart to get new font prefs | 251 // once they're set. The user will have to restart to get new font prefs |
245 // propogated to plugins. | 252 // propogated to plugins. |
246 if (!received_preferences_) { | 253 if (!received_preferences_) { |
247 received_preferences_ = true; | 254 received_preferences_ = true; |
248 preferences_ = prefs; | 255 preferences_ = prefs; |
249 } | 256 } |
250 } | 257 } |
251 | 258 |
252 } // namespace proxy | 259 } // namespace proxy |
253 } // namespace ppapi | 260 } // namespace ppapi |
OLD | NEW |