| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/dispatcher.h" | 5 #include "ppapi/proxy/dispatcher.h" |
| 6 | 6 |
| 7 #include <string.h> // For memset. | 7 #include <string.h> // For memset. |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "ipc/ipc_message.h" | 13 #include "ipc/ipc_message.h" |
| 14 #include "ipc/ipc_sync_channel.h" | 14 #include "ipc/ipc_sync_channel.h" |
| 15 #include "ppapi/c/dev/ppb_audio_config_dev.h" |
| 16 #include "ppapi/c/dev/ppb_audio_dev.h" |
| 15 #include "ppapi/c/dev/ppb_buffer_dev.h" | 17 #include "ppapi/c/dev/ppb_buffer_dev.h" |
| 16 #include "ppapi/c/dev/ppb_char_set_dev.h" | 18 #include "ppapi/c/dev/ppb_char_set_dev.h" |
| 17 #include "ppapi/c/dev/ppb_cursor_control_dev.h" | 19 #include "ppapi/c/dev/ppb_cursor_control_dev.h" |
| 18 #include "ppapi/c/dev/ppb_cursor_control_dev.h" | 20 #include "ppapi/c/dev/ppb_cursor_control_dev.h" |
| 19 #include "ppapi/c/dev/ppb_font_dev.h" | 21 #include "ppapi/c/dev/ppb_font_dev.h" |
| 20 #include "ppapi/c/dev/ppb_fullscreen_dev.h" | 22 #include "ppapi/c/dev/ppb_fullscreen_dev.h" |
| 21 #include "ppapi/c/dev/ppb_fullscreen_dev.h" | 23 #include "ppapi/c/dev/ppb_fullscreen_dev.h" |
| 22 #include "ppapi/c/dev/ppb_testing_dev.h" | 24 #include "ppapi/c/dev/ppb_testing_dev.h" |
| 23 #include "ppapi/c/dev/ppb_var_deprecated.h" | 25 #include "ppapi/c/dev/ppb_var_deprecated.h" |
| 24 #include "ppapi/c/pp_errors.h" | 26 #include "ppapi/c/pp_errors.h" |
| 25 #include "ppapi/c/ppb_core.h" | 27 #include "ppapi/c/ppb_core.h" |
| 26 #include "ppapi/c/ppb_graphics_2d.h" | 28 #include "ppapi/c/ppb_graphics_2d.h" |
| 27 #include "ppapi/c/ppb_image_data.h" | 29 #include "ppapi/c/ppb_image_data.h" |
| 28 #include "ppapi/c/ppb_instance.h" | 30 #include "ppapi/c/ppb_instance.h" |
| 29 #include "ppapi/c/ppb_url_loader.h" | 31 #include "ppapi/c/ppb_url_loader.h" |
| 30 #include "ppapi/c/ppb_url_request_info.h" | 32 #include "ppapi/c/ppb_url_request_info.h" |
| 31 #include "ppapi/c/ppb_url_response_info.h" | 33 #include "ppapi/c/ppb_url_response_info.h" |
| 32 #include "ppapi/c/ppp_instance.h" | 34 #include "ppapi/c/ppp_instance.h" |
| 33 #include "ppapi/proxy/ppapi_messages.h" | 35 #include "ppapi/proxy/ppapi_messages.h" |
| 36 #include "ppapi/proxy/ppb_audio_config_proxy.h" |
| 37 #include "ppapi/proxy/ppb_audio_proxy.h" |
| 34 #include "ppapi/proxy/ppb_buffer_proxy.h" | 38 #include "ppapi/proxy/ppb_buffer_proxy.h" |
| 35 #include "ppapi/proxy/ppb_char_set_proxy.h" | 39 #include "ppapi/proxy/ppb_char_set_proxy.h" |
| 36 #include "ppapi/proxy/ppb_core_proxy.h" | 40 #include "ppapi/proxy/ppb_core_proxy.h" |
| 37 #include "ppapi/proxy/ppb_cursor_control_proxy.h" | 41 #include "ppapi/proxy/ppb_cursor_control_proxy.h" |
| 38 #include "ppapi/proxy/ppb_font_proxy.h" | 42 #include "ppapi/proxy/ppb_font_proxy.h" |
| 39 #include "ppapi/proxy/ppb_fullscreen_proxy.h" | 43 #include "ppapi/proxy/ppb_fullscreen_proxy.h" |
| 40 #include "ppapi/proxy/ppb_graphics_2d_proxy.h" | 44 #include "ppapi/proxy/ppb_graphics_2d_proxy.h" |
| 41 #include "ppapi/proxy/ppb_image_data_proxy.h" | 45 #include "ppapi/proxy/ppb_image_data_proxy.h" |
| 42 #include "ppapi/proxy/ppb_instance_proxy.h" | 46 #include "ppapi/proxy/ppb_instance_proxy.h" |
| 43 #include "ppapi/proxy/ppb_pdf_proxy.h" | 47 #include "ppapi/proxy/ppb_pdf_proxy.h" |
| 44 #include "ppapi/proxy/ppb_testing_proxy.h" | 48 #include "ppapi/proxy/ppb_testing_proxy.h" |
| 45 #include "ppapi/proxy/ppb_url_loader_proxy.h" | 49 #include "ppapi/proxy/ppb_url_loader_proxy.h" |
| 46 #include "ppapi/proxy/ppb_url_request_info_proxy.h" | 50 #include "ppapi/proxy/ppb_url_request_info_proxy.h" |
| 47 #include "ppapi/proxy/ppb_url_response_info_proxy.h" | 51 #include "ppapi/proxy/ppb_url_response_info_proxy.h" |
| 48 #include "ppapi/proxy/ppb_var_deprecated_proxy.h" | 52 #include "ppapi/proxy/ppb_var_deprecated_proxy.h" |
| 49 #include "ppapi/proxy/ppp_class_proxy.h" | 53 #include "ppapi/proxy/ppp_class_proxy.h" |
| 50 #include "ppapi/proxy/ppp_instance_proxy.h" | 54 #include "ppapi/proxy/ppp_instance_proxy.h" |
| 51 #include "ppapi/proxy/var_serialization_rules.h" | 55 #include "ppapi/proxy/var_serialization_rules.h" |
| 52 #include "webkit/glue/plugins/ppb_private.h" | 56 #include "webkit/glue/plugins/ppb_private.h" |
| 53 | 57 |
| 54 namespace pp { | 58 namespace pp { |
| 55 namespace proxy { | 59 namespace proxy { |
| 56 | 60 |
| 57 Dispatcher::Dispatcher(GetInterfaceFunc local_get_interface) | 61 Dispatcher::Dispatcher(base::ProcessHandle remote_process_handle, |
| 62 GetInterfaceFunc local_get_interface) |
| 58 : pp_module_(0), | 63 : pp_module_(0), |
| 64 remote_process_handle_(remote_process_handle), |
| 59 disallow_trusted_interfaces_(true), | 65 disallow_trusted_interfaces_(true), |
| 60 local_get_interface_(local_get_interface), | 66 local_get_interface_(local_get_interface), |
| 61 declared_supported_remote_interfaces_(false), | 67 declared_supported_remote_interfaces_(false), |
| 62 callback_tracker_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 68 callback_tracker_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
| 63 memset(id_to_proxy_, 0, | 69 memset(id_to_proxy_, 0, |
| 64 static_cast<int>(INTERFACE_ID_COUNT) * sizeof(InterfaceProxy*)); | 70 static_cast<int>(INTERFACE_ID_COUNT) * sizeof(InterfaceProxy*)); |
| 65 } | 71 } |
| 66 | 72 |
| 67 Dispatcher::~Dispatcher() { | 73 Dispatcher::~Dispatcher() { |
| 68 } | 74 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 continue; | 215 continue; |
| 210 } | 216 } |
| 211 proxies_[interfaces[i]] = proxy; | 217 proxies_[interfaces[i]] = proxy; |
| 212 id_to_proxy_[proxy->GetInterfaceId()] = proxy.get(); | 218 id_to_proxy_[proxy->GetInterfaceId()] = proxy.get(); |
| 213 } | 219 } |
| 214 } | 220 } |
| 215 | 221 |
| 216 InterfaceProxy* Dispatcher::CreateProxyForInterface( | 222 InterfaceProxy* Dispatcher::CreateProxyForInterface( |
| 217 const std::string& interface_name, | 223 const std::string& interface_name, |
| 218 const void* interface_functions) { | 224 const void* interface_functions) { |
| 225 if (interface_name == PPB_AUDIO_CONFIG_DEV_INTERFACE) |
| 226 return new PPB_AudioConfig_Proxy(this, interface_functions); |
| 227 if (interface_name == PPB_AUDIO_DEV_INTERFACE) |
| 228 return new PPB_Audio_Proxy(this, interface_functions); |
| 219 if (interface_name == PPB_BUFFER_DEV_INTERFACE) | 229 if (interface_name == PPB_BUFFER_DEV_INTERFACE) |
| 220 return new PPB_Buffer_Proxy(this, interface_functions); | 230 return new PPB_Buffer_Proxy(this, interface_functions); |
| 221 if (interface_name == PPB_CHAR_SET_DEV_INTERFACE) | 231 if (interface_name == PPB_CHAR_SET_DEV_INTERFACE) |
| 222 return new PPB_CharSet_Proxy(this, interface_functions); | 232 return new PPB_CharSet_Proxy(this, interface_functions); |
| 223 if (interface_name == PPB_CORE_INTERFACE) | 233 if (interface_name == PPB_CORE_INTERFACE) |
| 224 return new PPB_Core_Proxy(this, interface_functions); | 234 return new PPB_Core_Proxy(this, interface_functions); |
| 225 if (interface_name == PPB_CURSOR_CONTROL_DEV_INTERFACE) | 235 if (interface_name == PPB_CURSOR_CONTROL_DEV_INTERFACE) |
| 226 return new PPB_CursorControl_Proxy(this, interface_functions); | 236 return new PPB_CursorControl_Proxy(this, interface_functions); |
| 227 if (interface_name == PPB_FONT_DEV_INTERFACE) | 237 if (interface_name == PPB_FONT_DEV_INTERFACE) |
| 228 return new PPB_Font_Proxy(this, interface_functions); | 238 return new PPB_Font_Proxy(this, interface_functions); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 248 return new PPB_Var_Deprecated_Proxy(this, interface_functions); | 258 return new PPB_Var_Deprecated_Proxy(this, interface_functions); |
| 249 if (interface_name == PPP_INSTANCE_INTERFACE) | 259 if (interface_name == PPP_INSTANCE_INTERFACE) |
| 250 return new PPP_Instance_Proxy(this, interface_functions); | 260 return new PPP_Instance_Proxy(this, interface_functions); |
| 251 | 261 |
| 252 return NULL; | 262 return NULL; |
| 253 } | 263 } |
| 254 | 264 |
| 255 } // namespace proxy | 265 } // namespace proxy |
| 256 } // namespace pp | 266 } // namespace pp |
| 257 | 267 |
| OLD | NEW |