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

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

Issue 8951014: Change the DidChangeView update to take a new ViewChanged resource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More nacl fixes Created 8 years, 11 months 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 | Annotate | Revision Log
OLDNEW
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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 PpapiMsg_PPPInstance_DidDestroy msg(API_ID_PPP_INSTANCE, i->first); 211 PpapiMsg_PPPInstance_DidDestroy msg(API_ID_PPP_INSTANCE, i->first);
213 OnMessageReceived(msg); 212 OnMessageReceived(msg);
214 } 213 }
215 } 214 }
216 } 215 }
217 216
218 void PluginDispatcher::OnMsgSupportsInterface( 217 void PluginDispatcher::OnMsgSupportsInterface(
219 const std::string& interface_name, 218 const std::string& interface_name,
220 bool* result) { 219 bool* result) {
221 *result = !!GetPluginInterface(interface_name); 220 *result = !!GetPluginInterface(interface_name);
221
222 // Do fallback for PPP_Instance. This is a hack here and if we have more
223 // cases like this it should be generalized. The PPP_Instance proxy always
224 // proxies the 1.1 interface, and then does fallback to 1.0 inside the
225 // plugin process (see PPP_Instance_Proxy). So here we return true for
226 // supporting the 1.1 interface if either 1.1 or 1.0 is supported.
227 if (!*result && interface_name == PPP_INSTANCE_INTERFACE)
228 *result = !!GetPluginInterface(PPP_INSTANCE_INTERFACE_1_0);
222 } 229 }
223 230
224 void PluginDispatcher::OnMsgSetPreferences(const Preferences& prefs) { 231 void PluginDispatcher::OnMsgSetPreferences(const Preferences& prefs) {
225 // The renderer may send us preferences more than once (currently this 232 // The renderer may send us preferences more than once (currently this
226 // happens every time a new plugin instance is created). Since we don't have 233 // happens every time a new plugin instance is created). Since we don't have
227 // a way to signal to the plugin that the preferences have changed, changing 234 // a way to signal to the plugin that the preferences have changed, changing
228 // the default fonts and such in the middle of a running plugin could be 235 // the default fonts and such in the middle of a running plugin could be
229 // confusing to it. As a result, we never allow the preferences to be changed 236 // confusing to it. As a result, we never allow the preferences to be changed
230 // once they're set. The user will have to restart to get new font prefs 237 // once they're set. The user will have to restart to get new font prefs
231 // propogated to plugins. 238 // propogated to plugins.
232 if (!received_preferences_) { 239 if (!received_preferences_) {
233 received_preferences_ = true; 240 received_preferences_ = true;
234 preferences_ = prefs; 241 preferences_ = prefs;
235 } 242 }
236 } 243 }
237 244
238 } // namespace proxy 245 } // namespace proxy
239 } // namespace ppapi 246 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698