summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-13 04:00:33 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-13 04:00:33 +0000
commit37fe036a2c3e907a5790561e11292904426db144 (patch)
tree4b4c928830476c7450ffd5c69ca9f222ddbcfded
parentad432d686c8529838448f6639130f1290db9d5a5 (diff)
downloadchromium_src-37fe036a2c3e907a5790561e11292904426db144.zip
chromium_src-37fe036a2c3e907a5790561e11292904426db144.tar.gz
chromium_src-37fe036a2c3e907a5790561e11292904426db144.tar.bz2
Revert r100853, 100851. Win_shared build is broken.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100854 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/ppapi_plugin/ppapi_thread.cc3
-rw-r--r--ppapi/ppapi_proxy.gypi13
-rw-r--r--ppapi/ppapi_shared.gypi2
-rw-r--r--ppapi/proxy/dispatcher.cc275
-rw-r--r--ppapi/proxy/dispatcher.h26
-rw-r--r--ppapi/proxy/enter_proxy.h20
-rw-r--r--ppapi/proxy/host_dispatcher.cc99
-rw-r--r--ppapi/proxy/host_dispatcher.h37
-rw-r--r--ppapi/proxy/host_dispatcher_unittest.cc2
-rw-r--r--ppapi/proxy/interface_id.h5
-rw-r--r--ppapi/proxy/interface_list.cc296
-rw-r--r--ppapi/proxy/interface_list.h77
-rw-r--r--ppapi/proxy/interface_proxy.cc6
-rw-r--r--ppapi/proxy/interface_proxy.h21
-rw-r--r--ppapi/proxy/plugin_dispatcher.cc109
-rw-r--r--ppapi/proxy/plugin_dispatcher.h21
-rw-r--r--ppapi/proxy/plugin_dispatcher_unittest.cc7
-rw-r--r--ppapi/proxy/ppapi_messages.h20
-rw-r--r--ppapi/proxy/ppb_audio_config_proxy.cc52
-rw-r--r--ppapi/proxy/ppb_audio_config_proxy.h36
-rw-r--r--ppapi/proxy/ppb_audio_proxy.cc33
-rw-r--r--ppapi/proxy/ppb_audio_proxy.h10
-rw-r--r--ppapi/proxy/ppb_broker_proxy.cc37
-rw-r--r--ppapi/proxy/ppb_broker_proxy.h10
-rw-r--r--ppapi/proxy/ppb_buffer_proxy.cc36
-rw-r--r--ppapi/proxy/ppb_buffer_proxy.h10
-rw-r--r--ppapi/proxy/ppb_char_set_proxy.cc40
-rw-r--r--ppapi/proxy/ppb_char_set_proxy.h11
-rw-r--r--ppapi/proxy/ppb_console_proxy.cc103
-rw-r--r--ppapi/proxy/ppb_console_proxy.h48
-rw-r--r--ppapi/proxy/ppb_context_3d_proxy.cc36
-rw-r--r--ppapi/proxy/ppb_context_3d_proxy.h7
-rw-r--r--ppapi/proxy/ppb_core_proxy.cc30
-rw-r--r--ppapi/proxy/ppb_core_proxy.h16
-rw-r--r--ppapi/proxy/ppb_crypto_proxy.cc10
-rw-r--r--ppapi/proxy/ppb_crypto_proxy.h2
-rw-r--r--ppapi/proxy/ppb_cursor_control_proxy.cc26
-rw-r--r--ppapi/proxy/ppb_cursor_control_proxy.h11
-rw-r--r--ppapi/proxy/ppb_file_chooser_proxy.cc90
-rw-r--r--ppapi/proxy/ppb_file_chooser_proxy.h11
-rw-r--r--ppapi/proxy/ppb_file_ref_proxy.cc27
-rw-r--r--ppapi/proxy/ppb_file_ref_proxy.h6
-rw-r--r--ppapi/proxy/ppb_file_system_proxy.cc12
-rw-r--r--ppapi/proxy/ppb_file_system_proxy.h4
-rw-r--r--ppapi/proxy/ppb_flash_clipboard_proxy.cc21
-rw-r--r--ppapi/proxy/ppb_flash_clipboard_proxy.h12
-rw-r--r--ppapi/proxy/ppb_flash_file_proxy.cc66
-rw-r--r--ppapi/proxy/ppb_flash_file_proxy.h28
-rw-r--r--ppapi/proxy/ppb_flash_menu_proxy.cc12
-rw-r--r--ppapi/proxy/ppb_flash_menu_proxy.h2
-rw-r--r--ppapi/proxy/ppb_flash_net_connector_proxy.cc11
-rw-r--r--ppapi/proxy/ppb_flash_net_connector_proxy.h3
-rw-r--r--ppapi/proxy/ppb_flash_proxy.cc39
-rw-r--r--ppapi/proxy/ppb_flash_proxy.h13
-rw-r--r--ppapi/proxy/ppb_flash_tcp_socket_proxy.cc11
-rw-r--r--ppapi/proxy/ppb_flash_tcp_socket_proxy.h3
-rw-r--r--ppapi/proxy/ppb_font_proxy.cc22
-rw-r--r--ppapi/proxy/ppb_font_proxy.h11
-rw-r--r--ppapi/proxy/ppb_graphics_2d_proxy.cc26
-rw-r--r--ppapi/proxy/ppb_graphics_2d_proxy.h12
-rw-r--r--ppapi/proxy/ppb_graphics_3d_proxy.cc23
-rw-r--r--ppapi/proxy/ppb_graphics_3d_proxy.h10
-rw-r--r--ppapi/proxy/ppb_image_data_proxy.cc37
-rw-r--r--ppapi/proxy/ppb_image_data_proxy.h15
-rw-r--r--ppapi/proxy/ppb_input_event_proxy.cc105
-rw-r--r--ppapi/proxy/ppb_input_event_proxy.h40
-rw-r--r--ppapi/proxy/ppb_instance_proxy.cc122
-rw-r--r--ppapi/proxy/ppb_instance_proxy.h23
-rw-r--r--ppapi/proxy/ppb_memory_proxy.cc31
-rw-r--r--ppapi/proxy/ppb_memory_proxy.h18
-rw-r--r--ppapi/proxy/ppb_opengles2_proxy.cc44
-rw-r--r--ppapi/proxy/ppb_opengles2_proxy.h33
-rw-r--r--ppapi/proxy/ppb_pdf_proxy.cc21
-rw-r--r--ppapi/proxy/ppb_pdf_proxy.h11
-rw-r--r--ppapi/proxy/ppb_surface_3d_proxy.cc14
-rw-r--r--ppapi/proxy/ppb_surface_3d_proxy.h4
-rw-r--r--ppapi/proxy/ppb_testing_proxy.cc23
-rw-r--r--ppapi/proxy/ppb_testing_proxy.h11
-rw-r--r--ppapi/proxy/ppb_url_loader_proxy.cc27
-rw-r--r--ppapi/proxy/ppb_url_loader_proxy.h9
-rw-r--r--ppapi/proxy/ppb_url_request_info_proxy.cc50
-rw-r--r--ppapi/proxy/ppb_url_request_info_proxy.h36
-rw-r--r--ppapi/proxy/ppb_url_response_info_proxy.cc31
-rw-r--r--ppapi/proxy/ppb_url_response_info_proxy.h7
-rw-r--r--ppapi/proxy/ppb_url_util_proxy.cc27
-rw-r--r--ppapi/proxy/ppb_url_util_proxy.h11
-rw-r--r--ppapi/proxy/ppb_var_deprecated_proxy.cc39
-rw-r--r--ppapi/proxy/ppb_var_deprecated_proxy.h11
-rw-r--r--ppapi/proxy/ppb_var_proxy.cc31
-rw-r--r--ppapi/proxy/ppb_var_proxy.h21
-rw-r--r--ppapi/proxy/ppb_var_unittest.cc4
-rw-r--r--ppapi/proxy/ppb_video_capture_proxy.cc67
-rw-r--r--ppapi/proxy/ppb_video_capture_proxy.h27
-rw-r--r--ppapi/proxy/ppb_video_decoder_proxy.cc71
-rw-r--r--ppapi/proxy/ppb_video_decoder_proxy.h8
-rw-r--r--ppapi/proxy/ppp_class_proxy.cc7
-rw-r--r--ppapi/proxy/ppp_class_proxy.h4
-rw-r--r--ppapi/proxy/ppp_graphics_3d_proxy.cc19
-rw-r--r--ppapi/proxy/ppp_graphics_3d_proxy.h13
-rw-r--r--ppapi/proxy/ppp_input_event_proxy.cc22
-rw-r--r--ppapi/proxy/ppp_input_event_proxy.h13
-rw-r--r--ppapi/proxy/ppp_instance_private_proxy.cc17
-rw-r--r--ppapi/proxy/ppp_instance_private_proxy.h14
-rw-r--r--ppapi/proxy/ppp_instance_proxy.cc25
-rw-r--r--ppapi/proxy/ppp_instance_proxy.h7
-rw-r--r--ppapi/proxy/ppp_messaging_proxy.cc17
-rw-r--r--ppapi/proxy/ppp_messaging_proxy.h13
-rw-r--r--ppapi/proxy/ppp_mouse_lock_proxy.cc18
-rw-r--r--ppapi/proxy/ppp_mouse_lock_proxy.h13
-rw-r--r--ppapi/proxy/ppp_video_decoder_proxy.cc25
-rw-r--r--ppapi/proxy/ppp_video_decoder_proxy.h11
-rw-r--r--ppapi/proxy/resource_creation_proxy.cc13
-rw-r--r--ppapi/proxy/resource_creation_proxy.h14
-rw-r--r--ppapi/thunk/enter.cc28
-rw-r--r--ppapi/thunk/enter.h21
-rw-r--r--ppapi/thunk/interfaces_postamble.h25
-rw-r--r--ppapi/thunk/interfaces_ppb_private.h14
-rw-r--r--ppapi/thunk/interfaces_ppb_public_dev.h42
-rw-r--r--ppapi/thunk/interfaces_ppb_public_stable.h78
-rw-r--r--ppapi/thunk/interfaces_preamble.h31
-rw-r--r--ppapi/thunk/ppb_buffer_thunk.cc2
-rw-r--r--ppapi/thunk/ppb_char_set_thunk.cc2
-rw-r--r--ppapi/thunk/ppb_console_thunk.cc42
-rw-r--r--ppapi/thunk/ppb_context_3d_thunk.cc2
-rw-r--r--ppapi/thunk/ppb_cursor_control_thunk.cc2
-rw-r--r--ppapi/thunk/ppb_directory_reader_thunk.cc2
-rw-r--r--ppapi/thunk/ppb_file_chooser_thunk.cc2
-rw-r--r--ppapi/thunk/ppb_font_thunk.cc2
-rw-r--r--ppapi/thunk/ppb_gles_chromium_texture_mapping_thunk.cc2
-rw-r--r--ppapi/thunk/ppb_input_event_thunk.cc2
-rw-r--r--ppapi/thunk/ppb_instance_api.h9
-rw-r--r--ppapi/thunk/ppb_instance_thunk.cc6
-rw-r--r--ppapi/thunk/ppb_mouse_lock_thunk.cc2
-rw-r--r--ppapi/thunk/ppb_surface_3d_thunk.cc2
-rw-r--r--ppapi/thunk/ppb_transport_thunk.cc2
-rw-r--r--ppapi/thunk/ppb_video_capture_thunk.cc2
-rw-r--r--ppapi/thunk/ppb_video_decoder_thunk.cc2
-rw-r--r--ppapi/thunk/ppb_video_layer_thunk.cc2
-rw-r--r--ppapi/thunk/ppb_widget_thunk.cc2
-rw-r--r--ppapi/thunk/thunk.h80
-rw-r--r--webkit/glue/webkit_glue.gypi2
-rw-r--r--webkit/plugins/ppapi/plugin_module.cc102
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.cc46
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.h7
-rw-r--r--webkit/plugins/ppapi/ppb_console_impl.cc87
-rw-r--r--webkit/plugins/ppapi/ppb_console_impl.h23
-rw-r--r--webkit/plugins/ppapi/ppb_url_request_info_impl.cc3
147 files changed, 2426 insertions, 1624 deletions
diff --git a/content/ppapi_plugin/ppapi_thread.cc b/content/ppapi_plugin/ppapi_thread.cc
index 02b1a43..45983ba 100644
--- a/content/ppapi_plugin/ppapi_thread.cc
+++ b/content/ppapi_plugin/ppapi_thread.cc
@@ -22,7 +22,6 @@
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppp.h"
#include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/proxy/interface_list.h"
#include "webkit/plugins/ppapi/webkit_forwarding_impl.h"
#if defined(OS_WIN)
@@ -210,7 +209,7 @@ void PpapiThread::OnMsgLoadPlugin(const FilePath& path) {
}
int32_t init_error = init_module(
local_pp_module_,
- &ppapi::proxy::PluginDispatcher::GetBrowserInterface);
+ &ppapi::proxy::PluginDispatcher::GetInterfaceFromDispatcher);
if (init_error != PP_OK) {
LOG(WARNING) << "InitModule failed with error " << init_error;
return;
diff --git a/ppapi/ppapi_proxy.gypi b/ppapi/ppapi_proxy.gypi
index f8f236f..02a2420 100644
--- a/ppapi/ppapi_proxy.gypi
+++ b/ppapi/ppapi_proxy.gypi
@@ -33,13 +33,10 @@
'proxy/broker_dispatcher.h',
'proxy/dispatcher.cc',
'proxy/dispatcher.h',
- 'proxy/enter_proxy.h',
'proxy/host_dispatcher.cc',
'proxy/host_dispatcher.h',
'proxy/host_var_serialization_rules.cc',
'proxy/host_var_serialization_rules.h',
- 'proxy/interface_list.cc',
- 'proxy/interface_list.h',
'proxy/interface_proxy.cc',
'proxy/interface_proxy.h',
'proxy/plugin_dispatcher.cc',
@@ -56,6 +53,8 @@
'proxy/ppapi_messages.h',
'proxy/ppapi_param_traits.cc',
'proxy/ppapi_param_traits.h',
+ 'proxy/ppb_audio_config_proxy.cc',
+ 'proxy/ppb_audio_config_proxy.h',
'proxy/ppb_audio_proxy.cc',
'proxy/ppb_audio_proxy.h',
'proxy/ppb_broker_proxy.cc',
@@ -64,6 +63,8 @@
'proxy/ppb_buffer_proxy.h',
'proxy/ppb_char_set_proxy.cc',
'proxy/ppb_char_set_proxy.h',
+ 'proxy/ppb_console_proxy.cc',
+ 'proxy/ppb_console_proxy.h',
'proxy/ppb_context_3d_proxy.cc',
'proxy/ppb_context_3d_proxy.h',
'proxy/ppb_core_proxy.cc',
@@ -98,10 +99,14 @@
'proxy/ppb_graphics_3d_proxy.h',
'proxy/ppb_image_data_proxy.cc',
'proxy/ppb_image_data_proxy.h',
+ 'proxy/ppb_input_event_proxy.cc',
+ 'proxy/ppb_input_event_proxy.h',
'proxy/ppb_instance_proxy.cc',
'proxy/ppb_instance_proxy.h',
'proxy/ppb_memory_proxy.cc',
'proxy/ppb_memory_proxy.h',
+ 'proxy/ppb_opengles2_proxy.cc',
+ 'proxy/ppb_opengles2_proxy.h',
'proxy/ppb_pdf_proxy.cc',
'proxy/ppb_pdf_proxy.h',
'proxy/ppb_surface_3d_proxy.cc',
@@ -110,6 +115,8 @@
'proxy/ppb_testing_proxy.h',
'proxy/ppb_url_loader_proxy.cc',
'proxy/ppb_url_loader_proxy.h',
+ 'proxy/ppb_url_request_info_proxy.cc',
+ 'proxy/ppb_url_request_info_proxy.h',
'proxy/ppb_url_response_info_proxy.cc',
'proxy/ppb_url_response_info_proxy.h',
'proxy/ppb_url_util_proxy.cc',
diff --git a/ppapi/ppapi_shared.gypi b/ppapi/ppapi_shared.gypi
index b029721..714a512 100644
--- a/ppapi/ppapi_shared.gypi
+++ b/ppapi/ppapi_shared.gypi
@@ -85,7 +85,6 @@
'thunk/common.h',
'thunk/common.cc',
- 'thunk/enter.cc',
'thunk/enter.h',
'thunk/ppb_audio_api.h',
'thunk/ppb_audio_config_api.h',
@@ -100,7 +99,6 @@
'thunk/ppb_buffer_trusted_thunk.cc',
'thunk/ppb_char_set_api.h',
'thunk/ppb_char_set_thunk.cc',
- 'thunk/ppb_console_thunk.cc',
'thunk/ppb_context_3d_api.h',
'thunk/ppb_context_3d_thunk.cc',
'thunk/ppb_context_3d_trusted_thunk.cc',
diff --git a/ppapi/proxy/dispatcher.cc b/ppapi/proxy/dispatcher.cc
index 8381c6a..d77c905 100644
--- a/ppapi/proxy/dispatcher.cc
+++ b/ppapi/proxy/dispatcher.cc
@@ -11,12 +11,209 @@
#include "base/compiler_specific.h"
#include "base/logging.h"
#include "base/memory/singleton.h"
+#include "ppapi/c/dev/ppb_buffer_dev.h"
+#include "ppapi/c/dev/ppb_char_set_dev.h"
+#include "ppapi/c/dev/ppb_context_3d_dev.h"
+#include "ppapi/c/dev/ppb_crypto_dev.h"
+#include "ppapi/c/dev/ppb_cursor_control_dev.h"
+#include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h"
+#include "ppapi/c/dev/ppb_font_dev.h"
+#include "ppapi/c/dev/ppb_surface_3d_dev.h"
+#include "ppapi/c/dev/ppb_testing_dev.h"
+#include "ppapi/c/dev/ppb_url_util_dev.h"
+#include "ppapi/c/dev/ppb_var_deprecated.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_audio.h"
+#include "ppapi/c/ppb_audio_config.h"
+#include "ppapi/c/ppb_core.h"
+#include "ppapi/c/ppb_graphics_2d.h"
+#include "ppapi/c/ppb_image_data.h"
+#include "ppapi/c/ppb_instance.h"
+#include "ppapi/c/ppb_opengles.h"
+#include "ppapi/c/ppb_url_loader.h"
+#include "ppapi/c/ppb_url_request_info.h"
+#include "ppapi/c/ppb_url_response_info.h"
+#include "ppapi/c/ppb_var.h"
+#include "ppapi/c/ppp_instance.h"
+#include "ppapi/c/private/ppb_flash.h"
+#include "ppapi/c/private/ppb_flash_clipboard.h"
+#include "ppapi/c/private/ppb_flash_file.h"
+#include "ppapi/c/private/ppb_flash_menu.h"
+#include "ppapi/c/private/ppb_flash_net_connector.h"
+#include "ppapi/c/private/ppb_flash_tcp_socket.h"
+#include "ppapi/c/private/ppb_pdf.h"
+#include "ppapi/c/trusted/ppb_url_loader_trusted.h"
#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/proxy/ppb_audio_config_proxy.h"
+#include "ppapi/proxy/ppb_audio_proxy.h"
+#include "ppapi/proxy/ppb_broker_proxy.h"
+#include "ppapi/proxy/ppb_buffer_proxy.h"
+#include "ppapi/proxy/ppb_char_set_proxy.h"
+#include "ppapi/proxy/ppb_console_proxy.h"
+#include "ppapi/proxy/ppb_context_3d_proxy.h"
+#include "ppapi/proxy/ppb_core_proxy.h"
+#include "ppapi/proxy/ppb_crypto_proxy.h"
+#include "ppapi/proxy/ppb_cursor_control_proxy.h"
+#include "ppapi/proxy/ppb_file_chooser_proxy.h"
+#include "ppapi/proxy/ppb_file_ref_proxy.h"
+#include "ppapi/proxy/ppb_file_system_proxy.h"
+#include "ppapi/proxy/ppb_flash_clipboard_proxy.h"
+#include "ppapi/proxy/ppb_flash_file_proxy.h"
+#include "ppapi/proxy/ppb_flash_proxy.h"
+#include "ppapi/proxy/ppb_flash_menu_proxy.h"
+#include "ppapi/proxy/ppb_flash_net_connector_proxy.h"
+#include "ppapi/proxy/ppb_flash_tcp_socket_proxy.h"
+#include "ppapi/proxy/ppb_font_proxy.h"
+#include "ppapi/proxy/ppb_graphics_2d_proxy.h"
+#include "ppapi/proxy/ppb_graphics_3d_proxy.h"
+#include "ppapi/proxy/ppb_image_data_proxy.h"
+#include "ppapi/proxy/ppb_input_event_proxy.h"
+#include "ppapi/proxy/ppb_instance_proxy.h"
+#include "ppapi/proxy/ppb_memory_proxy.h"
+#include "ppapi/proxy/ppb_opengles2_proxy.h"
+#include "ppapi/proxy/ppb_pdf_proxy.h"
+#include "ppapi/proxy/ppb_surface_3d_proxy.h"
+#include "ppapi/proxy/ppb_testing_proxy.h"
+#include "ppapi/proxy/ppb_url_loader_proxy.h"
+#include "ppapi/proxy/ppb_url_request_info_proxy.h"
+#include "ppapi/proxy/ppb_url_response_info_proxy.h"
+#include "ppapi/proxy/ppb_url_util_proxy.h"
+#include "ppapi/proxy/ppb_var_deprecated_proxy.h"
+#include "ppapi/proxy/ppb_var_proxy.h"
+#include "ppapi/proxy/ppb_video_capture_proxy.h"
+#include "ppapi/proxy/ppb_video_decoder_proxy.h"
+#include "ppapi/proxy/ppp_class_proxy.h"
+#include "ppapi/proxy/ppp_graphics_3d_proxy.h"
+#include "ppapi/proxy/ppp_input_event_proxy.h"
+#include "ppapi/proxy/ppp_instance_private_proxy.h"
+#include "ppapi/proxy/ppp_instance_proxy.h"
+#include "ppapi/proxy/ppp_messaging_proxy.h"
+#include "ppapi/proxy/ppp_mouse_lock_proxy.h"
+#include "ppapi/proxy/ppp_video_decoder_proxy.h"
#include "ppapi/proxy/var_serialization_rules.h"
namespace ppapi {
namespace proxy {
+namespace {
+
+struct InterfaceList {
+ InterfaceList();
+
+ static InterfaceList* GetInstance();
+
+ void AddPPP(const InterfaceProxy::Info* info);
+ void AddPPB(const InterfaceProxy::Info* info);
+
+ typedef std::map<std::string, const InterfaceProxy::Info*> NameToInfo;
+ NameToInfo name_to_plugin_info_;
+ NameToInfo name_to_browser_info_;
+
+ // Note that there can be multiple interface names mapping to the same ID.
+ // In this case, the ID will map to one of them. This is temporary while
+ // we're converting to the thunk system, when that is complete, we need to
+ // have a better way of handling multiple interface implemented by one
+ // proxy object.
+ const InterfaceProxy::Info* id_to_browser_info_[INTERFACE_ID_COUNT];
+};
+
+InterfaceList::InterfaceList() {
+ memset(id_to_browser_info_, 0, sizeof(id_to_browser_info_));
+
+ // PPB (browser) interfaces.
+ AddPPB(PPB_AudioConfig_Proxy::GetInfo());
+ AddPPB(PPB_Audio_Proxy::GetInfo());
+ AddPPB(PPB_Broker_Proxy::GetInfo());
+ AddPPB(PPB_Buffer_Proxy::GetInfo());
+ AddPPB(PPB_CharSet_Proxy::GetInfo());
+ AddPPB(PPB_Console_Proxy::GetInfo());
+ AddPPB(PPB_Context3D_Proxy::GetInfo());
+ AddPPB(PPB_Context3D_Proxy::GetTextureMappingInfo());
+ AddPPB(PPB_Core_Proxy::GetInfo());
+ AddPPB(PPB_Crypto_Proxy::GetInfo());
+ AddPPB(PPB_CursorControl_Proxy::GetInfo());
+ AddPPB(PPB_FileChooser_Proxy::GetInfo());
+ AddPPB(PPB_FileChooser_Proxy::GetInfo0_4());
+ AddPPB(PPB_FileRef_Proxy::GetInfo());
+ AddPPB(PPB_FileSystem_Proxy::GetInfo());
+ AddPPB(PPB_Flash_Clipboard_Proxy::GetInfo());
+ AddPPB(PPB_Flash_File_FileRef_Proxy::GetInfo());
+ AddPPB(PPB_Flash_File_ModuleLocal_Proxy::GetInfo());
+ AddPPB(PPB_Flash_Menu_Proxy::GetInfo());
+ AddPPB(PPB_Flash_Proxy::GetInfo());
+ AddPPB(PPB_Flash_TCPSocket_Proxy::GetInfo());
+ AddPPB(PPB_Font_Proxy::GetInfo());
+ AddPPB(PPB_Graphics2D_Proxy::GetInfo());
+ AddPPB(PPB_Graphics3D_Proxy::GetInfo());
+ AddPPB(PPB_ImageData_Proxy::GetInfo());
+ AddPPB(PPB_InputEvent_Proxy::GetInputEventInfo());
+ AddPPB(PPB_InputEvent_Proxy::GetKeyboardInputEventInfo());
+ AddPPB(PPB_InputEvent_Proxy::GetMouseInputEventInfo1_0());
+ AddPPB(PPB_InputEvent_Proxy::GetMouseInputEventInfo1_1());
+ AddPPB(PPB_InputEvent_Proxy::GetWheelInputEventInfo());
+ AddPPB(PPB_Instance_Proxy::GetInfo0_5());
+ AddPPB(PPB_Instance_Proxy::GetInfo1_0());
+ AddPPB(PPB_Instance_Proxy::GetInfoFullscreen());
+ AddPPB(PPB_Instance_Proxy::GetInfoMessaging());
+ AddPPB(PPB_Instance_Proxy::GetInfoMouseLock());
+ AddPPB(PPB_Instance_Proxy::GetInfoPrivate());
+ AddPPB(PPB_Memory_Proxy::GetInfo());
+ AddPPB(PPB_OpenGLES2_Proxy::GetInfo());
+ AddPPB(PPB_PDF_Proxy::GetInfo());
+ AddPPB(PPB_Surface3D_Proxy::GetInfo());
+ AddPPB(PPB_Testing_Proxy::GetInfo());
+ AddPPB(PPB_URLLoader_Proxy::GetInfo());
+ AddPPB(PPB_URLLoader_Proxy::GetTrustedInfo());
+ AddPPB(PPB_URLRequestInfo_Proxy::GetInfo());
+ AddPPB(PPB_URLResponseInfo_Proxy::GetInfo());
+ AddPPB(PPB_URLUtil_Proxy::GetInfo());
+ AddPPB(PPB_Var_Deprecated_Proxy::GetInfo());
+ AddPPB(PPB_Var_Proxy::GetInfo());
+ AddPPB(PPB_VideoCapture_Proxy::GetInfo());
+ AddPPB(PPB_VideoDecoder_Proxy::GetInfo());
+
+#ifdef ENABLE_FLAPPER_HACKS
+ AddPPB(PPB_Flash_NetConnector_Proxy::GetInfo());
+#endif
+
+ // PPP (plugin) interfaces.
+ AddPPP(PPP_Graphics3D_Proxy::GetInfo());
+ AddPPP(PPP_InputEvent_Proxy::GetInfo());
+ AddPPP(PPP_Instance_Private_Proxy::GetInfo());
+ AddPPP(PPP_Instance_Proxy::GetInfo1_0());
+ AddPPP(PPP_Messaging_Proxy::GetInfo());
+ AddPPP(PPP_MouseLock_Proxy::GetInfo());
+ AddPPP(PPP_VideoCapture_Proxy::GetInfo());
+ AddPPP(PPP_VideoDecoder_Proxy::GetInfo());
+}
+
+void InterfaceList::AddPPP(const InterfaceProxy::Info* info) {
+ DCHECK(name_to_plugin_info_.find(info->name) ==
+ name_to_plugin_info_.end());
+ DCHECK(info->id >= INTERFACE_ID_NONE && info->id < INTERFACE_ID_COUNT);
+
+ name_to_plugin_info_[info->name] = info;
+}
+
+void InterfaceList::AddPPB(const InterfaceProxy::Info* info) {
+ DCHECK(name_to_browser_info_.find(info->name) ==
+ name_to_browser_info_.end());
+ DCHECK(info->id >= INTERFACE_ID_NONE && info->id < INTERFACE_ID_COUNT);
+ DCHECK(info->id == INTERFACE_ID_NONE ||
+ id_to_browser_info_[info->id] == NULL);
+
+ name_to_browser_info_[std::string(info->name)] = info;
+ if (info->id != INTERFACE_ID_NONE)
+ id_to_browser_info_[info->id] = info;
+}
+
+// static
+InterfaceList* InterfaceList::GetInstance() {
+ return Singleton<InterfaceList>::get();
+}
+
+} // namespace
+
Dispatcher::Dispatcher(base::ProcessHandle remote_process_handle,
GetInterfaceFunc local_get_interface)
: ProxyChannel(remote_process_handle),
@@ -28,32 +225,6 @@ Dispatcher::Dispatcher(base::ProcessHandle remote_process_handle,
Dispatcher::~Dispatcher() {
}
-InterfaceProxy* Dispatcher::GetInterfaceProxy(InterfaceID id) {
- InterfaceProxy* proxy = proxies_[id].get();
- if (!proxy) {
- // Handle the first time for a given API by creating the proxy for it.
- InterfaceProxy::Factory factory =
- InterfaceList::GetInstance()->GetFactoryForID(id);
- if (!factory) {
- NOTREACHED();
- return NULL;
- }
- proxy = factory(this);
- DCHECK(proxy);
- proxies_[id].reset(proxy);
- }
- return proxy;
-}
-
-base::MessageLoopProxy* Dispatcher::GetIPCMessageLoop() {
- return delegate()->GetIPCMessageLoop();
-}
-
-void Dispatcher::AddIOThreadMessageFilter(
- IPC::ChannelProxy::MessageFilter* filter) {
- channel()->AddFilter(filter);
-}
-
bool Dispatcher::OnMessageReceived(const IPC::Message& msg) {
// Control messages.
if (msg.routing_id() == MSG_ROUTING_CONTROL) {
@@ -65,19 +236,37 @@ bool Dispatcher::OnMessageReceived(const IPC::Message& msg) {
IPC_END_MESSAGE_MAP()
return handled;
}
+ return false;
+}
- if (msg.routing_id() <= 0 || msg.routing_id() >= INTERFACE_ID_COUNT) {
- OnInvalidMessageReceived();
- return true;
- }
+// static
+const InterfaceProxy::Info* Dispatcher::GetPPBInterfaceInfo(
+ const std::string& name) {
+ const InterfaceList* list = InterfaceList::GetInstance();
+ InterfaceList::NameToInfo::const_iterator found =
+ list->name_to_browser_info_.find(name);
+ if (found == list->name_to_browser_info_.end())
+ return NULL;
+ return found->second;
+}
- InterfaceProxy* proxy = GetInterfaceProxy(
- static_cast<InterfaceID>(msg.routing_id()));
- if (!proxy) {
- NOTREACHED();
- return true;
- }
- return proxy->OnMessageReceived(msg);
+// static
+const InterfaceProxy::Info* Dispatcher::GetPPBInterfaceInfo(InterfaceID id) {
+ if (id <= 0 || id >= INTERFACE_ID_COUNT)
+ return NULL;
+ const InterfaceList* list = InterfaceList::GetInstance();
+ return list->id_to_browser_info_[id];
+}
+
+// static
+const InterfaceProxy::Info* Dispatcher::GetPPPInterfaceInfo(
+ const std::string& name) {
+ const InterfaceList* list = InterfaceList::GetInstance();
+ InterfaceList::NameToInfo::const_iterator found =
+ list->name_to_plugin_info_.find(name);
+ if (found == list->name_to_plugin_info_.end())
+ return NULL;
+ return found->second;
}
void Dispatcher::SetSerializationRules(
@@ -85,7 +274,17 @@ void Dispatcher::SetSerializationRules(
serialization_rules_.reset(var_serialization_rules);
}
-void Dispatcher::OnInvalidMessageReceived() {
+const void* Dispatcher::GetLocalInterface(const char* interface_name) {
+ return local_get_interface_(interface_name);
+}
+
+base::MessageLoopProxy* Dispatcher::GetIPCMessageLoop() {
+ return delegate()->GetIPCMessageLoop();
+}
+
+void Dispatcher::AddIOThreadMessageFilter(
+ IPC::ChannelProxy::MessageFilter* filter) {
+ channel()->AddFilter(filter);
}
} // namespace proxy
diff --git a/ppapi/proxy/dispatcher.h b/ppapi/proxy/dispatcher.h
index a48cff7..bf3e36f 100644
--- a/ppapi/proxy/dispatcher.h
+++ b/ppapi/proxy/dispatcher.h
@@ -17,7 +17,6 @@
#include "ppapi/proxy/callback_tracker.h"
#include "ppapi/proxy/proxy_channel.h"
#include "ppapi/proxy/interface_id.h"
-#include "ppapi/proxy/interface_list.h"
#include "ppapi/proxy/interface_proxy.h"
#include "ppapi/proxy/plugin_var_tracker.h"
@@ -58,10 +57,8 @@ class PPAPI_PROXY_EXPORT Dispatcher : public ProxyChannel {
return serialization_rules_.get();
}
- // Returns a non-owning pointer to the interface proxy for the given ID, or
- // NULL if the ID isn't found. This will create the proxy if it hasn't been
- // created so far.
- InterfaceProxy* GetInterfaceProxy(InterfaceID id);
+ // Wrapper for calling the local GetInterface function.
+ const void* GetLocalInterface(const char* interface_name);
// Returns the pointer to the IO thread for processing IPC messages.
// TODO(brettw) remove this. It's a hack to support the Flash
@@ -87,7 +84,14 @@ class PPAPI_PROXY_EXPORT Dispatcher : public ProxyChannel {
return callback_tracker_;
}
- GetInterfaceFunc local_get_interface() const { return local_get_interface_; }
+ // Retrieves the information associated with the given interface, identified
+ // either by name or ID. Each function searches either PPP or PPB interfaces.
+ static const InterfaceProxy::Info* GetPPBInterfaceInfo(
+ const std::string& name);
+ static const InterfaceProxy::Info* GetPPBInterfaceInfo(
+ InterfaceID id);
+ static const InterfaceProxy::Info* GetPPPInterfaceInfo(
+ const std::string& name);
protected:
Dispatcher(base::ProcessHandle remote_process_handle,
@@ -97,21 +101,11 @@ class PPAPI_PROXY_EXPORT Dispatcher : public ProxyChannel {
// Takes ownership of the given pointer, which must be on the heap.
void SetSerializationRules(VarSerializationRules* var_serialization_rules);
- // Called when an invalid message is received from the remote site. The
- // default implementation does nothing, derived classes can override.
- virtual void OnInvalidMessageReceived();
-
bool disallow_trusted_interfaces() const {
return disallow_trusted_interfaces_;
}
private:
- friend class HostDispatcherTest;
- friend class PluginDispatcherTest;
-
- // Lists all lazily-created interface proxies.
- scoped_ptr<InterfaceProxy> proxies_[INTERFACE_ID_COUNT];
-
bool disallow_trusted_interfaces_;
GetInterfaceFunc local_get_interface_;
diff --git a/ppapi/proxy/enter_proxy.h b/ppapi/proxy/enter_proxy.h
index d7bf7c2..6852780 100644
--- a/ppapi/proxy/enter_proxy.h
+++ b/ppapi/proxy/enter_proxy.h
@@ -13,11 +13,6 @@
#include "ppapi/thunk/enter.h"
namespace ppapi {
-
-namespace thunk {
-class ResourceCreationAPI;
-}
-
namespace proxy {
// Wrapper around EnterResourceNoLock that takes a host resource. This is used
@@ -120,21 +115,6 @@ class EnterHostFromHostResourceForceCallback
RunCallback(PP_ERROR_BADRESOURCE);
}
- // For callbacks that take two extra parameters as a closure.
- template<class CallbackFactory, typename Method, typename A, typename B>
- EnterHostFromHostResourceForceCallback(
- const HostResource& host_resource,
- CallbackFactory& factory,
- Method method,
- const A& a,
- const B& b)
- : EnterHostFromHostResource<ResourceT>(host_resource),
- needs_running_(true),
- callback_(factory.NewOptionalCallback(method, a, b)) {
- if (this->failed())
- RunCallback(PP_ERROR_BADRESOURCE);
- }
-
~EnterHostFromHostResourceForceCallback() {
if (needs_running_) {
NOTREACHED() << "Should always call SetResult except in the "
diff --git a/ppapi/proxy/host_dispatcher.cc b/ppapi/proxy/host_dispatcher.cc
index a9f14f4..c5bf08f 100644
--- a/ppapi/proxy/host_dispatcher.cc
+++ b/ppapi/proxy/host_dispatcher.cc
@@ -11,7 +11,6 @@
#include "ppapi/c/private/ppb_proxy_private.h"
#include "ppapi/c/ppb_var.h"
#include "ppapi/proxy/host_var_serialization_rules.h"
-#include "ppapi/proxy/interface_list.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/resource_creation_proxy.h"
@@ -76,7 +75,7 @@ HostDispatcher::HostDispatcher(base::ProcessHandle remote_process_handle,
SetSerializationRules(new HostVarSerializationRules(var_interface, module));
ppb_proxy_ = reinterpret_cast<const PPB_Proxy_Private*>(
- local_get_interface(PPB_PROXY_PRIVATE_INTERFACE));
+ GetLocalInterface(PPB_PROXY_PRIVATE_INTERFACE));
DCHECK(ppb_proxy_) << "The proxy interface should always be supported.";
ppb_proxy_->SetReserveInstanceIDCallback(pp_module_, &ReserveInstanceID);
@@ -157,7 +156,39 @@ bool HostDispatcher::OnMessageReceived(const IPC::Message& msg) {
BoolRestorer restorer(&allow_plugin_reentrancy_);
allow_plugin_reentrancy_ = false;
- return Dispatcher::OnMessageReceived(msg);
+ // Handle common control messages.
+ if (Dispatcher::OnMessageReceived(msg))
+ return true;
+
+ if (msg.routing_id() <= 0 || msg.routing_id() >= INTERFACE_ID_COUNT) {
+ NOTREACHED();
+ // TODO(brettw): kill the plugin if it starts sending invalid messages?
+ return true;
+ }
+
+ // New-style function proxies.
+ // TODO(brettw) this is hacked in for the routing for the types we've
+ // implemented in this style so far. When everything is implemented in this
+ // style, this function should be cleaned up.
+ if (msg.routing_id() == INTERFACE_ID_RESOURCE_CREATION) {
+ ResourceCreationProxy proxy(this);
+ return proxy.OnMessageReceived(msg);
+ }
+
+ InterfaceProxy* proxy = target_proxies_[msg.routing_id()].get();
+ if (!proxy) {
+ // Autocreate any proxy objects to handle requests from the plugin. Since
+ // we always support all known PPB_* interfaces (modulo the trusted bit),
+ // there's very little checking necessary.
+ const InterfaceProxy::Info* info = GetPPBInterfaceInfo(
+ static_cast<InterfaceID>(msg.routing_id()));
+ if (!info ||
+ (info->is_trusted && disallow_trusted_interfaces()))
+ return true;
+ proxy = CreatePPBInterfaceProxy(info);
+ }
+
+ return proxy->OnMessageReceived(msg);
}
void HostDispatcher::OnChannelError() {
@@ -167,35 +198,67 @@ void HostDispatcher::OnChannelError() {
ppb_proxy_->PluginCrashed(pp_module());
}
-const void* HostDispatcher::GetProxiedInterface(const std::string& iface_name) {
- const void* proxied_interface =
- InterfaceList::GetInstance()->GetInterfaceForPPP(iface_name);
- if (!proxied_interface)
- return NULL; // Don't have a proxy for this interface, don't query further.
+const void* HostDispatcher::GetProxiedInterface(
+ const std::string& proxied_interface) {
+ // First see if we even have a proxy for this interface.
+ const InterfaceProxy::Info* info = GetPPPInterfaceInfo(proxied_interface);
+ if (!info)
+ return NULL;
- PluginSupportedMap::iterator iter(plugin_supported_.find(iface_name));
- if (iter == plugin_supported_.end()) {
+ PluginIFSupportedMap::iterator iter(plugin_if_supported_.find(
+ proxied_interface));
+ if (iter == plugin_if_supported_.end()) {
// Need to query. Cache the result so we only do this once.
bool supported = false;
bool previous_reentrancy_value = allow_plugin_reentrancy_;
allow_plugin_reentrancy_ = true;
- Send(new PpapiMsg_SupportsInterface(iface_name, &supported));
+ Send(new PpapiMsg_SupportsInterface(proxied_interface, &supported));
allow_plugin_reentrancy_ = previous_reentrancy_value;
- std::pair<PluginSupportedMap::iterator, bool> iter_success_pair;
- iter_success_pair = plugin_supported_.insert(
- PluginSupportedMap::value_type(iface_name, supported));
+ std::pair<PluginIFSupportedMap::iterator, bool> iter_success_pair;
+ iter_success_pair = plugin_if_supported_.insert(
+ PluginIFSupportedMap::value_type(proxied_interface, supported));
iter = iter_success_pair.first;
}
if (iter->second)
- return proxied_interface;
+ return info->interface_ptr;
return NULL;
}
-void HostDispatcher::OnInvalidMessageReceived() {
- // TODO(brettw) bug 95345 kill the plugin when an invalid message is
- // received.
+InterfaceProxy* HostDispatcher::GetOrCreatePPBInterfaceProxy(
+ InterfaceID id) {
+ InterfaceProxy* proxy = target_proxies_[id].get();
+ if (!proxy) {
+ const InterfaceProxy::Info* info = GetPPBInterfaceInfo(id);
+ if (!info)
+ return NULL;
+
+ // Sanity check. This function won't normally be called for trusted
+ // interfaces, but in case somebody does this, we don't want to then give
+ // the plugin the ability to call that trusted interface (since the
+ // checking occurs at proxy-creation time).
+ if (info->is_trusted && disallow_trusted_interfaces())
+ return NULL;
+
+ proxy = CreatePPBInterfaceProxy(info);
+ }
+ return proxy;
+}
+
+InterfaceProxy* HostDispatcher::CreatePPBInterfaceProxy(
+ const InterfaceProxy::Info* info) {
+ const void* local_interface = GetLocalInterface(info->name);
+ if (!local_interface) {
+ // This should always succeed since the browser should support the stuff
+ // the proxy does. If this happens, something is out of sync.
+ NOTREACHED();
+ return NULL;
+ }
+
+ InterfaceProxy* proxy = info->create_proxy(this, local_interface);
+ target_proxies_[info->id].reset(proxy);
+ return proxy;
}
// ScopedModuleReference -------------------------------------------------------
diff --git a/ppapi/proxy/host_dispatcher.h b/ppapi/proxy/host_dispatcher.h
index 10fca5c..623aa26 100644
--- a/ppapi/proxy/host_dispatcher.h
+++ b/ppapi/proxy/host_dispatcher.h
@@ -32,6 +32,7 @@ struct Preferences;
namespace proxy {
+class InterfaceProxy;
class VarSerialization;
class PPAPI_PROXY_EXPORT HostDispatcher : public Dispatcher {
@@ -79,11 +80,18 @@ class PPAPI_PROXY_EXPORT HostDispatcher : public Dispatcher {
// if the plugin supports the given interface (with caching) and returns the
// pointer to the proxied interface if it is supported. Returns NULL if the
// given interface isn't supported by the plugin or the proxy.
- const void* GetProxiedInterface(const std::string& iface_name);
+ const void* GetProxiedInterface(const std::string& proxied_interface);
+
+ // Returns the proxy object associated with the given interface ID, creating
+ // it if necessary. This is used in cases where a proxy needs to access code
+ // in the proxy for another interface. It's assumed that the interface always
+ // exists, so this is only used for browser proxies.
+ //
+ // Will return NULL if an interface isn't supported.
+ InterfaceProxy* GetOrCreatePPBInterfaceProxy(InterfaceID id);
// See the value below. Call this when processing a scripting message from
- // the plugin that can be reentered. This is set to false at the beginning
- // of processing of each message from the plugin.
+ // the plugin that can be reentered.
void set_allow_plugin_reentrancy() {
allow_plugin_reentrancy_ = true;
}
@@ -91,17 +99,28 @@ class PPAPI_PROXY_EXPORT HostDispatcher : public Dispatcher {
// Returns the proxy interface for talking to the implementation.
const PPB_Proxy_Private* ppb_proxy() const { return ppb_proxy_; }
- protected:
- // Overridden from Dispatcher.
- virtual void OnInvalidMessageReceived();
-
private:
+ friend class HostDispatcherTest;
+
+ // Makes an instance of the given PPB interface proxy, storing it in the
+ // target_proxies_ array. An proxy for this interface must not exist yet.
+ InterfaceProxy* CreatePPBInterfaceProxy(const InterfaceProxy::Info* info);
+
PP_Module pp_module_;
+ typedef std::map<std::string, bool> PluginIFSupportedMap;
// Maps interface name to whether that interface is supported. If an interface
// name is not in the map, that implies that we haven't queried for it yet.
- typedef base::hash_map<std::string, bool> PluginSupportedMap;
- PluginSupportedMap plugin_supported_;
+ std::map<std::string, bool> plugin_if_supported_;
+
+ // All target proxies currently created. These are ones that receive
+ // messages. They are created on demand when we receive messages.
+ scoped_ptr<InterfaceProxy> target_proxies_[INTERFACE_ID_COUNT];
+
+ // Function proxies created for "new-style" FunctionGroups.
+ // TODO(brettw) this is in progress. It should be merged with the target
+ // proxies so there is one list to consult.
+ scoped_ptr<FunctionGroupBase> function_proxies_[INTERFACE_ID_COUNT];
// Guaranteed non-NULL.
const PPB_Proxy_Private* ppb_proxy_;
diff --git a/ppapi/proxy/host_dispatcher_unittest.cc b/ppapi/proxy/host_dispatcher_unittest.cc
index 5ce8ba3..25dfa5c 100644
--- a/ppapi/proxy/host_dispatcher_unittest.cc
+++ b/ppapi/proxy/host_dispatcher_unittest.cc
@@ -17,7 +17,7 @@ class HostDispatcherTest : public HostProxyTest {
HostDispatcherTest() {}
bool HasTargetProxy(InterfaceID id) {
- return !!host_dispatcher()->proxies_[id].get();
+ return !!host_dispatcher()->target_proxies_[id].get();
}
};
diff --git a/ppapi/proxy/interface_id.h b/ppapi/proxy/interface_id.h
index 3b43943..277f964 100644
--- a/ppapi/proxy/interface_id.h
+++ b/ppapi/proxy/interface_id.h
@@ -18,6 +18,7 @@ enum InterfaceID {
INTERFACE_ID_PPB_BROKER,
INTERFACE_ID_PPB_BUFFER,
INTERFACE_ID_PPB_CHAR_SET,
+ INTERFACE_ID_PPB_CONSOLE,
INTERFACE_ID_PPB_CONTEXT_3D,
INTERFACE_ID_PPB_CORE,
INTERFACE_ID_PPB_CRYPTO,
@@ -36,15 +37,19 @@ enum InterfaceID {
INTERFACE_ID_PPB_FONT,
INTERFACE_ID_PPB_GRAPHICS_2D,
INTERFACE_ID_PPB_GRAPHICS_3D,
+ INTERFACE_ID_PPB_IMAGE_DATA,
INTERFACE_ID_PPB_INSTANCE,
INTERFACE_ID_PPB_INSTANCE_PRIVATE,
+ INTERFACE_ID_PPB_MEMORY,
INTERFACE_ID_PPB_OPENGLES2,
INTERFACE_ID_PPB_PDF,
INTERFACE_ID_PPB_SURFACE_3D,
INTERFACE_ID_PPB_TESTING,
INTERFACE_ID_PPB_URL_LOADER,
+ INTERFACE_ID_PPB_URL_REQUEST_INFO,
INTERFACE_ID_PPB_URL_RESPONSE_INFO,
INTERFACE_ID_PPB_URL_UTIL,
+ INTERFACE_ID_PPB_VAR,
INTERFACE_ID_PPB_VAR_DEPRECATED,
INTERFACE_ID_PPB_VIDEO_CAPTURE_DEV,
INTERFACE_ID_PPB_VIDEO_DECODER_DEV,
diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc
deleted file mode 100644
index 0b386aa..0000000
--- a/ppapi/proxy/interface_list.cc
+++ /dev/null
@@ -1,296 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ppapi/proxy/interface_list.h"
-
-#include "base/memory/singleton.h"
-#include "ppapi/c/dev/ppb_buffer_dev.h"
-#include "ppapi/c/dev/ppb_char_set_dev.h"
-#include "ppapi/c/dev/ppb_console_dev.h"
-#include "ppapi/c/dev/ppb_context_3d_dev.h"
-#include "ppapi/c/dev/ppb_crypto_dev.h"
-#include "ppapi/c/dev/ppb_cursor_control_dev.h"
-#include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h"
-#include "ppapi/c/dev/ppb_font_dev.h"
-#include "ppapi/c/dev/ppb_memory_dev.h"
-#include "ppapi/c/dev/ppb_mouse_lock_dev.h"
-#include "ppapi/c/dev/ppb_surface_3d_dev.h"
-#include "ppapi/c/dev/ppb_testing_dev.h"
-#include "ppapi/c/dev/ppb_url_util_dev.h"
-#include "ppapi/c/dev/ppb_var_deprecated.h"
-#include "ppapi/c/dev/ppb_video_capture_dev.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/ppb_audio.h"
-#include "ppapi/c/ppb_audio_config.h"
-#include "ppapi/c/ppb_core.h"
-#include "ppapi/c/ppb_file_ref.h"
-#include "ppapi/c/ppb_file_system.h"
-#include "ppapi/c/ppb_graphics_2d.h"
-#include "ppapi/c/ppb_image_data.h"
-#include "ppapi/c/ppb_input_event.h"
-#include "ppapi/c/ppb_instance.h"
-#include "ppapi/c/ppb_messaging.h"
-#include "ppapi/c/ppb_opengles.h"
-#include "ppapi/c/ppb_url_loader.h"
-#include "ppapi/c/ppb_url_request_info.h"
-#include "ppapi/c/ppb_url_response_info.h"
-#include "ppapi/c/ppb_var.h"
-#include "ppapi/c/ppp_instance.h"
-#include "ppapi/c/private/ppb_flash.h"
-#include "ppapi/c/private/ppb_flash_clipboard.h"
-#include "ppapi/c/private/ppb_flash_file.h"
-#include "ppapi/c/private/ppb_flash_menu.h"
-#include "ppapi/c/private/ppb_flash_net_connector.h"
-#include "ppapi/c/private/ppb_flash_tcp_socket.h"
-#include "ppapi/c/private/ppb_pdf.h"
-#include "ppapi/c/trusted/ppb_broker_trusted.h"
-#include "ppapi/c/trusted/ppb_url_loader_trusted.h"
-#include "ppapi/proxy/interface_proxy.h"
-#include "ppapi/proxy/ppb_audio_proxy.h"
-#include "ppapi/proxy/ppb_broker_proxy.h"
-#include "ppapi/proxy/ppb_buffer_proxy.h"
-#include "ppapi/proxy/ppb_char_set_proxy.h"
-#include "ppapi/proxy/ppb_context_3d_proxy.h"
-#include "ppapi/proxy/ppb_core_proxy.h"
-#include "ppapi/proxy/ppb_crypto_proxy.h"
-#include "ppapi/proxy/ppb_cursor_control_proxy.h"
-#include "ppapi/proxy/ppb_file_chooser_proxy.h"
-#include "ppapi/proxy/ppb_file_ref_proxy.h"
-#include "ppapi/proxy/ppb_file_system_proxy.h"
-#include "ppapi/proxy/ppb_flash_clipboard_proxy.h"
-#include "ppapi/proxy/ppb_flash_file_proxy.h"
-#include "ppapi/proxy/ppb_flash_proxy.h"
-#include "ppapi/proxy/ppb_flash_menu_proxy.h"
-#include "ppapi/proxy/ppb_flash_net_connector_proxy.h"
-#include "ppapi/proxy/ppb_flash_tcp_socket_proxy.h"
-#include "ppapi/proxy/ppb_font_proxy.h"
-#include "ppapi/proxy/ppb_graphics_2d_proxy.h"
-#include "ppapi/proxy/ppb_graphics_3d_proxy.h"
-#include "ppapi/proxy/ppb_image_data_proxy.h"
-#include "ppapi/proxy/ppb_instance_proxy.h"
-#include "ppapi/proxy/ppb_memory_proxy.h"
-#include "ppapi/proxy/ppp_mouse_lock_proxy.h"
-#include "ppapi/proxy/ppb_pdf_proxy.h"
-#include "ppapi/proxy/ppb_surface_3d_proxy.h"
-#include "ppapi/proxy/ppb_testing_proxy.h"
-#include "ppapi/proxy/ppb_url_loader_proxy.h"
-#include "ppapi/proxy/ppb_url_response_info_proxy.h"
-#include "ppapi/proxy/ppb_url_util_proxy.h"
-#include "ppapi/proxy/ppb_var_deprecated_proxy.h"
-#include "ppapi/proxy/ppb_var_proxy.h"
-#include "ppapi/proxy/ppb_video_capture_proxy.h"
-#include "ppapi/proxy/ppb_video_decoder_proxy.h"
-#include "ppapi/proxy/ppp_class_proxy.h"
-#include "ppapi/proxy/ppp_graphics_3d_proxy.h"
-#include "ppapi/proxy/ppp_input_event_proxy.h"
-#include "ppapi/proxy/ppp_instance_private_proxy.h"
-#include "ppapi/proxy/ppp_instance_proxy.h"
-#include "ppapi/proxy/ppp_messaging_proxy.h"
-#include "ppapi/proxy/ppp_video_decoder_proxy.h"
-#include "ppapi/proxy/resource_creation_proxy.h"
-#include "ppapi/shared_impl/opengles2_impl.h"
-#include "ppapi/thunk/thunk.h"
-
-// Helper to get the proxy name PPB_Foo_Proxy given the API name PPB_Foo.
-#define PROXY_CLASS_NAME(api_name) api_name##_Proxy
-
-// Helper to get the interface ID PPB_Foo_Proxy::kInterfaceID given the API
-// name PPB_Foo.
-#define PROXY_INTERFACE_ID(api_name) PROXY_CLASS_NAME(api_name)::kInterfaceID
-
-// Helper to get the name of the factory function CreatePPB_Foo_Proxy given
-// the API name PPB_Foo.
-#define PROXY_FACTORY_NAME(api_name) Create##api_name##_Proxy
-
-// Helper to get the name of the thunk GetPPB_Foo_1_0_Thunk given the interface
-// struct name PPB_Foo_1_0.
-#define INTERFACE_THUNK_NAME(iface_struct) thunk::Get##iface_struct##_Thunk
-
-namespace ppapi {
-namespace proxy {
-
-namespace {
-
-// The interface list has interfaces with no ID listed as "NoAPIName" which
-// means there's no corresponding _Proxy object. Our macros expand this to
-// NoAPIName_Proxy, and then they look for kInterfaceID inside it.
-//
-// This dummy class provides the correct definition for that interface ID,
-// which is "NONE".
-class NoAPIName_Proxy {
- public:
- static const InterfaceID kInterfaceID = INTERFACE_ID_NONE;
-};
-
-// Define factory functions for each interface type. These are of the form:
-// InterfaceProxy* CreatePPB_URLLoader_Proxy(...
-#define PROXIED_API(api_name) \
- InterfaceProxy* PROXY_FACTORY_NAME(api_name)(Dispatcher* dispatcher) { \
- return new PROXY_CLASS_NAME(api_name)(dispatcher); \
- }
-#include "ppapi/thunk/interfaces_ppb_public_stable.h"
-#include "ppapi/thunk/interfaces_ppb_public_dev.h"
-#include "ppapi/thunk/interfaces_ppb_private.h"
-#undef PROXIED_API
-
-} // namespace
-
-InterfaceList::InterfaceList() {
- memset(id_to_factory_, 0, sizeof(id_to_factory_));
-
- // Register the API factories for each of the API types. This calls AddProxy
- // for each InterfaceProxy type we support.
- #define PROXIED_API(api_name) \
- AddProxy(PROXY_INTERFACE_ID(api_name), &PROXY_FACTORY_NAME(api_name));
-
- // Register each proxied interface by calling AddPPB for each supported
- // interface.
- #define PROXIED_IFACE(api_name, iface_str, iface_struct) \
- AddPPB(iface_str, PROXY_INTERFACE_ID(api_name), \
- INTERFACE_THUNK_NAME(iface_struct)());
-
- #include "ppapi/thunk/interfaces_ppb_public_stable.h"
- #include "ppapi/thunk/interfaces_ppb_public_dev.h"
- #include "ppapi/thunk/interfaces_ppb_private.h"
-
- #undef PROXIED_API
- #undef PROXIED_IFACE
-
- // New-style AddPPB not converted to the macros above.
- AddPPB(PPB_CORE_INTERFACE, INTERFACE_ID_PPB_CORE,
- PPB_Core_Proxy::GetPPB_Core_Interface());
- AddPPB(PPB_MEMORY_DEV_INTERFACE, INTERFACE_ID_NONE,
- GetPPB_Memory_Interface());
- AddPPB(PPB_OPENGLES2_INTERFACE, INTERFACE_ID_NONE,
- OpenGLES2Impl::GetInterface());
- AddPPB(PPB_VAR_INTERFACE, INTERFACE_ID_NONE,
- GetPPB_Var_Interface());
-
- // Manually add some special proxies. These don't have interfaces that they
- // support, so aren't covered by the macros above, but have proxies for
- // message routing.
- AddProxy(INTERFACE_ID_RESOURCE_CREATION, &ResourceCreationProxy::Create);
- AddProxy(INTERFACE_ID_PPP_CLASS, &PPP_Class_Proxy::Create);
-
- // PPB (browser) interfaces.
- AddPPB(PPB_Crypto_Proxy::GetInfo());
- AddPPB(PPB_Flash_Clipboard_Proxy::GetInfo());
- AddPPB(PPB_Flash_File_FileRef_Proxy::GetInfo());
- AddPPB(PPB_Flash_File_ModuleLocal_Proxy::GetInfo());
- AddPPB(PPB_Flash_Menu_Proxy::GetInfo());
- AddPPB(PPB_Flash_Proxy::GetInfo());
- AddPPB(PPB_Flash_TCPSocket_Proxy::GetInfo());
- AddPPB(PPB_Instance_Proxy::GetInfoFullscreen());
- AddPPB(PPB_Instance_Proxy::GetInfoPrivate());
- AddPPB(PPB_PDF_Proxy::GetInfo());
- AddPPB(PPB_Testing_Proxy::GetInfo());
- AddPPB(PPB_URLLoader_Proxy::GetTrustedInfo());
- AddPPB(PPB_URLUtil_Proxy::GetInfo());
- AddPPB(PPB_Var_Deprecated_Proxy::GetInfo());
-
-#ifdef ENABLE_FLAPPER_HACKS
- AddPPB(PPB_Flash_NetConnector_Proxy::GetInfo());
-#endif
-
- // PPP (plugin) interfaces.
- AddPPP(PPP_Graphics3D_Proxy::GetInfo());
- AddPPP(PPP_InputEvent_Proxy::GetInfo());
- AddPPP(PPP_Instance_Private_Proxy::GetInfo());
- AddPPP(PPP_Instance_Proxy::GetInfo1_0());
- AddPPP(PPP_Messaging_Proxy::GetInfo());
- AddPPP(PPP_MouseLock_Proxy::GetInfo());
- AddPPP(PPP_VideoCapture_Proxy::GetInfo());
- AddPPP(PPP_VideoDecoder_Proxy::GetInfo());
-}
-
-InterfaceList::~InterfaceList() {
-}
-
-// static
-InterfaceList* InterfaceList::GetInstance() {
- return Singleton<InterfaceList>::get();
-}
-
-InterfaceID InterfaceList::GetIDForPPBInterface(const std::string& name) const {
- NameToInterfaceInfoMap::const_iterator found =
- name_to_browser_info_.find(name);
- if (found == name_to_browser_info_.end())
- return INTERFACE_ID_NONE;
- return found->second.id;
-}
-
-InterfaceID InterfaceList::GetIDForPPPInterface(const std::string& name) const {
- NameToInterfaceInfoMap::const_iterator found =
- name_to_plugin_info_.find(name);
- if (found == name_to_plugin_info_.end())
- return INTERFACE_ID_NONE;
- return found->second.id;
-}
-
-InterfaceProxy::Factory InterfaceList::GetFactoryForID(InterfaceID id) const {
- int index = static_cast<int>(id);
- COMPILE_ASSERT(INTERFACE_ID_NONE == 0, none_must_be_zero);
- if (id <= 0 || id >= INTERFACE_ID_COUNT)
- return NULL;
- return id_to_factory_[index];
-}
-
-const void* InterfaceList::GetInterfaceForPPB(const std::string& name) const {
- NameToInterfaceInfoMap::const_iterator found =
- name_to_browser_info_.find(name);
- if (found == name_to_browser_info_.end())
- return NULL;
- return found->second.iface;
-}
-
-const void* InterfaceList::GetInterfaceForPPP(const std::string& name) const {
- NameToInterfaceInfoMap::const_iterator found =
- name_to_plugin_info_.find(name);
- if (found == name_to_plugin_info_.end())
- return NULL;
- return found->second.iface;
-}
-
-void InterfaceList::AddProxy(InterfaceID id,
- InterfaceProxy::Factory factory) {
- // For interfaces with no corresponding _Proxy objects, the macros will
- // generate calls to this function with INTERFACE_ID_NONE. This means we
- // should just skip adding a factory for these functions.
- if (id == INTERFACE_ID_NONE)
- return;
-
- // The factory should be an exact dupe of the one we already have if it
- // has already been registered before.
- int index = static_cast<int>(id);
- DCHECK(!id_to_factory_[index] || id_to_factory_[index] == factory);
-
- id_to_factory_[index] = factory;
-}
-
-void InterfaceList::AddPPB(const char* name,
- InterfaceID id,
- const void* iface) {
- DCHECK(name_to_browser_info_.find(name) == name_to_browser_info_.end());
- name_to_browser_info_[name] = InterfaceInfo(id, iface);
-}
-
-void InterfaceList::AddPPP(const char* name,
- InterfaceID id,
- const void* iface) {
- DCHECK(name_to_plugin_info_.find(name) == name_to_plugin_info_.end());
- name_to_plugin_info_[name] = InterfaceInfo(id, iface);
-}
-
-void InterfaceList::AddPPB(const InterfaceProxy::Info* info) {
- AddProxy(info->id, info->create_proxy);
- AddPPB(info->name, info->id, info->interface_ptr);
-}
-
-void InterfaceList::AddPPP(const InterfaceProxy::Info* info) {
- AddProxy(info->id, info->create_proxy);
- AddPPP(info->name, info->id, info->interface_ptr);
-}
-
-} // namespace proxy
-} // namespace ppapi
diff --git a/ppapi/proxy/interface_list.h b/ppapi/proxy/interface_list.h
deleted file mode 100644
index 0290af9..0000000
--- a/ppapi/proxy/interface_list.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef PPAPI_PROXY_INTERFACE_LIST_H_
-#define PPAPI_PROXY_INTERFACE_LIST_H_
-
-#include <map>
-#include <string>
-
-#include "base/basictypes.h"
-#include "ppapi/proxy/interface_proxy.h"
-
-namespace ppapi {
-namespace proxy {
-
-class InterfaceList {
- public:
- InterfaceList();
- ~InterfaceList();
-
- static InterfaceList* GetInstance();
-
- // Looks up the ID for the given interface name. Returns INTERFACE_ID_NONE if
- // the interface string is not found.
- InterfaceID GetIDForPPBInterface(const std::string& name) const;
- InterfaceID GetIDForPPPInterface(const std::string& name) const;
-
- // Looks up the factory function for the given ID. Returns NULL if not
- // supported.
- InterfaceProxy::Factory GetFactoryForID(InterfaceID id) const;
-
- // Returns the interface pointer for the given browser or plugin interface,
- // or NULL if it's not supported.
- const void* GetInterfaceForPPB(const std::string& name) const;
- const void* GetInterfaceForPPP(const std::string& name) const;
-
- private:
- struct InterfaceInfo {
- InterfaceInfo()
- : id(INTERFACE_ID_NONE),
- iface(NULL) {
- }
- InterfaceInfo(InterfaceID in_id, const void* in_interface)
- : id(in_id),
- iface(in_interface) {
- }
-
- InterfaceID id;
- const void* iface;
- };
-
- typedef std::map<std::string, InterfaceInfo> NameToInterfaceInfoMap;
-
- void AddProxy(InterfaceID id, InterfaceProxy::Factory factory);
-
- void AddPPB(const char* name, InterfaceID id, const void* iface);
- void AddPPP(const char* name, InterfaceID id, const void* iface);
-
- // Old-style add functions. These should be removed when the rest of the
- // proxies are converted over to using the new system.
- void AddPPB(const InterfaceProxy::Info* info);
- void AddPPP(const InterfaceProxy::Info* info);
-
- NameToInterfaceInfoMap name_to_browser_info_;
- NameToInterfaceInfoMap name_to_plugin_info_;
-
- InterfaceProxy::Factory id_to_factory_[INTERFACE_ID_COUNT];
-
- DISALLOW_COPY_AND_ASSIGN(InterfaceList);
-};
-
-} // namespace proxy
-} // namespace ppapi
-
-#endif // PPAPI_PROXY_INTERFACE_LIST_H_
-
diff --git a/ppapi/proxy/interface_proxy.cc b/ppapi/proxy/interface_proxy.cc
index 913821a..a474383 100644
--- a/ppapi/proxy/interface_proxy.cc
+++ b/ppapi/proxy/interface_proxy.cc
@@ -10,8 +10,10 @@
namespace ppapi {
namespace proxy {
-InterfaceProxy::InterfaceProxy(Dispatcher* dispatcher)
- : dispatcher_(dispatcher) {
+InterfaceProxy::InterfaceProxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : dispatcher_(dispatcher),
+ target_interface_(target_interface) {
}
InterfaceProxy::~InterfaceProxy() {
diff --git a/ppapi/proxy/interface_proxy.h b/ppapi/proxy/interface_proxy.h
index 795944b..1fed704 100644
--- a/ppapi/proxy/interface_proxy.h
+++ b/ppapi/proxy/interface_proxy.h
@@ -12,7 +12,6 @@
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_var.h"
#include "ppapi/proxy/interface_id.h"
-#include "ppapi/shared_impl/function_group_base.h"
namespace ppapi {
namespace proxy {
@@ -20,16 +19,13 @@ namespace proxy {
class Dispatcher;
class InterfaceProxy : public IPC::Channel::Listener,
- public IPC::Message::Sender,
- public FunctionGroupBase {
+ public IPC::Message::Sender {
public:
// Factory function type for interfaces. Ownership of the returned pointer
// is transferred to the caller.
- typedef InterfaceProxy* (*Factory)(Dispatcher* dispatcher);
+ typedef InterfaceProxy* (*Factory)(Dispatcher* dispatcher,
+ const void* target_interface);
- // DEPRECATED: New classes should be registered directly in the interface
- // list. This is kept around until we convert all the existing code.
- //
// Information about the interface. Each interface has a static function to
// return its info, which allows either construction on the target side, and
// getting the proxied interface on the source side (see dispatcher.h for
@@ -47,6 +43,9 @@ class InterfaceProxy : public IPC::Channel::Listener,
virtual ~InterfaceProxy();
+ // The actual implementation of the given interface in the current process.
+ const void* target_interface() const { return target_interface_; }
+
Dispatcher* dispatcher() const { return dispatcher_; }
// IPC::Message::Sender implementation.
@@ -58,13 +57,19 @@ class InterfaceProxy : public IPC::Channel::Listener,
protected:
// Creates the given interface associated with the given dispatcher. The
// dispatcher manages our lifetime.
- InterfaceProxy(Dispatcher* dispatcher);
+ //
+ // The target interface pointer, when non-NULL, indicates that this is a
+ // target proxy (see dispatcher.h for a definition). In this case, the proxy
+ // will interpret this pointer to the actual implementation of the interface
+ // in the local process.
+ InterfaceProxy(Dispatcher* dispatcher, const void* target_interface);
uint32 SendCallback(PP_CompletionCallback callback);
PP_CompletionCallback ReceiveCallback(uint32 serialized_callback);
private:
Dispatcher* dispatcher_;
+ const void* target_interface_;
};
} // namespace proxy
diff --git a/ppapi/proxy/plugin_dispatcher.cc b/ppapi/proxy/plugin_dispatcher.cc
index 7afd3d6..bb42fcb7 100644
--- a/ppapi/proxy/plugin_dispatcher.cc
+++ b/ppapi/proxy/plugin_dispatcher.cc
@@ -13,7 +13,6 @@
#include "ipc/ipc_sync_channel.h"
#include "base/debug/trace_event.h"
#include "ppapi/c/pp_errors.h"
-#include "ppapi/proxy/interface_list.h"
#include "ppapi/proxy/interface_proxy.h"
#include "ppapi/proxy/plugin_message_filter.h"
#include "ppapi/proxy/plugin_resource_tracker.h"
@@ -54,6 +53,11 @@ PluginDispatcher::PluginDispatcher(base::ProcessHandle remote_process_handle,
received_preferences_(false),
plugin_dispatcher_id_(0) {
SetSerializationRules(new PluginVarSerializationRules);
+
+ // As a plugin, we always support the PPP_Class interface. There's no
+ // GetInterface call or name for it, so we insert it into our table now.
+ target_proxies_[INTERFACE_ID_PPP_CLASS].reset(new PPP_Class_Proxy(this));
+
TrackerBase::Init(&PluginResourceTracker::GetTrackerBaseInstance);
}
@@ -79,19 +83,13 @@ PluginDispatcher* PluginDispatcher::GetForResource(const Resource* resource) {
}
// static
-const void* PluginDispatcher::GetBrowserInterface(const char* interface_name) {
- return InterfaceList::GetInstance()->GetInterfaceForPPB(interface_name);
-}
-
-const void* PluginDispatcher::GetPluginInterface(
- const std::string& interface_name) {
- InterfaceMap::iterator found = plugin_interfaces_.find(interface_name);
- if (found == plugin_interfaces_.end()) {
- const void* ret = local_get_interface()(interface_name.c_str());
- plugin_interfaces_.insert(std::make_pair(interface_name, ret));
- return ret;
- }
- return found->second;
+const void* PluginDispatcher::GetInterfaceFromDispatcher(
+ const char* dispatcher_interface) {
+ // All interfaces the plugin requests of the browser are "PPB".
+ const InterfaceProxy::Info* info = GetPPBInterfaceInfo(dispatcher_interface);
+ if (!info)
+ return NULL;
+ return info->interface_ptr;
}
bool PluginDispatcher::InitPluginWithChannel(
@@ -133,18 +131,56 @@ bool PluginDispatcher::OnMessageReceived(const IPC::Message& msg) {
TRACE_EVENT2("ppapi proxy", "PluginDispatcher::OnMessageReceived",
"Class", IPC_MESSAGE_ID_CLASS(msg.type()),
"Line", IPC_MESSAGE_ID_LINE(msg.type()));
+ // Handle common control messages.
+ if (Dispatcher::OnMessageReceived(msg))
+ return true;
+
if (msg.routing_id() == MSG_ROUTING_CONTROL) {
// Handle some plugin-specific control messages.
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(PluginDispatcher, msg)
IPC_MESSAGE_HANDLER(PpapiMsg_SupportsInterface, OnMsgSupportsInterface)
IPC_MESSAGE_HANDLER(PpapiMsg_SetPreferences, OnMsgSetPreferences)
- IPC_MESSAGE_UNHANDLED(handled = false);
IPC_END_MESSAGE_MAP()
- if (handled)
+ return handled;
+ }
+
+ if (msg.routing_id() <= 0 || msg.routing_id() >= INTERFACE_ID_COUNT) {
+ // Host is sending us garbage. Since it's supposed to be trusted, this
+ // isn't supposed to happen. Crash here in all builds in case the renderer
+ // is compromised.
+ CHECK(false);
+ return true;
+ }
+
+ // There are two cases:
+ //
+ // * The first case is that the host is calling a PPP interface. It will
+ // always do a check for the interface before sending messages, and this
+ // will create the necessary interface proxy at that time. So when we
+ // actually receive a message, we know such a proxy will exist.
+ //
+ // * The second case is that the host is sending a response to the plugin
+ // side of a PPB interface (some, like the URL loader, have complex
+ // response messages). Since the host is trusted and not supposed to be
+ // doing silly things, we can just create a PPB proxy project on demand the
+ // first time it's needed.
+
+ InterfaceProxy* proxy = target_proxies_[msg.routing_id()].get();
+ if (!proxy) {
+ // Handle the first time the host calls a PPB reply interface by
+ // autocreating it.
+ const InterfaceProxy::Info* info = GetPPBInterfaceInfo(
+ static_cast<InterfaceID>(msg.routing_id()));
+ if (!info) {
+ NOTREACHED();
return true;
+ }
+ proxy = info->create_proxy(this, NULL);
+ target_proxies_[info->id].reset(proxy);
}
- return Dispatcher::OnMessageReceived(msg);
+
+ return proxy->OnMessageReceived(msg);
}
void PluginDispatcher::OnChannelError() {
@@ -202,7 +238,23 @@ WebKitForwarding* PluginDispatcher::GetWebKitForwarding() {
}
FunctionGroupBase* PluginDispatcher::GetFunctionAPI(InterfaceID id) {
- return GetInterfaceProxy(id);
+ scoped_ptr<FunctionGroupBase >& proxy = function_proxies_[id];
+
+ if (proxy.get())
+ return proxy.get();
+
+ if (id == INTERFACE_ID_PPB_CHAR_SET)
+ proxy.reset(new PPB_CharSet_Proxy(this, NULL));
+ else if(id == INTERFACE_ID_PPB_CURSORCONTROL)
+ proxy.reset(new PPB_CursorControl_Proxy(this, NULL));
+ else if (id == INTERFACE_ID_PPB_FONT)
+ proxy.reset(new PPB_Font_Proxy(this, NULL));
+ else if (id == INTERFACE_ID_PPB_INSTANCE)
+ proxy.reset(new PPB_Instance_Proxy(this, NULL));
+ else if (id == INTERFACE_ID_RESOURCE_CREATION)
+ proxy.reset(new ResourceCreationProxy(this));
+
+ return proxy.get();
}
void PluginDispatcher::ForceFreeAllInstances() {
@@ -226,7 +278,26 @@ void PluginDispatcher::ForceFreeAllInstances() {
void PluginDispatcher::OnMsgSupportsInterface(
const std::string& interface_name,
bool* result) {
- *result = !!GetPluginInterface(interface_name);
+ *result = false;
+
+ // Setup a proxy for receiving the messages from this interface.
+ const InterfaceProxy::Info* info = GetPPPInterfaceInfo(interface_name);
+ if (!info)
+ return; // Interface not supported by proxy.
+
+ // Check for a cached result.
+ if (target_proxies_[info->id].get()) {
+ *result = true;
+ return;
+ }
+
+ // Query the plugin & cache the result.
+ const void* interface_functions = GetLocalInterface(interface_name.c_str());
+ if (!interface_functions)
+ return;
+ target_proxies_[info->id].reset(
+ info->create_proxy(this, interface_functions));
+ *result = true;
}
void PluginDispatcher::OnMsgSetPreferences(const Preferences& prefs) {
diff --git a/ppapi/proxy/plugin_dispatcher.h b/ppapi/proxy/plugin_dispatcher.h
index 1a2f586..2238646 100644
--- a/ppapi/proxy/plugin_dispatcher.h
+++ b/ppapi/proxy/plugin_dispatcher.h
@@ -88,11 +88,8 @@ class PPAPI_PROXY_EXPORT PluginDispatcher : public Dispatcher {
// object as a convenience. Returns NULL on failure.
static PluginDispatcher* GetForResource(const Resource* resource);
- // Implements the GetInterface function for the plugin to call to retrieve
- // a browser interface.
- static const void* GetBrowserInterface(const char* interface_name);
-
- const void* GetPluginInterface(const std::string& interface_name);
+ static const void* GetInterfaceFromDispatcher(
+ const char* dispatcher_interface);
// You must call this function before anything else. Returns true on success.
// The delegate pointer must outlive this class, ownership is not
@@ -152,12 +149,14 @@ class PPAPI_PROXY_EXPORT PluginDispatcher : public Dispatcher {
PluginDelegate* plugin_delegate_;
- // Contains all the plugin interfaces we've queried. The mapped value will
- // be the pointer to the interface pointer supplied by the plugin if it's
- // supported, or NULL if it's not supported. This allows us to cache failures
- // and not req-query if a plugin doesn't support the interface.
- typedef base::hash_map<std::string, const void*> InterfaceMap;
- InterfaceMap plugin_interfaces_;
+ // All target proxies currently created. These are ones that receive
+ // messages.
+ scoped_ptr<InterfaceProxy> target_proxies_[INTERFACE_ID_COUNT];
+
+ // Function proxies created for "new-style" FunctionGroups.
+ // TODO(brettw) this is in progress. It should be merged with the target
+ // proxies so there is one list to consult.
+ scoped_ptr<FunctionGroupBase> function_proxies_[INTERFACE_ID_COUNT];
typedef base::hash_map<PP_Instance, InstanceData> InstanceDataMap;
InstanceDataMap instance_map_;
diff --git a/ppapi/proxy/plugin_dispatcher_unittest.cc b/ppapi/proxy/plugin_dispatcher_unittest.cc
index 8a32026..56f563b 100644
--- a/ppapi/proxy/plugin_dispatcher_unittest.cc
+++ b/ppapi/proxy/plugin_dispatcher_unittest.cc
@@ -53,7 +53,7 @@ class PluginDispatcherTest : public PluginProxyTest {
PluginDispatcherTest() {}
bool HasTargetProxy(InterfaceID id) {
- return !!plugin_dispatcher()->proxies_[id].get();
+ return !!plugin_dispatcher()->target_proxies_[id].get();
}
};
@@ -64,6 +64,11 @@ TEST_F(PluginDispatcherTest, SupportsInterface) {
// Sending a request for a random interface should fail.
EXPECT_FALSE(SupportsInterface("Random interface"));
+ // Sending a request for a PPB interface should fail even though we've
+ // registered it as existing in the GetInterface function (the plugin proxy
+ // should only respond to PPP interfaces when asked if it supports them).
+ EXPECT_FALSE(SupportsInterface(PPB_AUDIO_INTERFACE));
+
// Sending a request for a supported PPP interface should succeed.
EXPECT_TRUE(SupportsInterface(PPP_INSTANCE_INTERFACE));
}
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index ac7992d..4611a4f 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -468,6 +468,17 @@ IPC_SYNC_MESSAGE_ROUTED2_2(PpapiHostMsg_PPBBuffer_Create,
ppapi::HostResource /* result_resource */,
base::SharedMemoryHandle /* result_shm_handle */)
+// PPB_Console.
+IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBConsole_Log,
+ PP_Instance /* instance */,
+ int /* log_level */,
+ ppapi::proxy::SerializedVar /* value */)
+IPC_MESSAGE_ROUTED4(PpapiHostMsg_PPBConsole_LogWithSource,
+ PP_Instance /* instance */,
+ int /* log_level */,
+ ppapi::proxy::SerializedVar /* soruce */,
+ ppapi::proxy::SerializedVar /* value */)
+
// PPB_Context3D.
IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBContext3D_Create,
PP_Instance /* instance */,
@@ -813,15 +824,6 @@ IPC_SYNC_MESSAGE_ROUTED2_2(PpapiHostMsg_PPBInstance_ExecuteScript,
ppapi::proxy::SerializedVar /* script */,
ppapi::proxy::SerializedVar /* out_exception */,
ppapi::proxy::SerializedVar /* result */)
-IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBInstance_Log,
- PP_Instance /* instance */,
- int /* log_level */,
- ppapi::proxy::SerializedVar /* value */)
-IPC_MESSAGE_ROUTED4(PpapiHostMsg_PPBInstance_LogWithSource,
- PP_Instance /* instance */,
- int /* log_level */,
- ppapi::proxy::SerializedVar /* source */,
- ppapi::proxy::SerializedVar /* value */)
IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBInstance_SetFullscreen,
PP_Instance /* instance */,
PP_Bool /* fullscreen */,
diff --git a/ppapi/proxy/ppb_audio_config_proxy.cc b/ppapi/proxy/ppb_audio_config_proxy.cc
new file mode 100644
index 0000000..d578fd5
--- /dev/null
+++ b/ppapi/proxy/ppb_audio_config_proxy.cc
@@ -0,0 +1,52 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/proxy/ppb_audio_config_proxy.h"
+
+#include "ppapi/c/ppb_audio_config.h"
+#include "ppapi/proxy/plugin_dispatcher.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/shared_impl/audio_config_impl.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace proxy {
+
+namespace {
+
+InterfaceProxy* CreateAudioConfigProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_AudioConfig_Proxy(dispatcher, target_interface);
+}
+
+} // namespace
+
+PPB_AudioConfig_Proxy::PPB_AudioConfig_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
+}
+
+PPB_AudioConfig_Proxy::~PPB_AudioConfig_Proxy() {
+}
+
+// static
+const InterfaceProxy::Info* PPB_AudioConfig_Proxy::GetInfo() {
+ static const Info info = {
+ thunk::GetPPB_AudioConfig_Thunk(),
+ PPB_AUDIO_CONFIG_INTERFACE,
+ INTERFACE_ID_PPB_AUDIO_CONFIG,
+ false,
+ &CreateAudioConfigProxy,
+ };
+ return &info;
+}
+
+bool PPB_AudioConfig_Proxy::OnMessageReceived(const IPC::Message& msg) {
+ // There are no IPC messages for this interface.
+ NOTREACHED();
+ return false;
+}
+
+} // namespace proxy
+} // namespace ppapi
diff --git a/ppapi/proxy/ppb_audio_config_proxy.h b/ppapi/proxy/ppb_audio_config_proxy.h
new file mode 100644
index 0000000..d70d2db
--- /dev/null
+++ b/ppapi/proxy/ppb_audio_config_proxy.h
@@ -0,0 +1,36 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_PROXY_PPB_AUDIO_CONFIG_PROXY_H_
+#define PPAPI_PROXY_PPB_AUDIO_CONFIG_PROXY_H_
+
+#include "base/basictypes.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/c/ppb_audio_config.h"
+#include "ppapi/proxy/interface_proxy.h"
+
+struct PPB_AudioConfig;
+
+namespace ppapi {
+namespace proxy {
+
+class PPB_AudioConfig_Proxy : public InterfaceProxy {
+ public:
+ PPB_AudioConfig_Proxy(Dispatcher* dispatcher, const void* target_interface);
+ virtual ~PPB_AudioConfig_Proxy();
+
+ static const Info* GetInfo();
+
+ // InterfaceProxy implementation.
+ virtual bool OnMessageReceived(const IPC::Message& msg);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PPB_AudioConfig_Proxy);
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PROXY_PPB_AUDIO_CONFIG_PROXY_H_
diff --git a/ppapi/proxy/ppb_audio_proxy.cc b/ppapi/proxy/ppb_audio_proxy.cc
index 453d7b0..139df10 100644
--- a/ppapi/proxy/ppb_audio_proxy.cc
+++ b/ppapi/proxy/ppb_audio_proxy.cc
@@ -116,6 +116,11 @@ int32_t Audio::GetSharedMemory(int* shm_handle, uint32_t* shm_size) {
namespace {
+InterfaceProxy* CreateAudioProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_Audio_Proxy(dispatcher, target_interface);
+}
+
base::PlatformFile IntToPlatformFile(int32_t handle) {
// TODO(piman/brettw): Change trusted interface to return a PP_FileHandle,
// those casts are ugly.
@@ -130,8 +135,9 @@ base::PlatformFile IntToPlatformFile(int32_t handle) {
} // namespace
-PPB_Audio_Proxy::PPB_Audio_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
+PPB_Audio_Proxy::PPB_Audio_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface),
callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
}
@@ -139,6 +145,18 @@ PPB_Audio_Proxy::~PPB_Audio_Proxy() {
}
// static
+const InterfaceProxy::Info* PPB_Audio_Proxy::GetInfo() {
+ static const Info info = {
+ thunk::GetPPB_Audio_Thunk(),
+ PPB_AUDIO_INTERFACE,
+ INTERFACE_ID_PPB_AUDIO,
+ false,
+ &CreateAudioProxy,
+ };
+ return &info;
+}
+
+// static
PP_Resource PPB_Audio_Proxy::CreateProxyResource(
PP_Instance instance_id,
PP_Resource config_id,
@@ -224,19 +242,16 @@ void PPB_Audio_Proxy::OnMsgCreate(PP_Instance instance_id,
// Clean up the temporary audio config resource we made.
const PPB_Core* core = static_cast<const PPB_Core*>(
- dispatcher()->local_get_interface()(PPB_CORE_INTERFACE));
+ dispatcher()->GetLocalInterface(PPB_CORE_INTERFACE));
core->ReleaseResource(audio_config_res);
}
void PPB_Audio_Proxy::OnMsgStartOrStop(const HostResource& audio_id,
bool play) {
- EnterHostFromHostResource<PPB_Audio_API> enter(audio_id);
- if (enter.failed())
- return;
if (play)
- enter.object()->StartPlayback();
+ ppb_audio_target()->StartPlayback(audio_id.host_resource());
else
- enter.object()->StopPlayback();
+ ppb_audio_target()->StopPlayback(audio_id.host_resource());
}
// Processed in the plugin (message from host).
@@ -292,7 +307,7 @@ int32_t PPB_Audio_Proxy::GetAudioConnectedHandles(
base::SharedMemoryHandle* foreign_shared_memory_handle,
uint32_t* shared_memory_length) {
// Get the audio interface which will give us the handles.
- EnterHostFromHostResource<PPB_Audio_API> enter(resource);
+ EnterResourceNoLock<PPB_Audio_API> enter(resource.host_resource(), false);
if (enter.failed())
return PP_ERROR_NOINTERFACE;
diff --git a/ppapi/proxy/ppb_audio_proxy.h b/ppapi/proxy/ppb_audio_proxy.h
index b548e72..7948b9c 100644
--- a/ppapi/proxy/ppb_audio_proxy.h
+++ b/ppapi/proxy/ppb_audio_proxy.h
@@ -30,9 +30,11 @@ namespace proxy {
class PPB_Audio_Proxy : public InterfaceProxy {
public:
- PPB_Audio_Proxy(Dispatcher* dispatcher);
+ PPB_Audio_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPB_Audio_Proxy();
+ static const Info* GetInfo();
+
// Creates an Audio object in the plugin process.
static PP_Resource CreateProxyResource(PP_Instance instance_id,
PP_Resource config_id,
@@ -40,11 +42,13 @@ class PPB_Audio_Proxy : public InterfaceProxy {
void* user_data);
+ const PPB_Audio* ppb_audio_target() const {
+ return static_cast<const PPB_Audio*>(target_interface());
+ }
+
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
- static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_AUDIO;
-
private:
// Plugin->renderer message handlers.
void OnMsgCreate(PP_Instance instance_id,
diff --git a/ppapi/proxy/ppb_broker_proxy.cc b/ppapi/proxy/ppb_broker_proxy.cc
index ff06759..68ba8c0 100644
--- a/ppapi/proxy/ppb_broker_proxy.cc
+++ b/ppapi/proxy/ppb_broker_proxy.cc
@@ -11,7 +11,6 @@
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/thunk/ppb_broker_api.h"
#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/resource_creation_api.h"
#include "ppapi/thunk/thunk.h"
using ppapi::thunk::PPB_Broker_API;
@@ -41,6 +40,11 @@ int32_t PlatformFileToInt(base::PlatformFile handle) {
#endif
}
+InterfaceProxy* CreateBrokerProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_Broker_Proxy(dispatcher, target_interface);
+}
+
} // namespace
class Broker : public PPB_Broker_API, public Resource {
@@ -143,8 +147,9 @@ void Broker::ConnectComplete(IPC::PlatformFileForTransit socket_handle,
PP_RunAndClearCompletionCallback(&current_connect_callback_, result);
}
-PPB_Broker_Proxy::PPB_Broker_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
+PPB_Broker_Proxy::PPB_Broker_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) ,
callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)){
}
@@ -152,6 +157,18 @@ PPB_Broker_Proxy::~PPB_Broker_Proxy() {
}
// static
+const InterfaceProxy::Info* PPB_Broker_Proxy::GetInfo() {
+ static const Info info = {
+ ppapi::thunk::GetPPB_Broker_Thunk(),
+ PPB_BROKER_TRUSTED_INTERFACE,
+ INTERFACE_ID_PPB_BROKER,
+ true,
+ &CreateBrokerProxy,
+ };
+ return &info;
+}
+
+// static
PP_Resource PPB_Broker_Proxy::CreateProxyResource(PP_Instance instance) {
PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
if (!dispatcher)
@@ -179,12 +196,9 @@ bool PPB_Broker_Proxy::OnMessageReceived(const IPC::Message& msg) {
void PPB_Broker_Proxy::OnMsgCreate(PP_Instance instance,
HostResource* result_resource) {
- thunk::EnterResourceCreation enter(instance);
- if (enter.succeeded()) {
- result_resource->SetHostResource(
- instance,
- enter.functions()->CreateBroker(instance));
- }
+ result_resource->SetHostResource(
+ instance,
+ ppb_broker_target()->CreateTrusted(instance));
}
void PPB_Broker_Proxy::OnMsgConnect(const HostResource& broker) {
@@ -226,9 +240,8 @@ void PPB_Broker_Proxy::ConnectCompleteInHost(int32_t result,
IPC::InvalidPlatformFileForTransit();
if (result == PP_OK) {
int32_t socket_handle = PlatformFileToInt(base::kInvalidPlatformFileValue);
- EnterHostFromHostResource<PPB_Broker_API> enter(broker);
- if (enter.succeeded())
- result = enter.object()->GetHandle(&socket_handle);
+ result = ppb_broker_target()->GetHandle(broker.host_resource(),
+ &socket_handle);
DCHECK(result == PP_OK ||
socket_handle == PlatformFileToInt(base::kInvalidPlatformFileValue));
diff --git a/ppapi/proxy/ppb_broker_proxy.h b/ppapi/proxy/ppb_broker_proxy.h
index 54ff9de..e8c34e2 100644
--- a/ppapi/proxy/ppb_broker_proxy.h
+++ b/ppapi/proxy/ppb_broker_proxy.h
@@ -22,16 +22,20 @@ namespace proxy {
class PPB_Broker_Proxy : public InterfaceProxy {
public:
- PPB_Broker_Proxy(Dispatcher* dispatcher);
+ PPB_Broker_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPB_Broker_Proxy();
+ static const Info* GetInfo();
+
static PP_Resource CreateProxyResource(PP_Instance instance);
+ const PPB_BrokerTrusted* ppb_broker_target() const {
+ return static_cast<const PPB_BrokerTrusted*>(target_interface());
+ }
+
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
- static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_BROKER;
-
private:
// Message handlers.
void OnMsgCreate(PP_Instance instance, ppapi::HostResource* result_resource);
diff --git a/ppapi/proxy/ppb_buffer_proxy.cc b/ppapi/proxy/ppb_buffer_proxy.cc
index 957108a..d9092fe 100644
--- a/ppapi/proxy/ppb_buffer_proxy.cc
+++ b/ppapi/proxy/ppb_buffer_proxy.cc
@@ -17,12 +17,20 @@
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppb_buffer_trusted_api.h"
-#include "ppapi/thunk/resource_creation_api.h"
#include "ppapi/thunk/thunk.h"
namespace ppapi {
namespace proxy {
+namespace {
+
+InterfaceProxy* CreateBufferProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_Buffer_Proxy(dispatcher, target_interface);
+}
+
+} // namespace
+
Buffer::Buffer(const HostResource& resource,
const base::SharedMemoryHandle& shm_handle,
uint32_t size)
@@ -61,14 +69,27 @@ void Buffer::Unmap() {
shm_.Unmap();
}
-PPB_Buffer_Proxy::PPB_Buffer_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher) {
+PPB_Buffer_Proxy::PPB_Buffer_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
}
PPB_Buffer_Proxy::~PPB_Buffer_Proxy() {
}
// static
+const InterfaceProxy::Info* PPB_Buffer_Proxy::GetInfo() {
+ static const Info info = {
+ thunk::GetPPB_Buffer_Thunk(),
+ PPB_BUFFER_DEV_INTERFACE,
+ INTERFACE_ID_PPB_BUFFER,
+ false,
+ &CreateBufferProxy,
+ };
+ return &info;
+}
+
+// static
PP_Resource PPB_Buffer_Proxy::CreateProxyResource(PP_Instance instance,
uint32_t size) {
PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
@@ -114,15 +135,10 @@ void PPB_Buffer_Proxy::OnMsgCreate(
HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
if (!dispatcher)
return;
-
- thunk::EnterResourceCreation enter(instance);
- if (enter.failed())
- return;
- PP_Resource local_buffer_resource = enter.functions()->CreateBuffer(instance,
- size);
+ PP_Resource local_buffer_resource =
+ ppb_buffer_target()->Create(instance, size);
if (local_buffer_resource == 0)
return;
-
thunk::EnterResourceNoLock<thunk::PPB_BufferTrusted_API> trusted_buffer(
local_buffer_resource, false);
if (trusted_buffer.failed())
diff --git a/ppapi/proxy/ppb_buffer_proxy.h b/ppapi/proxy/ppb_buffer_proxy.h
index 4105dcc..2c0b875 100644
--- a/ppapi/proxy/ppb_buffer_proxy.h
+++ b/ppapi/proxy/ppb_buffer_proxy.h
@@ -46,20 +46,24 @@ class Buffer : public thunk::PPB_Buffer_API, public Resource {
class PPB_Buffer_Proxy : public InterfaceProxy {
public:
- PPB_Buffer_Proxy(Dispatcher* dispatcher);
+ PPB_Buffer_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPB_Buffer_Proxy();
+ static const Info* GetInfo();
+
static PP_Resource CreateProxyResource(PP_Instance instance,
uint32_t size);
static PP_Resource AddProxyResource(const HostResource& resource,
base::SharedMemoryHandle shm_handle,
uint32_t size);
+ const PPB_Buffer_Dev* ppb_buffer_target() const {
+ return static_cast<const PPB_Buffer_Dev*>(target_interface());
+ }
+
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
- static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_BUFFER;
-
private:
// Message handlers.
void OnMsgCreate(PP_Instance instance,
diff --git a/ppapi/proxy/ppb_char_set_proxy.cc b/ppapi/proxy/ppb_char_set_proxy.cc
index 52610f3..f23626f 100644
--- a/ppapi/proxy/ppb_char_set_proxy.cc
+++ b/ppapi/proxy/ppb_char_set_proxy.cc
@@ -9,7 +9,6 @@
#include "ppapi/c/dev/ppb_memory_dev.h"
#include "ppapi/proxy/plugin_dispatcher.h"
#include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/proxy/ppb_memory_proxy.h"
#include "ppapi/proxy/serialized_var.h"
#include "ppapi/shared_impl/char_set_impl.h"
#include "ppapi/thunk/enter.h"
@@ -18,13 +17,40 @@
namespace ppapi {
namespace proxy {
-PPB_CharSet_Proxy::PPB_CharSet_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher) {
+namespace {
+
+const PPB_Memory_Dev* GetMemoryDevInterface() {
+ return static_cast<const PPB_Memory_Dev*>(
+ PluginDispatcher::GetInterfaceFromDispatcher(PPB_MEMORY_DEV_INTERFACE));
+}
+
+InterfaceProxy* CreateCharSetProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_CharSet_Proxy(dispatcher, target_interface);
+}
+
+} // namespace
+
+PPB_CharSet_Proxy::PPB_CharSet_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
}
PPB_CharSet_Proxy::~PPB_CharSet_Proxy() {
}
+// static
+const InterfaceProxy::Info* PPB_CharSet_Proxy::GetInfo() {
+ static const Info info = {
+ ppapi::thunk::GetPPB_CharSet_Thunk(),
+ PPB_CHAR_SET_DEV_INTERFACE,
+ INTERFACE_ID_PPB_CHAR_SET,
+ false,
+ &CreateCharSetProxy,
+ };
+ return &info;
+}
+
ppapi::thunk::PPB_CharSet_FunctionAPI*
PPB_CharSet_Proxy::AsPPB_CharSet_FunctionAPI() {
return this;
@@ -37,8 +63,8 @@ char* PPB_CharSet_Proxy::UTF16ToCharSet(
PP_CharSet_ConversionError on_error,
uint32_t* output_length) {
return ppapi::CharSetImpl::UTF16ToCharSet(
- GetPPB_Memory_Interface(), utf16, utf16_len,
- output_char_set, on_error, output_length);
+ GetMemoryDevInterface(), utf16, utf16_len, output_char_set, on_error,
+ output_length);
}
uint16_t* PPB_CharSet_Proxy::CharSetToUTF16(
@@ -48,8 +74,8 @@ uint16_t* PPB_CharSet_Proxy::CharSetToUTF16(
PP_CharSet_ConversionError on_error,
uint32_t* output_length) {
return ppapi::CharSetImpl::CharSetToUTF16(
- GetPPB_Memory_Interface(), input, input_len,
- input_char_set, on_error, output_length);
+ GetMemoryDevInterface(), input, input_len, input_char_set, on_error,
+ output_length);
}
PP_Var PPB_CharSet_Proxy::GetDefaultCharSet(PP_Instance instance) {
diff --git a/ppapi/proxy/ppb_char_set_proxy.h b/ppapi/proxy/ppb_char_set_proxy.h
index 39ddc7b..af5cdc0 100644
--- a/ppapi/proxy/ppb_char_set_proxy.h
+++ b/ppapi/proxy/ppb_char_set_proxy.h
@@ -19,12 +19,15 @@ namespace proxy {
class SerializedVarReturnValue;
-class PPB_CharSet_Proxy : public InterfaceProxy,
- public ppapi::thunk::PPB_CharSet_FunctionAPI {
+class PPB_CharSet_Proxy : public ppapi::FunctionGroupBase,
+ public ppapi::thunk::PPB_CharSet_FunctionAPI,
+ public InterfaceProxy {
public:
- PPB_CharSet_Proxy(Dispatcher* dispatcher);
+ PPB_CharSet_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPB_CharSet_Proxy();
+ static const Info* GetInfo();
+
// FunctionGroupBase overrides.
virtual ppapi::thunk::PPB_CharSet_FunctionAPI* AsPPB_CharSet_FunctionAPI()
OVERRIDE;
@@ -45,8 +48,6 @@ class PPB_CharSet_Proxy : public InterfaceProxy,
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
- static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_CHAR_SET;
-
private:
void OnMsgGetDefaultCharSet(PP_Instance instance,
SerializedVarReturnValue result);
diff --git a/ppapi/proxy/ppb_console_proxy.cc b/ppapi/proxy/ppb_console_proxy.cc
new file mode 100644
index 0000000..3745a77
--- /dev/null
+++ b/ppapi/proxy/ppb_console_proxy.cc
@@ -0,0 +1,103 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/proxy/ppb_console_proxy.h"
+
+#include "ppapi/c/dev/ppb_console_dev.h"
+#include "ppapi/proxy/plugin_dispatcher.h"
+#include "ppapi/proxy/ppapi_messages.h"
+
+namespace ppapi {
+namespace proxy {
+
+namespace {
+
+void Log(PP_Instance instance, PP_LogLevel_Dev level, PP_Var value) {
+ PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
+ if (!dispatcher)
+ return;
+ dispatcher->Send(new PpapiHostMsg_PPBConsole_Log(
+ INTERFACE_ID_PPB_CONSOLE, instance, static_cast<int>(level),
+ SerializedVarSendInput(dispatcher, value)));
+}
+
+void LogWithSource(PP_Instance instance,
+ PP_LogLevel_Dev level,
+ const PP_Var source,
+ const PP_Var value) {
+ PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
+ if (!dispatcher)
+ return;
+ dispatcher->Send(new PpapiHostMsg_PPBConsole_LogWithSource(
+ INTERFACE_ID_PPB_CONSOLE, instance, static_cast<int>(level),
+ SerializedVarSendInput(dispatcher, source),
+ SerializedVarSendInput(dispatcher, value)));
+}
+
+const PPB_Console_Dev console_interface = {
+ &Log,
+ &LogWithSource
+};
+
+InterfaceProxy* CreateConsoleProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_Console_Proxy(dispatcher, target_interface);
+}
+
+} // namespace
+
+PPB_Console_Proxy::PPB_Console_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
+}
+
+PPB_Console_Proxy::~PPB_Console_Proxy() {
+}
+
+// static
+const InterfaceProxy::Info* PPB_Console_Proxy::GetInfo() {
+ static const Info info = {
+ &console_interface,
+ PPB_CONSOLE_DEV_INTERFACE,
+ INTERFACE_ID_PPB_CONSOLE,
+ false,
+ &CreateConsoleProxy,
+ };
+ return &info;
+}
+
+bool PPB_Console_Proxy::OnMessageReceived(const IPC::Message& msg) {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(PPB_Console_Proxy, msg)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBConsole_Log,
+ OnMsgLog)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBConsole_LogWithSource,
+ OnMsgLogWithSource)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+ return handled;
+}
+
+void PPB_Console_Proxy::OnMsgLog(PP_Instance instance,
+ int log_level,
+ SerializedVarReceiveInput value) {
+ ppb_console_target()->Log(instance,
+ static_cast<PP_LogLevel_Dev>(log_level),
+ value.Get(dispatcher()));
+}
+
+void PPB_Console_Proxy::OnMsgLogWithSource(PP_Instance instance,
+ int log_level,
+ SerializedVarReceiveInput source,
+ SerializedVarReceiveInput value) {
+ ppb_console_target()->LogWithSource(
+ instance,
+ static_cast<PP_LogLevel_Dev>(log_level),
+ source.Get(dispatcher()),
+ value.Get(dispatcher()));
+}
+
+} // namespace proxy
+} // namespace ppapi
+
diff --git a/ppapi/proxy/ppb_console_proxy.h b/ppapi/proxy/ppb_console_proxy.h
new file mode 100644
index 0000000..33c1d2b
--- /dev/null
+++ b/ppapi/proxy/ppb_console_proxy.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_PROXY_PPB_CONSOLE_PROXY_H_
+#define PPAPI_PROXY_PPB_CONSOLE_PROXY_H_
+
+#include "base/basictypes.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/proxy/interface_proxy.h"
+#include "ppapi/proxy/serialized_var.h"
+
+struct PPB_Console_Dev;
+
+namespace ppapi {
+namespace proxy {
+
+class PPB_Console_Proxy : public InterfaceProxy {
+ public:
+ PPB_Console_Proxy(Dispatcher* dispatcher, const void* target_interface);
+ virtual ~PPB_Console_Proxy();
+
+ static const Info* GetInfo();
+
+ const PPB_Console_Dev* ppb_console_target() const {
+ return static_cast<const PPB_Console_Dev*>(target_interface());
+ }
+
+ // InterfaceProxy implementation.
+ virtual bool OnMessageReceived(const IPC::Message& msg);
+
+ private:
+ // Message handlers.
+ void OnMsgLog(PP_Instance instance,
+ int log_level,
+ SerializedVarReceiveInput value);
+ void OnMsgLogWithSource(PP_Instance instance,
+ int log_level,
+ SerializedVarReceiveInput source,
+ SerializedVarReceiveInput value);
+
+ DISALLOW_COPY_AND_ASSIGN(PPB_Console_Proxy);
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PROXY_PPB_CONSOLE_PROXY_H_
diff --git a/ppapi/proxy/ppb_context_3d_proxy.cc b/ppapi/proxy/ppb_context_3d_proxy.cc
index 460c922..26ad740 100644
--- a/ppapi/proxy/ppb_context_3d_proxy.cc
+++ b/ppapi/proxy/ppb_context_3d_proxy.cc
@@ -68,6 +68,11 @@ gpu::CommandBuffer::State GPUStateFromPPState(
const int32 kCommandBufferSize = 1024 * 1024;
const int32 kTransferBufferSize = 1024 * 1024;
+InterfaceProxy* CreateContext3DProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_Context3D_Proxy(dispatcher, target_interface);
+}
+
} // namespace
class PepperCommandBuffer : public gpu::CommandBuffer {
@@ -516,14 +521,39 @@ gpu::gles2::GLES2Implementation* Context3D::GetGLES2Impl() {
// PPB_Context3D_Proxy ---------------------------------------------------------
-PPB_Context3D_Proxy::PPB_Context3D_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher) {
+PPB_Context3D_Proxy::PPB_Context3D_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
}
PPB_Context3D_Proxy::~PPB_Context3D_Proxy() {
}
// static
+const InterfaceProxy::Info* PPB_Context3D_Proxy::GetInfo() {
+ static const Info info = {
+ thunk::GetPPB_Context3D_Thunk(),
+ PPB_CONTEXT_3D_DEV_INTERFACE,
+ INTERFACE_ID_PPB_CONTEXT_3D,
+ false,
+ &CreateContext3DProxy,
+ };
+ return &info;
+}
+
+// static
+const InterfaceProxy::Info* PPB_Context3D_Proxy::GetTextureMappingInfo() {
+ static const Info info = {
+ thunk::GetPPB_GLESChromiumTextureMapping_Thunk(),
+ PPB_GLES_CHROMIUM_TEXTURE_MAPPING_DEV_INTERFACE,
+ INTERFACE_ID_NONE, // CONTEXT_3D is the canonical one.
+ false,
+ &CreateContext3DProxy,
+ };
+ return &info;
+}
+
+// static
PP_Resource PPB_Context3D_Proxy::Create(PP_Instance instance,
PP_Config3D_Dev config,
PP_Resource share_context,
@@ -591,7 +621,7 @@ void PPB_Context3D_Proxy::OnMsgCreate(PP_Instance instance,
HostResource* result) {
if (attribs.empty() || attribs.back() != 0)
return; // Bad message.
- thunk::EnterResourceCreation enter(instance);
+ EnterFunctionNoLock<ResourceCreationAPI> enter(instance, true);
if (enter.succeeded()) {
result->SetHostResource(
instance,
diff --git a/ppapi/proxy/ppb_context_3d_proxy.h b/ppapi/proxy/ppb_context_3d_proxy.h
index 9670f3a..a24a78d 100644
--- a/ppapi/proxy/ppb_context_3d_proxy.h
+++ b/ppapi/proxy/ppb_context_3d_proxy.h
@@ -94,9 +94,12 @@ class Context3D : public Resource, public thunk::PPB_Context3D_API {
class PPB_Context3D_Proxy : public InterfaceProxy {
public:
- PPB_Context3D_Proxy(Dispatcher* dispatcher);
+ PPB_Context3D_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPB_Context3D_Proxy();
+ static const Info* GetInfo();
+ static const Info* GetTextureMappingInfo();
+
static PP_Resource Create(PP_Instance instance,
PP_Config3D_Dev config,
PP_Resource share_context,
@@ -105,8 +108,6 @@ class PPB_Context3D_Proxy : public InterfaceProxy {
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
- static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_CONTEXT_3D;
-
private:
void OnMsgCreate(PP_Instance instance,
PP_Config3D_Dev config,
diff --git a/ppapi/proxy/ppb_core_proxy.cc b/ppapi/proxy/ppb_core_proxy.cc
index d3d17c0..83eea37 100644
--- a/ppapi/proxy/ppb_core_proxy.cc
+++ b/ppapi/proxy/ppb_core_proxy.cc
@@ -75,23 +75,31 @@ const PPB_Core core_interface = {
&IsMainThread
};
+InterfaceProxy* CreateCoreProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_Core_Proxy(dispatcher, target_interface);
+}
+
} // namespace
-PPB_Core_Proxy::PPB_Core_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
- ppb_core_impl_(NULL) {
- if (!dispatcher->IsPlugin()) {
- ppb_core_impl_ = static_cast<const PPB_Core*>(
- dispatcher->local_get_interface()(PPB_CORE_INTERFACE));
- }
+PPB_Core_Proxy::PPB_Core_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
}
PPB_Core_Proxy::~PPB_Core_Proxy() {
}
// static
-const PPB_Core* PPB_Core_Proxy::GetPPB_Core_Interface() {
- return &core_interface;
+const InterfaceProxy::Info* PPB_Core_Proxy::GetInfo() {
+ static const Info info = {
+ &core_interface,
+ PPB_CORE_INTERFACE,
+ INTERFACE_ID_PPB_CORE,
+ false,
+ &CreateCoreProxy,
+ };
+ return &info;
}
bool PPB_Core_Proxy::OnMessageReceived(const IPC::Message& msg) {
@@ -108,11 +116,11 @@ bool PPB_Core_Proxy::OnMessageReceived(const IPC::Message& msg) {
}
void PPB_Core_Proxy::OnMsgAddRefResource(const HostResource& resource) {
- ppb_core_impl_->AddRefResource(resource.host_resource());
+ ppb_core_target()->AddRefResource(resource.host_resource());
}
void PPB_Core_Proxy::OnMsgReleaseResource(const HostResource& resource) {
- ppb_core_impl_->ReleaseResource(resource.host_resource());
+ ppb_core_target()->ReleaseResource(resource.host_resource());
}
} // namespace proxy
diff --git a/ppapi/proxy/ppb_core_proxy.h b/ppapi/proxy/ppb_core_proxy.h
index 950e5e8..1963e71 100644
--- a/ppapi/proxy/ppb_core_proxy.h
+++ b/ppapi/proxy/ppb_core_proxy.h
@@ -8,7 +8,6 @@
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_var.h"
-#include "ppapi/c/ppb_core.h"
#include "ppapi/proxy/interface_proxy.h"
#include "ppapi/shared_impl/host_resource.h"
@@ -19,25 +18,22 @@ namespace proxy {
class PPB_Core_Proxy : public InterfaceProxy {
public:
- PPB_Core_Proxy(Dispatcher* dispatcher);
+ PPB_Core_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPB_Core_Proxy();
- static const PPB_Core* GetPPB_Core_Interface();
+ static const Info* GetInfo();
+
+ const PPB_Core* ppb_core_target() const {
+ return reinterpret_cast<const PPB_Core*>(target_interface());
+ }
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
- static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_CORE;
-
private:
// Message handlers.
void OnMsgAddRefResource(const ppapi::HostResource& resource);
void OnMsgReleaseResource(const ppapi::HostResource& resource);
-
- // When this proxy is in the host side, this value caches the interface
- // pointer so we don't have to retrieve it from the dispatcher each time.
- // In the plugin, this value is always NULL.
- const PPB_Core* ppb_core_impl_;
};
} // namespace proxy
diff --git a/ppapi/proxy/ppb_crypto_proxy.cc b/ppapi/proxy/ppb_crypto_proxy.cc
index e80e17a..c534864 100644
--- a/ppapi/proxy/ppb_crypto_proxy.cc
+++ b/ppapi/proxy/ppb_crypto_proxy.cc
@@ -17,14 +17,16 @@ const PPB_Crypto_Dev crypto_interface = {
&ppapi::CryptoImpl::GetRandomBytes
};
-InterfaceProxy* CreateCryptoProxy(Dispatcher* dispatcher) {
- return new PPB_Crypto_Proxy(dispatcher);
+InterfaceProxy* CreateCryptoProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_Crypto_Proxy(dispatcher, target_interface);
}
} // namespace
-PPB_Crypto_Proxy::PPB_Crypto_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher) {
+PPB_Crypto_Proxy::PPB_Crypto_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
NOTREACHED(); // See comment in the header file.
}
diff --git a/ppapi/proxy/ppb_crypto_proxy.h b/ppapi/proxy/ppb_crypto_proxy.h
index 8e343a8..3ad77c9 100644
--- a/ppapi/proxy/ppb_crypto_proxy.h
+++ b/ppapi/proxy/ppb_crypto_proxy.h
@@ -16,7 +16,7 @@ class PPB_Crypto_Proxy : public InterfaceProxy {
// function that's implemented entirely within the plugin. However, we need
// to support this so the machinery for automatically handling interfaces
// works. As a result, this constructor will assert if it's actually used.
- PPB_Crypto_Proxy(Dispatcher* dispatcher);
+ PPB_Crypto_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPB_Crypto_Proxy();
static const Info* GetInfo();
diff --git a/ppapi/proxy/ppb_cursor_control_proxy.cc b/ppapi/proxy/ppb_cursor_control_proxy.cc
index a0b0ee8..5366ea0 100644
--- a/ppapi/proxy/ppb_cursor_control_proxy.cc
+++ b/ppapi/proxy/ppb_cursor_control_proxy.cc
@@ -18,13 +18,35 @@ using ppapi::thunk::PPB_CursorControl_FunctionAPI;
namespace ppapi {
namespace proxy {
-PPB_CursorControl_Proxy::PPB_CursorControl_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher) {
+namespace {
+
+InterfaceProxy* CreateCursorControlProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_CursorControl_Proxy(dispatcher, target_interface);
+}
+
+} // namespace
+
+PPB_CursorControl_Proxy::PPB_CursorControl_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
}
PPB_CursorControl_Proxy::~PPB_CursorControl_Proxy() {
}
+// static
+const InterfaceProxy::Info* PPB_CursorControl_Proxy::GetInfo() {
+ static const Info info = {
+ thunk::GetPPB_CursorControl_Thunk(),
+ PPB_CURSOR_CONTROL_DEV_INTERFACE,
+ INTERFACE_ID_PPB_CURSORCONTROL,
+ false,
+ &CreateCursorControlProxy,
+ };
+ return &info;
+}
+
ppapi::thunk::PPB_CursorControl_FunctionAPI*
PPB_CursorControl_Proxy::AsPPB_CursorControl_FunctionAPI() {
return this;
diff --git a/ppapi/proxy/ppb_cursor_control_proxy.h b/ppapi/proxy/ppb_cursor_control_proxy.h
index 6c42c9b..027dbfe 100644
--- a/ppapi/proxy/ppb_cursor_control_proxy.h
+++ b/ppapi/proxy/ppb_cursor_control_proxy.h
@@ -21,12 +21,15 @@ namespace ppapi {
namespace proxy {
class PPB_CursorControl_Proxy
- : public InterfaceProxy,
- public ppapi::thunk::PPB_CursorControl_FunctionAPI {
+ : public ppapi::FunctionGroupBase,
+ public ppapi::thunk::PPB_CursorControl_FunctionAPI,
+ public InterfaceProxy {
public:
- PPB_CursorControl_Proxy(Dispatcher* dispatcher);
+ PPB_CursorControl_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPB_CursorControl_Proxy();
+ static const Info* GetInfo();
+
// FunctionGroupBase overrides.
ppapi::thunk::PPB_CursorControl_FunctionAPI* AsPPB_CursorControl_FunctionAPI()
OVERRIDE;
@@ -44,8 +47,6 @@ class PPB_CursorControl_Proxy
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
- static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_CURSORCONTROL;
-
private:
// Message handlers.
void OnMsgSetCursor(PP_Instance instance,
diff --git a/ppapi/proxy/ppb_file_chooser_proxy.cc b/ppapi/proxy/ppb_file_chooser_proxy.cc
index 73f7a6a..f13ea86 100644
--- a/ppapi/proxy/ppb_file_chooser_proxy.cc
+++ b/ppapi/proxy/ppb_file_chooser_proxy.cc
@@ -16,7 +16,6 @@
#include "ppapi/proxy/ppb_file_ref_proxy.h"
#include "ppapi/proxy/serialized_var.h"
#include "ppapi/shared_impl/var.h"
-#include "ppapi/thunk/resource_creation_api.h"
#include "ppapi/thunk/thunk.h"
using ppapi::thunk::PPB_FileChooser_API;
@@ -119,14 +118,77 @@ void FileChooser::ChooseComplete(
// DANGER: May delete |this|!
}
-PPB_FileChooser_Proxy::PPB_FileChooser_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
+namespace {
+
+PP_Resource Create0_4(PP_Instance instance,
+ const PP_FileChooserOptions_0_4_Dev* options) {
+ PP_Var accept_var = PP_MakeUndefined();
+ if (options->accept_mime_types)
+ accept_var = StringVar::StringToPPVar(0, options->accept_mime_types);
+ PP_Resource result = thunk::GetPPB_FileChooser_Thunk()->Create(
+ instance, options->mode, accept_var);
+ if (accept_var.type == PP_VARTYPE_STRING)
+ PluginResourceTracker::GetInstance()->var_tracker().ReleaseVar(accept_var);
+ return result;
+}
+
+PP_Bool IsFileChooser0_4(PP_Resource resource) {
+ return thunk::GetPPB_FileChooser_Thunk()->IsFileChooser(resource);
+}
+
+int32_t Show0_4(PP_Resource chooser, PP_CompletionCallback callback) {
+ return thunk::GetPPB_FileChooser_Thunk()->Show(chooser, callback);
+}
+
+PP_Resource GetNextChosenFile0_4(PP_Resource chooser) {
+ return thunk::GetPPB_FileChooser_Thunk()->GetNextChosenFile(chooser);
+}
+
+PPB_FileChooser_0_4_Dev file_chooser_0_4_interface = {
+ &Create0_4,
+ &IsFileChooser0_4,
+ &Show0_4,
+ &GetNextChosenFile0_4
+};
+
+InterfaceProxy* CreateFileChooserProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_FileChooser_Proxy(dispatcher, target_interface);
+}
+
+} // namespace
+
+PPB_FileChooser_Proxy::PPB_FileChooser_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface),
callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
}
PPB_FileChooser_Proxy::~PPB_FileChooser_Proxy() {
}
+const InterfaceProxy::Info* PPB_FileChooser_Proxy::GetInfo() {
+ static const Info info = {
+ thunk::GetPPB_FileChooser_Thunk(),
+ PPB_FILECHOOSER_DEV_INTERFACE,
+ INTERFACE_ID_PPB_FILE_CHOOSER,
+ false,
+ &CreateFileChooserProxy,
+ };
+ return &info;
+}
+
+const InterfaceProxy::Info* PPB_FileChooser_Proxy::GetInfo0_4() {
+ static const Info info = {
+ &file_chooser_0_4_interface,
+ PPB_FILECHOOSER_DEV_INTERFACE_0_4,
+ INTERFACE_ID_NONE,
+ false,
+ &CreateFileChooserProxy,
+ };
+ return &info;
+}
+
// static
PP_Resource PPB_FileChooser_Proxy::CreateProxyResource(
PP_Instance instance,
@@ -167,12 +229,9 @@ void PPB_FileChooser_Proxy::OnMsgCreate(
int mode,
SerializedVarReceiveInput accept_mime_types,
HostResource* result) {
- thunk::EnterResourceCreation enter(instance);
- if (enter.succeeded()) {
- result->SetHostResource(instance, enter.functions()->CreateFileChooser(
- instance, static_cast<PP_FileChooserMode_Dev>(mode),
- accept_mime_types.Get(dispatcher())));
- }
+ result->SetHostResource(instance, ppb_file_chooser_target()->Create(
+ instance, static_cast<PP_FileChooserMode_Dev>(mode),
+ accept_mime_types.Get(dispatcher())));
}
void PPB_FileChooser_Proxy::OnMsgShow(const HostResource& chooser) {
@@ -196,16 +255,19 @@ void PPB_FileChooser_Proxy::OnMsgChooseComplete(
void PPB_FileChooser_Proxy::OnShowCallback(int32_t result,
const HostResource& chooser) {
- EnterHostFromHostResource<PPB_FileChooser_API> enter(chooser);
-
std::vector<PPB_FileRef_CreateInfo> files;
- if (enter.succeeded() && result == PP_OK) {
+ if (result == PP_OK) {
+ // Jump through some hoops to get the FileRef proxy. Since we know we're
+ // in the host at this point, we can ask the host dispatcher for it.
+ DCHECK(!dispatcher()->IsPlugin());
+ HostDispatcher* host_disp = static_cast<HostDispatcher*>(dispatcher());
PPB_FileRef_Proxy* file_ref_proxy = static_cast<PPB_FileRef_Proxy*>(
- dispatcher()->GetInterfaceProxy(INTERFACE_ID_PPB_FILE_REF));
+ host_disp->GetOrCreatePPBInterfaceProxy(INTERFACE_ID_PPB_FILE_REF));
// Convert the returned files to the serialized info.
while (PP_Resource cur_file_resource =
- enter.object()->GetNextChosenFile()) {
+ ppb_file_chooser_target()->GetNextChosenFile(
+ chooser.host_resource())) {
PPB_FileRef_CreateInfo cur_create_info;
file_ref_proxy->SerializeFileRef(cur_file_resource, &cur_create_info);
files.push_back(cur_create_info);
diff --git a/ppapi/proxy/ppb_file_chooser_proxy.h b/ppapi/proxy/ppb_file_chooser_proxy.h
index f1dcd95..4f3bc84 100644
--- a/ppapi/proxy/ppb_file_chooser_proxy.h
+++ b/ppapi/proxy/ppb_file_chooser_proxy.h
@@ -28,19 +28,24 @@ class SerializedVarReceiveInput;
class PPB_FileChooser_Proxy : public InterfaceProxy {
public:
- PPB_FileChooser_Proxy(Dispatcher* dispatcher);
+ PPB_FileChooser_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPB_FileChooser_Proxy();
+ static const Info* GetInfo();
+ static const Info* GetInfo0_4();
+
static PP_Resource CreateProxyResource(
PP_Instance instance,
PP_FileChooserMode_Dev mode,
const PP_Var& accept_mime_types);
+ const PPB_FileChooser_Dev* ppb_file_chooser_target() const {
+ return static_cast<const PPB_FileChooser_Dev*>(target_interface());
+ }
+
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
- static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_FILE_CHOOSER;
-
private:
// Plugin -> host message handlers.
void OnMsgCreate(PP_Instance instance,
diff --git a/ppapi/proxy/ppb_file_ref_proxy.cc b/ppapi/proxy/ppb_file_ref_proxy.cc
index 49a1131..0cf26bd 100644
--- a/ppapi/proxy/ppb_file_ref_proxy.cc
+++ b/ppapi/proxy/ppb_file_ref_proxy.cc
@@ -24,6 +24,15 @@ using ppapi::thunk::ResourceCreationAPI;
namespace ppapi {
namespace proxy {
+namespace {
+
+InterfaceProxy* CreateFileRefProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_FileRef_Proxy(dispatcher, target_interface);
+}
+
+} // namespace
+
class FileRef : public FileRefImpl {
public:
explicit FileRef(const PPB_FileRef_CreateInfo& info);
@@ -102,13 +111,25 @@ int32_t FileRef::Rename(PP_Resource new_file_ref,
return PP_OK_COMPLETIONPENDING;
}
-PPB_FileRef_Proxy::PPB_FileRef_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher) {
+PPB_FileRef_Proxy::PPB_FileRef_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
}
PPB_FileRef_Proxy::~PPB_FileRef_Proxy() {
}
+const InterfaceProxy::Info* PPB_FileRef_Proxy::GetInfo() {
+ static const Info info = {
+ thunk::GetPPB_FileRef_Thunk(),
+ PPB_FILEREF_INTERFACE,
+ INTERFACE_ID_PPB_FILE_REF,
+ false,
+ &CreateFileRefProxy,
+ };
+ return &info;
+}
+
// static
PP_Resource PPB_FileRef_Proxy::CreateProxyResource(PP_Resource file_system,
const char* path) {
@@ -158,7 +179,7 @@ PP_Resource PPB_FileRef_Proxy::DeserializeFileRef(
void PPB_FileRef_Proxy::OnMsgCreate(const HostResource& file_system,
const std::string& path,
PPB_FileRef_CreateInfo* result) {
- thunk::EnterResourceCreation enter(file_system.instance());
+ EnterFunctionNoLock<ResourceCreationAPI> enter(file_system.instance(), true);
if (enter.failed())
return;
PP_Resource resource = enter.functions()->CreateFileRef(
diff --git a/ppapi/proxy/ppb_file_ref_proxy.h b/ppapi/proxy/ppb_file_ref_proxy.h
index 6133c1a..1241343 100644
--- a/ppapi/proxy/ppb_file_ref_proxy.h
+++ b/ppapi/proxy/ppb_file_ref_proxy.h
@@ -24,9 +24,11 @@ namespace proxy {
class PPB_FileRef_Proxy : public InterfaceProxy {
public:
- PPB_FileRef_Proxy(Dispatcher* dispatcher);
+ PPB_FileRef_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPB_FileRef_Proxy();
+ static const Info* GetInfo();
+
static PP_Resource CreateProxyResource(PP_Resource file_system,
const char* path);
@@ -55,8 +57,6 @@ class PPB_FileRef_Proxy : public InterfaceProxy {
static PP_Resource DeserializeFileRef(
const PPB_FileRef_CreateInfo& serialized);
- static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_FILE_REF;
-
private:
// Message handlers.
void OnMsgCreate(const ppapi::HostResource& file_system,
diff --git a/ppapi/proxy/ppb_file_system_proxy.cc b/ppapi/proxy/ppb_file_system_proxy.cc
index 8fc7b55..899c51f 100644
--- a/ppapi/proxy/ppb_file_system_proxy.cc
+++ b/ppapi/proxy/ppb_file_system_proxy.cc
@@ -27,8 +27,9 @@ namespace proxy {
namespace {
-InterfaceProxy* CreateFileSystemProxy(Dispatcher* dispatcher) {
- return new PPB_FileSystem_Proxy(dispatcher);
+InterfaceProxy* CreateFileSystemProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_FileSystem_Proxy(dispatcher, target_interface);
}
} // namespace
@@ -109,8 +110,9 @@ void FileSystem::OpenComplete(int32_t result) {
PP_RunAndClearCompletionCallback(&current_open_callback_, result);
}
-PPB_FileSystem_Proxy::PPB_FileSystem_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
+PPB_FileSystem_Proxy::PPB_FileSystem_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface),
callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
}
@@ -158,7 +160,7 @@ bool PPB_FileSystem_Proxy::OnMessageReceived(const IPC::Message& msg) {
void PPB_FileSystem_Proxy::OnMsgCreate(PP_Instance instance,
int type,
HostResource* result) {
- thunk::EnterResourceCreation enter(instance);
+ EnterFunctionNoLock<ResourceCreationAPI> enter(instance, true);
if (enter.failed())
return;
PP_Resource resource = enter.functions()->CreateFileSystem(
diff --git a/ppapi/proxy/ppb_file_system_proxy.h b/ppapi/proxy/ppb_file_system_proxy.h
index 5573cce..b83fb992 100644
--- a/ppapi/proxy/ppb_file_system_proxy.h
+++ b/ppapi/proxy/ppb_file_system_proxy.h
@@ -26,7 +26,7 @@ namespace proxy {
class PPB_FileSystem_Proxy : public InterfaceProxy {
public:
- PPB_FileSystem_Proxy(Dispatcher* dispatcher);
+ PPB_FileSystem_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPB_FileSystem_Proxy();
static const Info* GetInfo();
@@ -37,8 +37,6 @@ class PPB_FileSystem_Proxy : public InterfaceProxy {
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
- static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_FILE_SYSTEM;
-
private:
// Message handlers.
void OnMsgCreate(PP_Instance instance,
diff --git a/ppapi/proxy/ppb_flash_clipboard_proxy.cc b/ppapi/proxy/ppb_flash_clipboard_proxy.cc
index 18918fc..38e3e5b 100644
--- a/ppapi/proxy/ppb_flash_clipboard_proxy.cc
+++ b/ppapi/proxy/ppb_flash_clipboard_proxy.cc
@@ -88,19 +88,16 @@ const PPB_Flash_Clipboard flash_clipboard_interface = {
&WritePlainText
};
-InterfaceProxy* CreateFlashClipboardProxy(Dispatcher* dispatcher) {
- return new PPB_Flash_Clipboard_Proxy(dispatcher);
+InterfaceProxy* CreateFlashClipboardProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_Flash_Clipboard_Proxy(dispatcher, target_interface);
}
} // namespace
-PPB_Flash_Clipboard_Proxy::PPB_Flash_Clipboard_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
- ppb_flash_clipboard_impl_(NULL) {
- if (!dispatcher->IsPlugin()) {
- ppb_flash_clipboard_impl_ = static_cast<const PPB_Flash_Clipboard*>(
- dispatcher->local_get_interface()(PPB_FLASH_CLIPBOARD_INTERFACE));
- }
+PPB_Flash_Clipboard_Proxy::PPB_Flash_Clipboard_Proxy(
+ Dispatcher* dispatcher, const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
}
PPB_Flash_Clipboard_Proxy::~PPB_Flash_Clipboard_Proxy() {
@@ -137,7 +134,7 @@ void PPB_Flash_Clipboard_Proxy::OnMsgIsFormatAvailable(
int clipboard_type,
int format,
bool* result) {
- *result = PP_ToBool(ppb_flash_clipboard_impl_->IsFormatAvailable(
+ *result = PP_ToBool(ppb_flash_clipboard_target()->IsFormatAvailable(
instance_id,
static_cast<PP_Flash_Clipboard_Type>(clipboard_type),
static_cast<PP_Flash_Clipboard_Format>(format)));
@@ -148,7 +145,7 @@ void PPB_Flash_Clipboard_Proxy::OnMsgReadPlainText(
int clipboard_type,
SerializedVarReturnValue result) {
result.Return(dispatcher(),
- ppb_flash_clipboard_impl_->ReadPlainText(
+ ppb_flash_clipboard_target()->ReadPlainText(
instance_id,
static_cast<PP_Flash_Clipboard_Type>(clipboard_type)));
}
@@ -157,7 +154,7 @@ void PPB_Flash_Clipboard_Proxy::OnMsgWritePlainText(
PP_Instance instance_id,
int clipboard_type,
SerializedVarReceiveInput text) {
- int32_t result = ppb_flash_clipboard_impl_->WritePlainText(
+ int32_t result = ppb_flash_clipboard_target()->WritePlainText(
instance_id,
static_cast<PP_Flash_Clipboard_Type>(clipboard_type),
text.Get(dispatcher()));
diff --git a/ppapi/proxy/ppb_flash_clipboard_proxy.h b/ppapi/proxy/ppb_flash_clipboard_proxy.h
index 8d7a7b5..e0a1acf 100644
--- a/ppapi/proxy/ppb_flash_clipboard_proxy.h
+++ b/ppapi/proxy/ppb_flash_clipboard_proxy.h
@@ -18,11 +18,16 @@ class SerializedVarReturnValue;
class PPB_Flash_Clipboard_Proxy : public InterfaceProxy {
public:
- PPB_Flash_Clipboard_Proxy(Dispatcher* dispatcher);
+ PPB_Flash_Clipboard_Proxy(Dispatcher* dispatcher,
+ const void* target_interface);
virtual ~PPB_Flash_Clipboard_Proxy();
static const Info* GetInfo();
+ const PPB_Flash_Clipboard* ppb_flash_clipboard_target() const {
+ return reinterpret_cast<const PPB_Flash_Clipboard*>(target_interface());
+ }
+
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
@@ -38,11 +43,6 @@ class PPB_Flash_Clipboard_Proxy : public InterfaceProxy {
void OnMsgWritePlainText(PP_Instance instance_id,
int clipboard_type,
SerializedVarReceiveInput text);
-
- // When this proxy is in the host side, this value caches the interface
- // pointer so we don't have to retrieve it from the dispatcher each time.
- // In the plugin, this value is always NULL.
- const PPB_Flash_Clipboard* ppb_flash_clipboard_impl_;
};
} // namespace proxy
diff --git a/ppapi/proxy/ppb_flash_file_proxy.cc b/ppapi/proxy/ppb_flash_file_proxy.cc
index 5f7ef23..138f990 100644
--- a/ppapi/proxy/ppb_flash_file_proxy.cc
+++ b/ppapi/proxy/ppb_flash_file_proxy.cc
@@ -501,22 +501,17 @@ const PPB_Flash_File_ModuleLocal flash_file_modulelocal_interface = {
&FreeDirContents,
};
-InterfaceProxy* CreateFlashFileModuleLocalProxy(Dispatcher* dispatcher) {
- return new PPB_Flash_File_ModuleLocal_Proxy(dispatcher);
+InterfaceProxy* CreateFlashFileModuleLocalProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_Flash_File_ModuleLocal_Proxy(dispatcher, target_interface);
}
} // namespace
PPB_Flash_File_ModuleLocal_Proxy::PPB_Flash_File_ModuleLocal_Proxy(
- Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
- ppb_flash_file_module_local_impl_(NULL) {
- if (!dispatcher->IsPlugin()) {
- ppb_flash_file_module_local_impl_ =
- static_cast<const PPB_Flash_File_ModuleLocal*>(
- dispatcher->local_get_interface()(
- PPB_FLASH_FILE_MODULELOCAL_INTERFACE));
- }
+ Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
}
PPB_Flash_File_ModuleLocal_Proxy::~PPB_Flash_File_ModuleLocal_Proxy() {
@@ -563,8 +558,8 @@ void PPB_Flash_File_ModuleLocal_Proxy::OnMsgOpenFile(
IPC::PlatformFileForTransit* file_handle,
int32_t* result) {
base::PlatformFile file;
- *result = ppb_flash_file_module_local_impl_->OpenFile(
- instance, path.c_str(), mode, &file);
+ *result = ppb_flash_file_module_local_target()->
+ OpenFile(instance, path.c_str(), mode, &file);
*file_handle = PlatformFileToPlatformFileForTransit(
dispatcher(), result, file);
}
@@ -574,8 +569,8 @@ void PPB_Flash_File_ModuleLocal_Proxy::OnMsgRenameFile(
const std::string& from_path,
const std::string& to_path,
int32_t* result) {
- *result = ppb_flash_file_module_local_impl_->RenameFile(
- instance, from_path.c_str(), to_path.c_str());
+ *result = ppb_flash_file_module_local_target()->
+ RenameFile(instance, from_path.c_str(), to_path.c_str());
}
void PPB_Flash_File_ModuleLocal_Proxy::OnMsgDeleteFileOrDir(
@@ -583,23 +578,23 @@ void PPB_Flash_File_ModuleLocal_Proxy::OnMsgDeleteFileOrDir(
const std::string& path,
PP_Bool recursive,
int32_t* result) {
- *result = ppb_flash_file_module_local_impl_->DeleteFileOrDir(
- instance, path.c_str(), recursive);
+ *result = ppb_flash_file_module_local_target()->
+ DeleteFileOrDir(instance, path.c_str(), recursive);
}
void PPB_Flash_File_ModuleLocal_Proxy::OnMsgCreateDir(PP_Instance instance,
const std::string& path,
int32_t* result) {
- *result = ppb_flash_file_module_local_impl_->CreateDir(
- instance, path.c_str());
+ *result = ppb_flash_file_module_local_target()->
+ CreateDir(instance, path.c_str());
}
void PPB_Flash_File_ModuleLocal_Proxy::OnMsgQueryFile(PP_Instance instance,
const std::string& path,
PP_FileInfo* info,
int32_t* result) {
- *result = ppb_flash_file_module_local_impl_->QueryFile(
- instance, path.c_str(), info);
+ *result = ppb_flash_file_module_local_target()->
+ QueryFile(instance, path.c_str(), info);
}
void PPB_Flash_File_ModuleLocal_Proxy::OnMsgGetDirContents(
@@ -608,8 +603,8 @@ void PPB_Flash_File_ModuleLocal_Proxy::OnMsgGetDirContents(
std::vector<SerializedDirEntry>* entries,
int32_t* result) {
PP_DirContents_Dev* contents = NULL;
- *result = ppb_flash_file_module_local_impl_->GetDirContents(
- instance, path.c_str(), &contents);
+ *result = ppb_flash_file_module_local_target()->
+ GetDirContents(instance, path.c_str(), &contents);
if (*result != PP_OK)
return;
@@ -619,7 +614,7 @@ void PPB_Flash_File_ModuleLocal_Proxy::OnMsgGetDirContents(
(*entries)[i].name.assign(contents->entries[i].name);
(*entries)[i].is_dir = PP_ToBool(contents->entries[i].is_dir);
}
- ppb_flash_file_module_local_impl_->FreeDirContents(instance, contents);
+ ppb_flash_file_module_local_target()->FreeDirContents(instance, contents);
}
// PPB_Flash_File_FileRef ------------------------------------------------------
@@ -670,20 +665,17 @@ const PPB_Flash_File_FileRef flash_file_fileref_interface = {
&QueryFileRefFile,
};
-InterfaceProxy* CreateFlashFileFileRefProxy(Dispatcher* dispatcher) {
- return new PPB_Flash_File_FileRef_Proxy(dispatcher);
+InterfaceProxy* CreateFlashFileFileRefProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_Flash_File_FileRef_Proxy(dispatcher, target_interface);
}
} // namespace
PPB_Flash_File_FileRef_Proxy::PPB_Flash_File_FileRef_Proxy(
- Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
- ppb_flash_file_fileref_impl_(NULL) {
- if (!dispatcher->IsPlugin()) {
- ppb_flash_file_fileref_impl_ = static_cast<const PPB_Flash_File_FileRef*>(
- dispatcher->local_get_interface()(PPB_FLASH_FILE_FILEREF_INTERFACE));
- }
+ Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
}
PPB_Flash_File_FileRef_Proxy::~PPB_Flash_File_FileRef_Proxy() {
@@ -721,8 +713,8 @@ void PPB_Flash_File_FileRef_Proxy::OnMsgOpenFile(
IPC::PlatformFileForTransit* file_handle,
int32_t* result) {
base::PlatformFile file;
- *result = ppb_flash_file_fileref_impl_->OpenFile(
- host_resource.host_resource(), mode, &file);
+ *result = ppb_flash_file_module_local_target()->
+ OpenFile(host_resource.host_resource(), mode, &file);
*file_handle = PlatformFileToPlatformFileForTransit(
dispatcher(), result, file);
}
@@ -731,8 +723,8 @@ void PPB_Flash_File_FileRef_Proxy::OnMsgQueryFile(
const HostResource& host_resource,
PP_FileInfo* info,
int32_t* result) {
- *result = ppb_flash_file_fileref_impl_->QueryFile(
- host_resource.host_resource(), info);
+ *result = ppb_flash_file_module_local_target()->
+ QueryFile(host_resource.host_resource(), info);
}
} // namespace proxy
diff --git a/ppapi/proxy/ppb_flash_file_proxy.h b/ppapi/proxy/ppb_flash_file_proxy.h
index b0ebb63..ee8d05d 100644
--- a/ppapi/proxy/ppb_flash_file_proxy.h
+++ b/ppapi/proxy/ppb_flash_file_proxy.h
@@ -27,11 +27,16 @@ struct SerializedDirEntry;
class PPB_Flash_File_ModuleLocal_Proxy : public InterfaceProxy {
public:
- PPB_Flash_File_ModuleLocal_Proxy(Dispatcher* dispatcher);
+ PPB_Flash_File_ModuleLocal_Proxy(Dispatcher* dispatcher,
+ const void* target_interface);
virtual ~PPB_Flash_File_ModuleLocal_Proxy();
static const Info* GetInfo();
+ const PPB_Flash_File_ModuleLocal* ppb_flash_file_module_local_target() const {
+ return static_cast<const PPB_Flash_File_ModuleLocal*>(target_interface());
+ }
+
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
@@ -61,22 +66,20 @@ class PPB_Flash_File_ModuleLocal_Proxy : public InterfaceProxy {
const std::string& path,
std::vector<SerializedDirEntry>* entries,
int32_t* result);
-
- // When this proxy is in the host side, this value caches the interface
- // pointer so we don't have to retrieve it from the dispatcher each time.
- // In the plugin, this value is always NULL.
- const PPB_Flash_File_ModuleLocal* ppb_flash_file_module_local_impl_;
-
- DISALLOW_COPY_AND_ASSIGN(PPB_Flash_File_ModuleLocal_Proxy);
};
class PPB_Flash_File_FileRef_Proxy : public InterfaceProxy {
public:
- PPB_Flash_File_FileRef_Proxy(Dispatcher* dispatcher);
+ PPB_Flash_File_FileRef_Proxy(Dispatcher* dispatcher,
+ const void* target_interface);
virtual ~PPB_Flash_File_FileRef_Proxy();
static const Info* GetInfo();
+ const PPB_Flash_File_FileRef* ppb_flash_file_module_local_target() const {
+ return static_cast<const PPB_Flash_File_FileRef*>(target_interface());
+ }
+
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
@@ -89,13 +92,6 @@ class PPB_Flash_File_FileRef_Proxy : public InterfaceProxy {
void OnMsgQueryFile(const ppapi::HostResource& host_resource,
PP_FileInfo* info,
int32_t* result);
-
- // When this proxy is in the host side, this value caches the interface
- // pointer so we don't have to retrieve it from the dispatcher each time.
- // In the plugin, this value is always NULL.
- const PPB_Flash_File_FileRef* ppb_flash_file_fileref_impl_;
-
- DISALLOW_COPY_AND_ASSIGN(PPB_Flash_File_FileRef_Proxy);
};
} // namespace proxy
diff --git a/ppapi/proxy/ppb_flash_menu_proxy.cc b/ppapi/proxy/ppb_flash_menu_proxy.cc
index fad5689..5f6ff05 100644
--- a/ppapi/proxy/ppb_flash_menu_proxy.cc
+++ b/ppapi/proxy/ppb_flash_menu_proxy.cc
@@ -77,14 +77,16 @@ void FlashMenu::ShowACK(int32_t selected_id, int32_t result) {
namespace {
-InterfaceProxy* CreateFlashMenuProxy(Dispatcher* dispatcher) {
- return new PPB_Flash_Menu_Proxy(dispatcher);
+InterfaceProxy* CreateFlashMenuProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_Flash_Menu_Proxy(dispatcher, target_interface);
}
} // namespace
-PPB_Flash_Menu_Proxy::PPB_Flash_Menu_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
+PPB_Flash_Menu_Proxy::PPB_Flash_Menu_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface),
callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
}
@@ -142,7 +144,7 @@ bool PPB_Flash_Menu_Proxy::OnMessageReceived(const IPC::Message& msg) {
void PPB_Flash_Menu_Proxy::OnMsgCreate(PP_Instance instance,
const SerializedFlashMenu& menu_data,
HostResource* result) {
- thunk::EnterResourceCreation enter(instance);
+ EnterFunctionNoLock<ResourceCreationAPI> enter(instance, true);
if (enter.succeeded()) {
result->SetHostResource(
instance,
diff --git a/ppapi/proxy/ppb_flash_menu_proxy.h b/ppapi/proxy/ppb_flash_menu_proxy.h
index 51a4dc6..869a7d6 100644
--- a/ppapi/proxy/ppb_flash_menu_proxy.h
+++ b/ppapi/proxy/ppb_flash_menu_proxy.h
@@ -22,7 +22,7 @@ class SerializedFlashMenu;
class PPB_Flash_Menu_Proxy : public InterfaceProxy {
public:
- PPB_Flash_Menu_Proxy(Dispatcher* dispatcher);
+ PPB_Flash_Menu_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPB_Flash_Menu_Proxy();
static const Info* GetInfo();
diff --git a/ppapi/proxy/ppb_flash_net_connector_proxy.cc b/ppapi/proxy/ppb_flash_net_connector_proxy.cc
index 323059e..44f856e 100644
--- a/ppapi/proxy/ppb_flash_net_connector_proxy.cc
+++ b/ppapi/proxy/ppb_flash_net_connector_proxy.cc
@@ -189,15 +189,16 @@ struct PPB_Flash_NetConnector_Proxy::ConnectCallbackInfo {
namespace {
-InterfaceProxy* CreateFlashNetConnectorProxy(Dispatcher* dispatcher) {
- return new PPB_Flash_NetConnector_Proxy(dispatcher);
+InterfaceProxy* CreateFlashNetConnectorProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_Flash_NetConnector_Proxy(dispatcher, target_interface);
}
} // namespace
PPB_Flash_NetConnector_Proxy::PPB_Flash_NetConnector_Proxy(
- Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
+ Dispatcher* dispatcher, const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface),
callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
}
@@ -249,7 +250,7 @@ bool PPB_Flash_NetConnector_Proxy::OnMessageReceived(const IPC::Message& msg) {
void PPB_Flash_NetConnector_Proxy::OnMsgCreate(PP_Instance instance,
HostResource* result) {
- thunk::EnterResourceCreation enter(instance);
+ EnterFunctionNoLock<ResourceCreationAPI> enter(instance, true);
if (enter.succeeded()) {
result->SetHostResource(
instance,
diff --git a/ppapi/proxy/ppb_flash_net_connector_proxy.h b/ppapi/proxy/ppb_flash_net_connector_proxy.h
index 4ac6c5d..191b350 100644
--- a/ppapi/proxy/ppb_flash_net_connector_proxy.h
+++ b/ppapi/proxy/ppb_flash_net_connector_proxy.h
@@ -22,7 +22,8 @@ namespace proxy {
class PPB_Flash_NetConnector_Proxy : public InterfaceProxy {
public:
- PPB_Flash_NetConnector_Proxy(Dispatcher* dispatcher);
+ PPB_Flash_NetConnector_Proxy(Dispatcher* dispatcher,
+ const void* target_interface);
virtual ~PPB_Flash_NetConnector_Proxy();
static const Info* GetInfo();
diff --git a/ppapi/proxy/ppb_flash_proxy.cc b/ppapi/proxy/ppb_flash_proxy.cc
index 1faae86..c551ace 100644
--- a/ppapi/proxy/ppb_flash_proxy.cc
+++ b/ppapi/proxy/ppb_flash_proxy.cc
@@ -20,7 +20,6 @@
#include "ppapi/proxy/serialized_var.h"
#include "ppapi/shared_impl/resource.h"
#include "ppapi/shared_impl/scoped_pp_resource.h"
-#include "ppapi/shared_impl/var.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppb_url_request_info_api.h"
#include "ppapi/thunk/resource_creation_api.h"
@@ -153,8 +152,12 @@ double GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) {
}
PP_Var GetCommandLineArgs(PP_Module pp_module) {
+ const PPB_Var_Deprecated* var_deprecated =
+ static_cast<const PPB_Var_Deprecated*>(
+ PluginDispatcher::GetInterfaceFromDispatcher(
+ PPB_VAR_DEPRECATED_INTERFACE));
std::string args = ProxyModule::GetInstance()->GetFlashCommandLineArgs();
- return StringVar::StringToPPVar(pp_module, args);
+ return var_deprecated->VarFromUtf8(pp_module, args.data(), args.length());
}
const PPB_Flash flash_interface = {
@@ -168,18 +171,16 @@ const PPB_Flash flash_interface = {
&GetCommandLineArgs
};
-InterfaceProxy* CreateFlashProxy(Dispatcher* dispatcher) {
- return new PPB_Flash_Proxy(dispatcher);
+InterfaceProxy* CreateFlashProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_Flash_Proxy(dispatcher, target_interface);
}
} // namespace
-PPB_Flash_Proxy::PPB_Flash_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
- ppb_flash_impl_(NULL) {
- if (!dispatcher->IsPlugin())
- ppb_flash_impl_ = static_cast<const PPB_Flash*>(
- dispatcher->local_get_interface()(PPB_FLASH_INTERFACE));
+PPB_Flash_Proxy::PPB_Flash_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
}
PPB_Flash_Proxy::~PPB_Flash_Proxy() {
@@ -227,7 +228,7 @@ bool PPB_Flash_Proxy::OnMessageReceived(const IPC::Message& msg) {
void PPB_Flash_Proxy::OnMsgSetInstanceAlwaysOnTop(
PP_Instance instance,
PP_Bool on_top) {
- ppb_flash_impl_->SetInstanceAlwaysOnTop(instance, on_top);
+ ppb_flash_target()->SetInstanceAlwaysOnTop(instance, on_top);
}
void PPB_Flash_Proxy::OnMsgDrawGlyphs(const PPBFlash_DrawGlyphs_Params& params,
@@ -241,7 +242,7 @@ void PPB_Flash_Proxy::OnMsgDrawGlyphs(const PPBFlash_DrawGlyphs_Params& params,
params.glyph_indices.empty())
return;
- *result = ppb_flash_impl_->DrawGlyphs(
+ *result = ppb_flash_target()->DrawGlyphs(
0, // Unused instance param.
params.image_data.host_resource(), &font_desc,
params.color, params.position, params.clip,
@@ -254,7 +255,7 @@ void PPB_Flash_Proxy::OnMsgDrawGlyphs(const PPBFlash_DrawGlyphs_Params& params,
void PPB_Flash_Proxy::OnMsgGetProxyForURL(PP_Instance instance,
const std::string& url,
SerializedVarReturnValue result) {
- result.Return(dispatcher(), ppb_flash_impl_->GetProxyForURL(
+ result.Return(dispatcher(), ppb_flash_target()->GetProxyForURL(
instance, url.c_str()));
}
@@ -291,23 +292,23 @@ void PPB_Flash_Proxy::OnMsgNavigate(PP_Instance instance,
ScopedPPResource::PassRef(),
enter.functions()->CreateURLRequestInfo(instance, data));
- *result = ppb_flash_impl_->Navigate(request_resource,
- target.c_str(),
- from_user_action);
+ *result = ppb_flash_target()->Navigate(request_resource,
+ target.c_str(),
+ from_user_action);
}
void PPB_Flash_Proxy::OnMsgRunMessageLoop(PP_Instance instance) {
- ppb_flash_impl_->RunMessageLoop(instance);
+ ppb_flash_target()->RunMessageLoop(instance);
}
void PPB_Flash_Proxy::OnMsgQuitMessageLoop(PP_Instance instance) {
- ppb_flash_impl_->QuitMessageLoop(instance);
+ ppb_flash_target()->QuitMessageLoop(instance);
}
void PPB_Flash_Proxy::OnMsgGetLocalTimeZoneOffset(PP_Instance instance,
PP_Time t,
double* result) {
- *result = ppb_flash_impl_->GetLocalTimeZoneOffset(instance, t);
+ *result = ppb_flash_target()->GetLocalTimeZoneOffset(instance, t);
}
} // namespace proxy
diff --git a/ppapi/proxy/ppb_flash_proxy.h b/ppapi/proxy/ppb_flash_proxy.h
index 8bb15eb..f893ce2 100644
--- a/ppapi/proxy/ppb_flash_proxy.h
+++ b/ppapi/proxy/ppb_flash_proxy.h
@@ -29,11 +29,15 @@ class SerializedVarReturnValue;
class PPB_Flash_Proxy : public InterfaceProxy {
public:
- PPB_Flash_Proxy(Dispatcher* dispatcher);
+ PPB_Flash_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPB_Flash_Proxy();
static const Info* GetInfo();
+ const PPB_Flash* ppb_flash_target() const {
+ return static_cast<const PPB_Flash*>(target_interface());
+ }
+
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
@@ -55,13 +59,6 @@ class PPB_Flash_Proxy : public InterfaceProxy {
void OnMsgQuitMessageLoop(PP_Instance instance);
void OnMsgGetLocalTimeZoneOffset(PP_Instance instance, PP_Time t,
double* result);
-
- // When this proxy is in the host side, this value caches the interface
- // pointer so we don't have to retrieve it from the dispatcher each time.
- // In the plugin, this value is always NULL.
- const PPB_Flash* ppb_flash_impl_;
-
- DISALLOW_COPY_AND_ASSIGN(PPB_Flash_Proxy);
};
} // namespace proxy
diff --git a/ppapi/proxy/ppb_flash_tcp_socket_proxy.cc b/ppapi/proxy/ppb_flash_tcp_socket_proxy.cc
index 7ff2ce3..12d40b7 100644
--- a/ppapi/proxy/ppb_flash_tcp_socket_proxy.cc
+++ b/ppapi/proxy/ppb_flash_tcp_socket_proxy.cc
@@ -49,8 +49,9 @@ class AbortCallbackTask : public Task {
PP_CompletionCallback callback_;
};
-InterfaceProxy* CreateFlashTCPSocketProxy(Dispatcher* dispatcher) {
- return new PPB_Flash_TCPSocket_Proxy(dispatcher);
+InterfaceProxy* CreateFlashTCPSocketProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_Flash_TCPSocket_Proxy(dispatcher, target_interface);
}
} // namespace
@@ -388,8 +389,10 @@ void FlashTCPSocket::PostAbortAndClearIfNecessary(
}
}
-PPB_Flash_TCPSocket_Proxy::PPB_Flash_TCPSocket_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher) {
+PPB_Flash_TCPSocket_Proxy::PPB_Flash_TCPSocket_Proxy(
+ Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
}
PPB_Flash_TCPSocket_Proxy::~PPB_Flash_TCPSocket_Proxy() {
diff --git a/ppapi/proxy/ppb_flash_tcp_socket_proxy.h b/ppapi/proxy/ppb_flash_tcp_socket_proxy.h
index 925a4ae..831a8cc 100644
--- a/ppapi/proxy/ppb_flash_tcp_socket_proxy.h
+++ b/ppapi/proxy/ppb_flash_tcp_socket_proxy.h
@@ -26,7 +26,8 @@ PPAPI_PROXY_EXPORT extern const int32_t kFlashTCPSocketMaxWriteSize;
class PPB_Flash_TCPSocket_Proxy : public InterfaceProxy {
public:
- PPB_Flash_TCPSocket_Proxy(Dispatcher* dispatcher);
+ PPB_Flash_TCPSocket_Proxy(Dispatcher* dispatcher,
+ const void* target_interface);
virtual ~PPB_Flash_TCPSocket_Proxy();
static const Info* GetInfo();
diff --git a/ppapi/proxy/ppb_font_proxy.cc b/ppapi/proxy/ppb_font_proxy.cc
index b6ef2db..3c42ecd 100644
--- a/ppapi/proxy/ppb_font_proxy.cc
+++ b/ppapi/proxy/ppb_font_proxy.cc
@@ -40,15 +40,33 @@ bool PPTextRunToTextRun(const PP_TextRun_Dev* run,
return true;
}
+InterfaceProxy* CreateFontProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_Font_Proxy(dispatcher, target_interface);
+}
+
} // namespace
-PPB_Font_Proxy::PPB_Font_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher) {
+PPB_Font_Proxy::PPB_Font_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
}
PPB_Font_Proxy::~PPB_Font_Proxy() {
}
+// static
+const InterfaceProxy::Info* PPB_Font_Proxy::GetInfo() {
+ static const Info info = {
+ thunk::GetPPB_Font_Thunk(),
+ PPB_FONT_DEV_INTERFACE,
+ INTERFACE_ID_PPB_FONT,
+ false,
+ &CreateFontProxy,
+ };
+ return &info;
+}
+
PPB_Font_FunctionAPI* PPB_Font_Proxy::AsPPB_Font_FunctionAPI() {
return this;
}
diff --git a/ppapi/proxy/ppb_font_proxy.h b/ppapi/proxy/ppb_font_proxy.h
index d7af485..c9807e2 100644
--- a/ppapi/proxy/ppb_font_proxy.h
+++ b/ppapi/proxy/ppb_font_proxy.h
@@ -21,12 +21,15 @@ namespace proxy {
class SerializedVarReturnValue;
-class PPB_Font_Proxy : public InterfaceProxy,
- public ppapi::thunk::PPB_Font_FunctionAPI {
+class PPB_Font_Proxy : public ppapi::FunctionGroupBase,
+ public ppapi::thunk::PPB_Font_FunctionAPI,
+ public InterfaceProxy {
public:
- PPB_Font_Proxy(Dispatcher* dispatcher);
+ PPB_Font_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPB_Font_Proxy();
+ static const Info* GetInfo();
+
// FunctionGroupBase overrides.
virtual ppapi::thunk::PPB_Font_FunctionAPI* AsPPB_Font_FunctionAPI() OVERRIDE;
@@ -36,8 +39,6 @@ class PPB_Font_Proxy : public InterfaceProxy,
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
- static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_FONT;
-
private:
DISALLOW_COPY_AND_ASSIGN(PPB_Font_Proxy);
};
diff --git a/ppapi/proxy/ppb_graphics_2d_proxy.cc b/ppapi/proxy/ppb_graphics_2d_proxy.cc
index 232e1fe..a855cfd 100644
--- a/ppapi/proxy/ppb_graphics_2d_proxy.cc
+++ b/ppapi/proxy/ppb_graphics_2d_proxy.cc
@@ -24,6 +24,15 @@ using ppapi::thunk::PPB_Graphics2D_API;
namespace ppapi {
namespace proxy {
+namespace {
+
+InterfaceProxy* CreateGraphics2DProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_Graphics2D_Proxy(dispatcher, target_interface);
+}
+
+} // namespace
+
class Graphics2D : public Resource, public thunk::PPB_Graphics2D_API {
public:
Graphics2D(const HostResource& host_resource,
@@ -139,8 +148,9 @@ void Graphics2D::FlushACK(int32_t result_code) {
PP_RunAndClearCompletionCallback(&current_flush_callback_, result_code);
}
-PPB_Graphics2D_Proxy::PPB_Graphics2D_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
+PPB_Graphics2D_Proxy::PPB_Graphics2D_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface),
callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
}
@@ -148,6 +158,18 @@ PPB_Graphics2D_Proxy::~PPB_Graphics2D_Proxy() {
}
// static
+const InterfaceProxy::Info* PPB_Graphics2D_Proxy::GetInfo() {
+ static const Info info = {
+ thunk::GetPPB_Graphics2D_Thunk(),
+ PPB_GRAPHICS_2D_INTERFACE,
+ INTERFACE_ID_PPB_GRAPHICS_2D,
+ false,
+ &CreateGraphics2DProxy,
+ };
+ return &info;
+}
+
+// static
PP_Resource PPB_Graphics2D_Proxy::CreateProxyResource(
PP_Instance instance,
const PP_Size& size,
diff --git a/ppapi/proxy/ppb_graphics_2d_proxy.h b/ppapi/proxy/ppb_graphics_2d_proxy.h
index 59b4b1b..cd4c55f 100644
--- a/ppapi/proxy/ppb_graphics_2d_proxy.h
+++ b/ppapi/proxy/ppb_graphics_2d_proxy.h
@@ -26,18 +26,22 @@ namespace proxy {
class PPB_Graphics2D_Proxy : public InterfaceProxy {
public:
- PPB_Graphics2D_Proxy(Dispatcher* dispatcher);
+ PPB_Graphics2D_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPB_Graphics2D_Proxy();
+ static const Info* GetInfo();
+
static PP_Resource CreateProxyResource(PP_Instance instance,
const PP_Size& size,
PP_Bool is_always_opaque);
+ const PPB_Graphics2D* ppb_graphics_2d_target() const {
+ return static_cast<const PPB_Graphics2D*>(target_interface());
+ }
+
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
- static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_GRAPHICS_2D;
-
private:
// Plugin->renderer message handlers.
void OnMsgPaintImageData(const ppapi::HostResource& graphics_2d,
@@ -63,8 +67,6 @@ class PPB_Graphics2D_Proxy : public InterfaceProxy {
pp::CompletionCallbackFactory<PPB_Graphics2D_Proxy,
ProxyNonThreadSafeRefCount> callback_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(PPB_Graphics2D_Proxy);
};
} // namespace proxy
diff --git a/ppapi/proxy/ppb_graphics_3d_proxy.cc b/ppapi/proxy/ppb_graphics_3d_proxy.cc
index e184ef0..31d9ccb 100644
--- a/ppapi/proxy/ppb_graphics_3d_proxy.cc
+++ b/ppapi/proxy/ppb_graphics_3d_proxy.cc
@@ -316,6 +316,10 @@ gpu::CommandBuffer::State GPUStateFromPPState(
return state;
}
+InterfaceProxy* CreateGraphics3DProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_Graphics3D_Proxy(dispatcher, target_interface);
+}
} // namespace
Graphics3D::Graphics3D(const HostResource& resource)
@@ -391,8 +395,9 @@ int32 Graphics3D::DoSwapBuffers() {
return PP_OK_COMPLETIONPENDING;
}
-PPB_Graphics3D_Proxy::PPB_Graphics3D_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
+PPB_Graphics3D_Proxy::PPB_Graphics3D_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface),
callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
}
@@ -400,6 +405,18 @@ PPB_Graphics3D_Proxy::~PPB_Graphics3D_Proxy() {
}
// static
+const InterfaceProxy::Info* PPB_Graphics3D_Proxy::GetInfo() {
+ static const Info info = {
+ thunk::GetPPB_Graphics3D_Thunk(),
+ PPB_GRAPHICS_3D_INTERFACE,
+ INTERFACE_ID_PPB_GRAPHICS_3D,
+ false,
+ &CreateGraphics3DProxy,
+ };
+ return &info;
+}
+
+// static
PP_Resource PPB_Graphics3D_Proxy::CreateProxyResource(
PP_Instance instance,
PP_Resource share_context,
@@ -473,7 +490,7 @@ void PPB_Graphics3D_Proxy::OnMsgCreate(PP_Instance instance,
if (attribs.empty() || attribs.back() != PP_GRAPHICS3DATTRIB_NONE)
return; // Bad message.
- thunk::EnterResourceCreation enter(instance);
+ EnterFunctionNoLock<ResourceCreationAPI> enter(instance, true);
if (enter.succeeded()) {
result->SetHostResource(
instance,
diff --git a/ppapi/proxy/ppb_graphics_3d_proxy.h b/ppapi/proxy/ppb_graphics_3d_proxy.h
index ef2b70b..4fd97a2 100644
--- a/ppapi/proxy/ppb_graphics_3d_proxy.h
+++ b/ppapi/proxy/ppb_graphics_3d_proxy.h
@@ -63,18 +63,22 @@ class Graphics3D : public Resource, public Graphics3DImpl {
class PPB_Graphics3D_Proxy : public InterfaceProxy {
public:
- PPB_Graphics3D_Proxy(Dispatcher* dispatcher);
+ PPB_Graphics3D_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPB_Graphics3D_Proxy();
+ static const Info* GetInfo();
+
static PP_Resource CreateProxyResource(PP_Instance instance,
PP_Resource share_context,
const int32_t* attrib_list);
+ const PPB_Graphics3D* ppb_graphics_3d_target() const {
+ return static_cast<const PPB_Graphics3D*>(target_interface());
+ }
+
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
- static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_GRAPHICS_3D;
-
private:
void OnMsgCreate(PP_Instance instance,
const std::vector<int32_t>& attribs,
diff --git a/ppapi/proxy/ppb_image_data_proxy.cc b/ppapi/proxy/ppb_image_data_proxy.cc
index 32c24a9..0f96b99 100644
--- a/ppapi/proxy/ppb_image_data_proxy.cc
+++ b/ppapi/proxy/ppb_image_data_proxy.cc
@@ -25,6 +25,43 @@
namespace ppapi {
namespace proxy {
+namespace {
+
+InterfaceProxy* CreateImageDataProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_ImageData_Proxy(dispatcher, target_interface);
+}
+
+} // namespace
+
+// PPB_ImageData_Proxy ---------------------------------------------------------
+
+PPB_ImageData_Proxy::PPB_ImageData_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
+}
+
+PPB_ImageData_Proxy::~PPB_ImageData_Proxy() {
+}
+
+// static
+const InterfaceProxy::Info* PPB_ImageData_Proxy::GetInfo() {
+ static const Info info = {
+ thunk::GetPPB_ImageData_Thunk(),
+ PPB_IMAGEDATA_INTERFACE,
+ INTERFACE_ID_PPB_IMAGE_DATA,
+ false,
+ &CreateImageDataProxy,
+ };
+ return &info;
+}
+
+bool PPB_ImageData_Proxy::OnMessageReceived(const IPC::Message& msg) {
+ return false;
+}
+
+// ImageData -------------------------------------------------------------------
+
ImageData::ImageData(const HostResource& resource,
const PP_ImageDataDesc& desc,
ImageHandle handle)
diff --git a/ppapi/proxy/ppb_image_data_proxy.h b/ppapi/proxy/ppb_image_data_proxy.h
index 6cf4910..1b96917 100644
--- a/ppapi/proxy/ppb_image_data_proxy.h
+++ b/ppapi/proxy/ppb_image_data_proxy.h
@@ -32,6 +32,21 @@ class HostResource;
namespace proxy {
+class PPB_ImageData_Proxy : public InterfaceProxy {
+ public:
+ PPB_ImageData_Proxy(Dispatcher* dispatcher, const void* target_interface);
+ virtual ~PPB_ImageData_Proxy();
+
+ static const Info* GetInfo();
+
+ const PPB_ImageData* ppb_image_data_target() const {
+ return static_cast<const PPB_ImageData*>(target_interface());
+ }
+
+ // InterfaceProxy implementation.
+ virtual bool OnMessageReceived(const IPC::Message& msg);
+};
+
class ImageData : public ppapi::Resource,
public ppapi::thunk::PPB_ImageData_API,
public ppapi::ImageDataImpl {
diff --git a/ppapi/proxy/ppb_input_event_proxy.cc b/ppapi/proxy/ppb_input_event_proxy.cc
new file mode 100644
index 0000000..655b10d
--- /dev/null
+++ b/ppapi/proxy/ppb_input_event_proxy.cc
@@ -0,0 +1,105 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/proxy/ppb_input_event_proxy.h"
+
+#include "ppapi/c/ppb_audio_config.h"
+#include "ppapi/proxy/plugin_dispatcher.h"
+#include "ppapi/proxy/plugin_var_tracker.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/shared_impl/input_event_impl.h"
+#include "ppapi/shared_impl/resource.h"
+#include "ppapi/shared_impl/var.h"
+#include "ppapi/thunk/thunk.h"
+
+using ppapi::thunk::PPB_InputEvent_API;
+
+namespace ppapi {
+namespace proxy {
+
+namespace {
+
+InterfaceProxy* CreateInputEventProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_InputEvent_Proxy(dispatcher, target_interface);
+}
+
+} // namespace
+
+PPB_InputEvent_Proxy::PPB_InputEvent_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
+}
+
+PPB_InputEvent_Proxy::~PPB_InputEvent_Proxy() {
+}
+
+// static
+const InterfaceProxy::Info* PPB_InputEvent_Proxy::GetInputEventInfo() {
+ static const Info info = {
+ thunk::GetPPB_InputEvent_Thunk(),
+ PPB_INPUT_EVENT_INTERFACE,
+ INTERFACE_ID_NONE,
+ false,
+ &CreateInputEventProxy,
+ };
+ return &info;
+}
+
+// static
+const InterfaceProxy::Info* PPB_InputEvent_Proxy::GetKeyboardInputEventInfo() {
+ static const Info info = {
+ thunk::GetPPB_KeyboardInputEvent_Thunk(),
+ PPB_KEYBOARD_INPUT_EVENT_INTERFACE,
+ INTERFACE_ID_NONE,
+ false,
+ &CreateInputEventProxy,
+ };
+ return &info;
+}
+
+// static
+const InterfaceProxy::Info* PPB_InputEvent_Proxy::GetMouseInputEventInfo1_0() {
+ static const Info info = {
+ thunk::GetPPB_MouseInputEvent_1_0_Thunk(),
+ PPB_MOUSE_INPUT_EVENT_INTERFACE_1_0,
+ INTERFACE_ID_NONE,
+ false,
+ &CreateInputEventProxy,
+ };
+ return &info;
+}
+
+// static
+const InterfaceProxy::Info* PPB_InputEvent_Proxy::GetMouseInputEventInfo1_1() {
+ static const Info info = {
+ thunk::GetPPB_MouseInputEvent_1_1_Thunk(),
+ PPB_MOUSE_INPUT_EVENT_INTERFACE_1_1,
+ INTERFACE_ID_NONE,
+ false,
+ &CreateInputEventProxy,
+ };
+ return &info;
+}
+
+// static
+const InterfaceProxy::Info* PPB_InputEvent_Proxy::GetWheelInputEventInfo() {
+ static const Info info = {
+ thunk::GetPPB_WheelInputEvent_Thunk(),
+ PPB_WHEEL_INPUT_EVENT_INTERFACE,
+ INTERFACE_ID_NONE,
+ false,
+ &CreateInputEventProxy,
+ };
+ return &info;
+}
+
+bool PPB_InputEvent_Proxy::OnMessageReceived(const IPC::Message& msg) {
+ // There are no IPC messages for this interface.
+ NOTREACHED();
+ return false;
+}
+
+} // namespace proxy
+} // namespace ppapi
diff --git a/ppapi/proxy/ppb_input_event_proxy.h b/ppapi/proxy/ppb_input_event_proxy.h
new file mode 100644
index 0000000..5e60acb
--- /dev/null
+++ b/ppapi/proxy/ppb_input_event_proxy.h
@@ -0,0 +1,40 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_PROXY_PPB_INPUT_EVENT_PROXY_H_
+#define PPAPI_PROXY_PPB_INPUT_EVENT_PROXY_H_
+
+#include "base/basictypes.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/proxy/interface_proxy.h"
+#include "ppapi/shared_impl/input_event_impl.h"
+
+namespace ppapi {
+
+struct InputEventData;
+
+namespace proxy {
+
+class PPB_InputEvent_Proxy : public InterfaceProxy {
+ public:
+ PPB_InputEvent_Proxy(Dispatcher* dispatcher, const void* target_interface);
+ virtual ~PPB_InputEvent_Proxy();
+
+ static const Info* GetInputEventInfo();
+ static const Info* GetKeyboardInputEventInfo();
+ static const Info* GetMouseInputEventInfo1_0();
+ static const Info* GetMouseInputEventInfo1_1();
+ static const Info* GetWheelInputEventInfo();
+
+ // InterfaceProxy implementation.
+ virtual bool OnMessageReceived(const IPC::Message& msg);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PPB_InputEvent_Proxy);
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PROXY_PPB_INPUT_EVENT_PROXY_H_
diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc
index 5dcf713..10464c6 100644
--- a/ppapi/proxy/ppb_instance_proxy.cc
+++ b/ppapi/proxy/ppb_instance_proxy.cc
@@ -32,22 +32,70 @@ namespace proxy {
namespace {
-typedef EnterFunctionNoLock<PPB_Instance_FunctionAPI> EnterInstanceNoLock;
-
-InterfaceProxy* CreateInstanceProxy(Dispatcher* dispatcher) {
- return new PPB_Instance_Proxy(dispatcher);
+InterfaceProxy* CreateInstanceProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_Instance_Proxy(dispatcher, target_interface);
}
} // namespace
-PPB_Instance_Proxy::PPB_Instance_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher) {
+PPB_Instance_Proxy::PPB_Instance_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
}
PPB_Instance_Proxy::~PPB_Instance_Proxy() {
}
// static
+const InterfaceProxy::Info* PPB_Instance_Proxy::GetInfo0_5() {
+ static const Info info = {
+ ppapi::thunk::GetPPB_Instance_1_0_Thunk(),
+ PPB_INSTANCE_INTERFACE_0_5,
+ INTERFACE_ID_NONE, // 1_0 is the canonical one.
+ false,
+ &CreateInstanceProxy,
+ };
+ return &info;
+}
+
+// static
+const InterfaceProxy::Info* PPB_Instance_Proxy::GetInfo1_0() {
+ static const Info info = {
+ ppapi::thunk::GetPPB_Instance_1_0_Thunk(),
+ PPB_INSTANCE_INTERFACE_1_0,
+ INTERFACE_ID_PPB_INSTANCE,
+ false,
+ &CreateInstanceProxy,
+ };
+ return &info;
+}
+
+// static
+const InterfaceProxy::Info* PPB_Instance_Proxy::GetInfoMessaging() {
+ static const Info info = {
+ ppapi::thunk::GetPPB_Messaging_Thunk(),
+ PPB_MESSAGING_INTERFACE,
+ INTERFACE_ID_NONE, // 1_0 is the canonical one.
+ false,
+ &CreateInstanceProxy,
+ };
+ return &info;
+}
+
+// static
+const InterfaceProxy::Info* PPB_Instance_Proxy::GetInfoMouseLock() {
+ static const Info info = {
+ ppapi::thunk::GetPPB_MouseLock_Thunk(),
+ PPB_MOUSELOCK_DEV_INTERFACE,
+ INTERFACE_ID_NONE, // 1_0 is the canonical one.
+ false,
+ &CreateInstanceProxy,
+ };
+ return &info;
+}
+
+// static
const InterfaceProxy::Info* PPB_Instance_Proxy::GetInfoPrivate() {
static const Info info = {
ppapi::thunk::GetPPB_Instance_Private_Thunk(),
@@ -90,10 +138,6 @@ bool PPB_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) {
OnMsgIsFullFrame)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ExecuteScript,
OnMsgExecuteScript)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_Log,
- OnMsgLog)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_LogWithSource,
- OnMsgLogWithSource)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PostMessage,
OnMsgPostMessage)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetFullscreen,
@@ -165,24 +209,6 @@ PP_Var PPB_Instance_Proxy::ExecuteScript(PP_Instance instance,
return result.Return(dispatcher());
}
-void PPB_Instance_Proxy::Log(PP_Instance instance,
- int log_level,
- PP_Var value) {
- dispatcher()->Send(new PpapiHostMsg_PPBInstance_Log(
- INTERFACE_ID_PPB_INSTANCE, instance, static_cast<int>(log_level),
- SerializedVarSendInput(dispatcher(), value)));
-}
-
-void PPB_Instance_Proxy::LogWithSource(PP_Instance instance,
- int log_level,
- PP_Var source,
- PP_Var value) {
- dispatcher()->Send(new PpapiHostMsg_PPBInstance_LogWithSource(
- INTERFACE_ID_PPB_INSTANCE, instance, static_cast<int>(log_level),
- SerializedVarSendInput(dispatcher(), source),
- SerializedVarSendInput(dispatcher(), value)));
-}
-
PP_Bool PPB_Instance_Proxy::IsFullscreen(PP_Instance instance) {
InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
GetInstanceData(instance);
@@ -279,7 +305,7 @@ void PPB_Instance_Proxy::UnlockMouse(PP_Instance instance) {
void PPB_Instance_Proxy::OnMsgGetWindowObject(
PP_Instance instance,
SerializedVarReturnValue result) {
- EnterInstanceNoLock enter(instance, false);
+ EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false);
if (enter.succeeded())
result.Return(dispatcher(), enter.functions()->GetWindowObject(instance));
}
@@ -287,7 +313,7 @@ void PPB_Instance_Proxy::OnMsgGetWindowObject(
void PPB_Instance_Proxy::OnMsgGetOwnerElementObject(
PP_Instance instance,
SerializedVarReturnValue result) {
- EnterInstanceNoLock enter(instance, false);
+ EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false);
if (enter.succeeded()) {
result.Return(dispatcher(),
enter.functions()->GetOwnerElementObject(instance));
@@ -297,7 +323,7 @@ void PPB_Instance_Proxy::OnMsgGetOwnerElementObject(
void PPB_Instance_Proxy::OnMsgBindGraphics(PP_Instance instance,
const HostResource& device,
PP_Bool* result) {
- EnterInstanceNoLock enter(instance, false);
+ EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false);
if (enter.succeeded()) {
*result = enter.functions()->BindGraphics(instance,
device.host_resource());
@@ -306,7 +332,7 @@ void PPB_Instance_Proxy::OnMsgBindGraphics(PP_Instance instance,
void PPB_Instance_Proxy::OnMsgIsFullFrame(PP_Instance instance,
PP_Bool* result) {
- EnterInstanceNoLock enter(instance, false);
+ EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false);
if (enter.succeeded())
*result = enter.functions()->IsFullFrame(instance);
}
@@ -316,7 +342,7 @@ void PPB_Instance_Proxy::OnMsgExecuteScript(
SerializedVarReceiveInput script,
SerializedVarOutParam out_exception,
SerializedVarReturnValue result) {
- EnterInstanceNoLock enter(instance, false);
+ EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false);
if (enter.failed())
return;
@@ -331,30 +357,10 @@ void PPB_Instance_Proxy::OnMsgExecuteScript(
out_exception.OutParam(dispatcher())));
}
-void PPB_Instance_Proxy::OnMsgLog(PP_Instance instance,
- int log_level,
- SerializedVarReceiveInput value) {
- EnterInstanceNoLock enter(instance, false);
- if (enter.succeeded())
- enter.functions()->Log(instance, log_level, value.Get(dispatcher()));
-}
-
-void PPB_Instance_Proxy::OnMsgLogWithSource(PP_Instance instance,
- int log_level,
- SerializedVarReceiveInput source,
- SerializedVarReceiveInput value) {
- EnterInstanceNoLock enter(instance, false);
- if (enter.succeeded()) {
- enter.functions()->LogWithSource(instance, log_level,
- source.Get(dispatcher()),
- value.Get(dispatcher()));
- }
-}
-
void PPB_Instance_Proxy::OnMsgSetFullscreen(PP_Instance instance,
PP_Bool fullscreen,
PP_Bool* result) {
- EnterInstanceNoLock enter(instance, false);
+ EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false);
if (enter.succeeded())
*result = enter.functions()->SetFullscreen(instance, fullscreen);
}
@@ -362,7 +368,7 @@ void PPB_Instance_Proxy::OnMsgSetFullscreen(PP_Instance instance,
void PPB_Instance_Proxy::OnMsgGetScreenSize(PP_Instance instance,
PP_Bool* result,
PP_Size* size) {
- EnterInstanceNoLock enter(instance, false);
+ EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false);
if (enter.succeeded())
*result = enter.functions()->GetScreenSize(instance, size);
}
@@ -370,7 +376,7 @@ void PPB_Instance_Proxy::OnMsgGetScreenSize(PP_Instance instance,
void PPB_Instance_Proxy::OnMsgRequestInputEvents(PP_Instance instance,
bool is_filtering,
uint32_t event_classes) {
- EnterInstanceNoLock enter(instance, false);
+ EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false);
if (enter.succeeded()) {
if (is_filtering)
enter.functions()->RequestFilteringInputEvents(instance, event_classes);
@@ -381,14 +387,14 @@ void PPB_Instance_Proxy::OnMsgRequestInputEvents(PP_Instance instance,
void PPB_Instance_Proxy::OnMsgClearInputEvents(PP_Instance instance,
uint32_t event_classes) {
- EnterInstanceNoLock enter(instance, false);
+ EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false);
if (enter.succeeded())
enter.functions()->ClearInputEventRequest(instance, event_classes);
}
void PPB_Instance_Proxy::OnMsgPostMessage(PP_Instance instance,
SerializedVarReceiveInput message) {
- EnterInstanceNoLock enter(instance, false);
+ EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false);
if (enter.succeeded())
enter.functions()->PostMessage(instance, message.Get(dispatcher()));
}
diff --git a/ppapi/proxy/ppb_instance_proxy.h b/ppapi/proxy/ppb_instance_proxy.h
index 4199912..d0ec32b 100644
--- a/ppapi/proxy/ppb_instance_proxy.h
+++ b/ppapi/proxy/ppb_instance_proxy.h
@@ -23,11 +23,16 @@ class SerializedVarReturnValue;
class PPB_Instance_Proxy : public InterfaceProxy,
public ppapi::InstanceImpl,
+ public ppapi::FunctionGroupBase,
public ppapi::thunk::PPB_Instance_FunctionAPI {
public:
- PPB_Instance_Proxy(Dispatcher* dispatcher);
+ PPB_Instance_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPB_Instance_Proxy();
+ static const Info* GetInfo0_5();
+ static const Info* GetInfo1_0();
+ static const Info* GetInfoMessaging();
+ static const Info* GetInfoMouseLock();
static const Info* GetInfoPrivate();
static const Info* GetInfoFullscreen();
@@ -46,13 +51,6 @@ class PPB_Instance_Proxy : public InterfaceProxy,
virtual PP_Var ExecuteScript(PP_Instance instance,
PP_Var script,
PP_Var* exception) OVERRIDE;
- virtual void Log(PP_Instance instance,
- int log_level,
- PP_Var value) OVERRIDE;
- virtual void LogWithSource(PP_Instance instance,
- int log_level,
- PP_Var source,
- PP_Var value) OVERRIDE;
virtual PP_Bool IsFullscreen(PP_Instance instance) OVERRIDE;
virtual PP_Bool SetFullscreen(PP_Instance instance,
PP_Bool fullscreen) OVERRIDE;
@@ -73,8 +71,6 @@ class PPB_Instance_Proxy : public InterfaceProxy,
PP_CompletionCallback callback) OVERRIDE;
virtual void UnlockMouse(PP_Instance instance) OVERRIDE;
- static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_INSTANCE;
-
private:
// Message handlers.
void OnMsgGetWindowObject(PP_Instance instance,
@@ -89,13 +85,6 @@ class PPB_Instance_Proxy : public InterfaceProxy,
SerializedVarReceiveInput script,
SerializedVarOutParam out_exception,
SerializedVarReturnValue result);
- void OnMsgLog(PP_Instance instance,
- int log_level,
- SerializedVarReceiveInput value);
- void OnMsgLogWithSource(PP_Instance instance,
- int log_level,
- SerializedVarReceiveInput source,
- SerializedVarReceiveInput value);
void OnMsgSetFullscreen(PP_Instance instance,
PP_Bool fullscreen,
PP_Bool* result);
diff --git a/ppapi/proxy/ppb_memory_proxy.cc b/ppapi/proxy/ppb_memory_proxy.cc
index 88da6b2..ec3fc03 100644
--- a/ppapi/proxy/ppb_memory_proxy.cc
+++ b/ppapi/proxy/ppb_memory_proxy.cc
@@ -27,10 +27,37 @@ const PPB_Memory_Dev memory_dev_interface = {
&MemFree
};
+InterfaceProxy* CreateMemoryProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_Memory_Proxy(dispatcher, target_interface);
+}
+
} // namespace
-const PPB_Memory_Dev* GetPPB_Memory_Interface() {
- return &memory_dev_interface;
+PPB_Memory_Proxy::PPB_Memory_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
+}
+
+PPB_Memory_Proxy::~PPB_Memory_Proxy() {
+}
+
+// static
+const InterfaceProxy::Info* PPB_Memory_Proxy::GetInfo() {
+ static const Info info = {
+ &memory_dev_interface,
+ PPB_MEMORY_DEV_INTERFACE,
+ INTERFACE_ID_PPB_MEMORY,
+ false,
+ &CreateMemoryProxy,
+ };
+ return &info;
+}
+
+bool PPB_Memory_Proxy::OnMessageReceived(const IPC::Message& msg) {
+ // All PPB_Memory_Dev calls are handled locally; there is no need to send or
+ // receive messages here.
+ return false;
}
} // namespace proxy
diff --git a/ppapi/proxy/ppb_memory_proxy.h b/ppapi/proxy/ppb_memory_proxy.h
index fd7d5d2..6666ede 100644
--- a/ppapi/proxy/ppb_memory_proxy.h
+++ b/ppapi/proxy/ppb_memory_proxy.h
@@ -12,7 +12,23 @@ struct PPB_Memory_Dev;
namespace ppapi {
namespace proxy {
-const PPB_Memory_Dev* GetPPB_Memory_Interface();
+class PPB_Memory_Proxy : public InterfaceProxy {
+ public:
+ PPB_Memory_Proxy(Dispatcher* dispatcher,
+ const void* target_interface);
+ virtual ~PPB_Memory_Proxy();
+
+ static const Info* GetInfo();
+
+ const PPB_Memory_Dev* ppb_memory_target() const {
+ return static_cast<const PPB_Memory_Dev*>(target_interface());
+ }
+
+ // InterfaceProxy implementation. In this case, no messages are sent or
+ // received, so this always returns false.
+ virtual bool OnMessageReceived(const IPC::Message& msg);
+
+};
} // namespace proxy
} // namespace ppapi
diff --git a/ppapi/proxy/ppb_opengles2_proxy.cc b/ppapi/proxy/ppb_opengles2_proxy.cc
new file mode 100644
index 0000000..9516678
--- /dev/null
+++ b/ppapi/proxy/ppb_opengles2_proxy.cc
@@ -0,0 +1,44 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/proxy/ppb_opengles2_proxy.h"
+
+#include "ppapi/shared_impl/opengles2_impl.h"
+
+namespace ppapi {
+namespace proxy {
+
+namespace {
+InterfaceProxy* CreateOpenGLES2Proxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_OpenGLES2_Proxy(dispatcher, target_interface);
+}
+} // namespace
+
+PPB_OpenGLES2_Proxy::PPB_OpenGLES2_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
+}
+
+PPB_OpenGLES2_Proxy::~PPB_OpenGLES2_Proxy() {
+}
+
+// static
+const InterfaceProxy::Info* PPB_OpenGLES2_Proxy::GetInfo() {
+ static const Info info = {
+ ppapi::OpenGLES2Impl::GetInterface(),
+ PPB_OPENGLES2_INTERFACE,
+ INTERFACE_ID_PPB_OPENGLES2,
+ false,
+ &CreateOpenGLES2Proxy,
+ };
+ return &info;
+}
+
+bool PPB_OpenGLES2_Proxy::OnMessageReceived(const IPC::Message& msg) {
+ return false;
+}
+
+} // namespace proxy
+} // namespace ppapi
diff --git a/ppapi/proxy/ppb_opengles2_proxy.h b/ppapi/proxy/ppb_opengles2_proxy.h
new file mode 100644
index 0000000..c424ae8
--- /dev/null
+++ b/ppapi/proxy/ppb_opengles2_proxy.h
@@ -0,0 +1,33 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_PPB_OPENGLES2_PROXY_H_
+#define PPAPI_PPB_OPENGLES2_PROXY_H_
+
+#include "ppapi/proxy/interface_proxy.h"
+
+struct PPB_OpenGLES2_Dev;
+
+namespace ppapi {
+namespace proxy {
+
+class PPB_OpenGLES2_Proxy : public InterfaceProxy {
+ public:
+ PPB_OpenGLES2_Proxy(Dispatcher* dispatcher, const void* target_interface);
+ virtual ~PPB_OpenGLES2_Proxy();
+
+ static const Info* GetInfo();
+
+ const PPB_OpenGLES2_Dev* ppb_opengles2_target() const {
+ return reinterpret_cast<const PPB_OpenGLES2_Dev*>(target_interface());
+ }
+
+ // InterfaceProxy implementation.
+ virtual bool OnMessageReceived(const IPC::Message& msg);
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PPB_OPENGLES2_PROXY_H_
diff --git a/ppapi/proxy/ppb_pdf_proxy.cc b/ppapi/proxy/ppb_pdf_proxy.cc
index 874e487..dcf3358 100644
--- a/ppapi/proxy/ppb_pdf_proxy.cc
+++ b/ppapi/proxy/ppb_pdf_proxy.cc
@@ -118,19 +118,16 @@ const PPB_PDF pdf_interface = {
&GetFontTableForPrivateFontFile,
};
-InterfaceProxy* CreatePDFProxy(Dispatcher* dispatcher) {
- return new PPB_PDF_Proxy(dispatcher);
+InterfaceProxy* CreatePDFProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_PDF_Proxy(dispatcher, target_interface);
}
} // namespace
-PPB_PDF_Proxy::PPB_PDF_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
- ppb_pdf_impl_(NULL) {
- if (!dispatcher->IsPlugin()) {
- ppb_pdf_impl_ = static_cast<const PPB_PDF*>(
- dispatcher->local_get_interface()(PPB_PDF_INTERFACE));
- }
+PPB_PDF_Proxy::PPB_PDF_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
}
PPB_PDF_Proxy::~PPB_PDF_Proxy() {
@@ -169,7 +166,7 @@ void PPB_PDF_Proxy::OnMsgGetFontFileWithFallback(
PP_FontDescription_Dev desc;
in_desc.SetToPPFontDescription(dispatcher(), &desc, false);
result->SetHostResource(instance,
- ppb_pdf_impl_->GetFontFileWithFallback(
+ ppb_pdf_target()->GetFontFileWithFallback(
instance, &desc, static_cast<PP_PrivateFontCharset>(charset)));
}
@@ -180,12 +177,12 @@ void PPB_PDF_Proxy::OnMsgGetFontTableForPrivateFontFile(
// TODO(brettw): It would be nice not to copy here. At least on Linux,
// we can map the font file into shared memory and read it that way.
uint32_t table_length = 0;
- if (!ppb_pdf_impl_->GetFontTableForPrivateFontFile(
+ if (!ppb_pdf_target()->GetFontTableForPrivateFontFile(
font_file.host_resource(), table, NULL, &table_length))
return;
result->resize(table_length);
- ppb_pdf_impl_->GetFontTableForPrivateFontFile(font_file.host_resource(),
+ ppb_pdf_target()->GetFontTableForPrivateFontFile(font_file.host_resource(),
table, const_cast<char*>(result->c_str()), &table_length);
}
diff --git a/ppapi/proxy/ppb_pdf_proxy.h b/ppapi/proxy/ppb_pdf_proxy.h
index 7ad012d..27ab6c4 100644
--- a/ppapi/proxy/ppb_pdf_proxy.h
+++ b/ppapi/proxy/ppb_pdf_proxy.h
@@ -18,11 +18,15 @@ struct SerializedFontDescription;
class PPB_PDF_Proxy : public InterfaceProxy {
public:
- PPB_PDF_Proxy(Dispatcher* dispatcher);
+ PPB_PDF_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPB_PDF_Proxy();
static const Info* GetInfo();
+ const PPB_PDF* ppb_pdf_target() const {
+ return static_cast<const PPB_PDF*>(target_interface());
+ }
+
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
@@ -35,11 +39,6 @@ class PPB_PDF_Proxy : public InterfaceProxy {
void OnMsgGetFontTableForPrivateFontFile(const ppapi::HostResource& font_file,
uint32_t table,
std::string* result);
-
- // When this proxy is in the host side, this value caches the interface
- // pointer so we don't have to retrieve it from the dispatcher each time.
- // In the plugin, this value is always NULL.
- const PPB_PDF* ppb_pdf_impl_;
};
} // namespace proxy
diff --git a/ppapi/proxy/ppb_surface_3d_proxy.cc b/ppapi/proxy/ppb_surface_3d_proxy.cc
index 70809da..23348fc 100644
--- a/ppapi/proxy/ppb_surface_3d_proxy.cc
+++ b/ppapi/proxy/ppb_surface_3d_proxy.cc
@@ -25,8 +25,9 @@ namespace proxy {
namespace {
-InterfaceProxy* CreateSurface3DProxy(Dispatcher* dispatcher) {
- return new PPB_Surface3D_Proxy(dispatcher);
+InterfaceProxy* CreateSurface3DProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_Surface3D_Proxy(dispatcher, target_interface);
}
} // namespace
@@ -87,8 +88,9 @@ void Surface3D::SwapBuffersACK(int32_t pp_error) {
// PPB_Surface3D_Proxy ---------------------------------------------------------
-PPB_Surface3D_Proxy::PPB_Surface3D_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
+PPB_Surface3D_Proxy::PPB_Surface3D_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface),
callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
}
@@ -98,7 +100,7 @@ PPB_Surface3D_Proxy::~PPB_Surface3D_Proxy() {
// static
const InterfaceProxy::Info* PPB_Surface3D_Proxy::GetInfo() {
static const Info info = {
- thunk::GetPPB_Surface3D_Dev_Thunk(),
+ thunk::GetPPB_Surface3D_Thunk(),
PPB_SURFACE_3D_DEV_INTERFACE,
INTERFACE_ID_PPB_SURFACE_3D,
false,
@@ -160,7 +162,7 @@ void PPB_Surface3D_Proxy::OnMsgCreate(PP_Instance instance,
attribs.back() != PP_GRAPHICS3DATTRIB_NONE)
return; // Bad message.
- thunk::EnterResourceCreation enter(instance);
+ EnterFunctionNoLock<ResourceCreationAPI> enter(instance, true);
if (enter.succeeded()) {
result->SetHostResource(
instance,
diff --git a/ppapi/proxy/ppb_surface_3d_proxy.h b/ppapi/proxy/ppb_surface_3d_proxy.h
index be8ce34..ce7e8b6 100644
--- a/ppapi/proxy/ppb_surface_3d_proxy.h
+++ b/ppapi/proxy/ppb_surface_3d_proxy.h
@@ -63,7 +63,7 @@ class Surface3D : public ppapi::Resource,
class PPB_Surface3D_Proxy : public InterfaceProxy {
public:
- PPB_Surface3D_Proxy(Dispatcher* dispatcher);
+ PPB_Surface3D_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPB_Surface3D_Proxy();
static const Info* GetInfo();
@@ -75,8 +75,6 @@ class PPB_Surface3D_Proxy : public InterfaceProxy {
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
- static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_SURFACE_3D;
-
private:
// Message handlers.
void OnMsgCreate(PP_Instance instance,
diff --git a/ppapi/proxy/ppb_testing_proxy.cc b/ppapi/proxy/ppb_testing_proxy.cc
index 836e1cf..564f68f 100644
--- a/ppapi/proxy/ppb_testing_proxy.cc
+++ b/ppapi/proxy/ppb_testing_proxy.cc
@@ -75,19 +75,16 @@ const PPB_Testing_Dev testing_interface = {
&IsOutOfProcess
};
-InterfaceProxy* CreateTestingProxy(Dispatcher* dispatcher) {
- return new PPB_Testing_Proxy(dispatcher);
+InterfaceProxy* CreateTestingProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_Testing_Proxy(dispatcher, target_interface);
}
} // namespace
-PPB_Testing_Proxy::PPB_Testing_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
- ppb_testing_impl_(NULL) {
- if (!dispatcher->IsPlugin()) {
- ppb_testing_impl_ = static_cast<const PPB_Testing_Dev*>(
- dispatcher->local_get_interface()(PPB_TESTING_DEV_INTERFACE));
- }
+PPB_Testing_Proxy::PPB_Testing_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
}
PPB_Testing_Proxy::~PPB_Testing_Proxy() {
@@ -122,21 +119,21 @@ void PPB_Testing_Proxy::OnMsgReadImageData(
const HostResource& image,
const PP_Point& top_left,
PP_Bool* result) {
- *result = ppb_testing_impl_->ReadImageData(
+ *result = ppb_testing_target()->ReadImageData(
device_context_2d.host_resource(), image.host_resource(), &top_left);
}
void PPB_Testing_Proxy::OnMsgRunMessageLoop(PP_Instance instance) {
- ppb_testing_impl_->RunMessageLoop(instance);
+ ppb_testing_target()->RunMessageLoop(instance);
}
void PPB_Testing_Proxy::OnMsgQuitMessageLoop(PP_Instance instance) {
- ppb_testing_impl_->QuitMessageLoop(instance);
+ ppb_testing_target()->QuitMessageLoop(instance);
}
void PPB_Testing_Proxy::OnMsgGetLiveObjectsForInstance(PP_Instance instance,
uint32_t* result) {
- *result = ppb_testing_impl_->GetLiveObjectsForInstance(instance);
+ *result = ppb_testing_target()->GetLiveObjectsForInstance(instance);
}
} // namespace proxy
diff --git a/ppapi/proxy/ppb_testing_proxy.h b/ppapi/proxy/ppb_testing_proxy.h
index eaf5fb3..c07f6a9 100644
--- a/ppapi/proxy/ppb_testing_proxy.h
+++ b/ppapi/proxy/ppb_testing_proxy.h
@@ -19,11 +19,15 @@ namespace proxy {
class PPB_Testing_Proxy : public InterfaceProxy {
public:
- PPB_Testing_Proxy(Dispatcher* dispatcher);
+ PPB_Testing_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPB_Testing_Proxy();
static const Info* GetInfo();
+ const PPB_Testing_Dev* ppb_testing_target() const {
+ return static_cast<const PPB_Testing_Dev*>(target_interface());
+ }
+
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
@@ -37,11 +41,6 @@ class PPB_Testing_Proxy : public InterfaceProxy {
void OnMsgQuitMessageLoop(PP_Instance instance);
void OnMsgGetLiveObjectsForInstance(PP_Instance instance, uint32_t* result);
- // When this proxy is in the host side, this value caches the interface
- // pointer so we don't have to retrieve it from the dispatcher each time.
- // In the plugin, this value is always NULL.
- const PPB_Testing_Dev* ppb_testing_impl_;
-
DISALLOW_COPY_AND_ASSIGN(PPB_Testing_Proxy);
};
diff --git a/ppapi/proxy/ppb_url_loader_proxy.cc b/ppapi/proxy/ppb_url_loader_proxy.cc
index ce4bc62..e6ef68e 100644
--- a/ppapi/proxy/ppb_url_loader_proxy.cc
+++ b/ppapi/proxy/ppb_url_loader_proxy.cc
@@ -70,8 +70,9 @@ void UpdateResourceLoadStatus(PP_Instance pp_instance,
INTERFACE_ID_PPB_URL_LOADER, params));
}
-InterfaceProxy* CreateURLLoaderProxy(Dispatcher* dispatcher) {
- return new PPB_URLLoader_Proxy(dispatcher);
+InterfaceProxy* CreateURLLoaderProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_URLLoader_Proxy(dispatcher, target_interface);
}
} // namespace
@@ -345,8 +346,9 @@ struct PPB_URLLoader_Proxy::ReadCallbackInfo {
std::string read_buffer;
};
-PPB_URLLoader_Proxy::PPB_URLLoader_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
+PPB_URLLoader_Proxy::PPB_URLLoader_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface),
callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
host_urlloader_trusted_interface_(NULL) {
}
@@ -361,6 +363,18 @@ PP_Resource PPB_URLLoader_Proxy::TrackPluginResource(
}
// static
+const InterfaceProxy::Info* PPB_URLLoader_Proxy::GetInfo() {
+ static const Info info = {
+ thunk::GetPPB_URLLoader_Thunk(),
+ PPB_URLLOADER_INTERFACE,
+ INTERFACE_ID_PPB_URL_LOADER,
+ false,
+ &CreateURLLoaderProxy,
+ };
+ return &info;
+}
+
+// static
const InterfaceProxy::Info* PPB_URLLoader_Proxy::GetTrustedInfo() {
static const Info info = {
thunk::GetPPB_URLLoaderTrusted_Thunk(),
@@ -429,7 +443,7 @@ void PPB_URLLoader_Proxy::PrepareURLLoaderForSendingToPlugin(
void PPB_URLLoader_Proxy::OnMsgCreate(PP_Instance instance,
HostResource* result) {
- thunk::EnterResourceCreation enter(instance);
+ EnterFunctionNoLock<ResourceCreationAPI> enter(instance, true);
if (enter.succeeded()) {
result->SetHostResource(instance,
enter.functions()->CreateURLLoader(instance));
@@ -442,7 +456,8 @@ void PPB_URLLoader_Proxy::OnMsgOpen(const HostResource& loader,
uint32_t serialized_callback) {
// Have to be careful to always issue the callback, so don't return early.
EnterHostFromHostResource<PPB_URLLoader_API> enter(loader);
- thunk::EnterResourceCreation enter_creation(loader.instance());
+ EnterFunctionNoLock<ResourceCreationAPI> enter_creation(
+ loader.instance(), true);
PP_CompletionCallback callback = ReceiveCallback(serialized_callback);
diff --git a/ppapi/proxy/ppb_url_loader_proxy.h b/ppapi/proxy/ppb_url_loader_proxy.h
index defae9b..17825f1 100644
--- a/ppapi/proxy/ppb_url_loader_proxy.h
+++ b/ppapi/proxy/ppb_url_loader_proxy.h
@@ -29,9 +29,10 @@ struct PPBURLLoader_UpdateProgress_Params;
class PPB_URLLoader_Proxy : public InterfaceProxy {
public:
- PPB_URLLoader_Proxy(Dispatcher* dispatcher);
+ PPB_URLLoader_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPB_URLLoader_Proxy();
+ static const Info* GetInfo();
static const Info* GetTrustedInfo();
static PP_Resource CreateProxyResource(PP_Instance instance);
@@ -43,6 +44,10 @@ class PPB_URLLoader_Proxy : public InterfaceProxy {
static PP_Resource TrackPluginResource(
const ppapi::HostResource& url_loader_resource);
+ const PPB_URLLoader* ppb_url_loader_target() const {
+ return reinterpret_cast<const PPB_URLLoader*>(target_interface());
+ }
+
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
@@ -52,8 +57,6 @@ class PPB_URLLoader_Proxy : public InterfaceProxy {
// time you're sending a new URLLoader that the plugin hasn't seen yet.
void PrepareURLLoaderForSendingToPlugin(PP_Resource resource);
- static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_URL_LOADER;
-
private:
// Data associated with callbacks for ReadResponseBody.
struct ReadCallbackInfo;
diff --git a/ppapi/proxy/ppb_url_request_info_proxy.cc b/ppapi/proxy/ppb_url_request_info_proxy.cc
new file mode 100644
index 0000000..e5861f0
--- /dev/null
+++ b/ppapi/proxy/ppb_url_request_info_proxy.cc
@@ -0,0 +1,50 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/proxy/ppb_url_request_info_proxy.h"
+
+#include "ppapi/proxy/plugin_dispatcher.h"
+#include "ppapi/shared_impl/url_request_info_impl.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace proxy {
+
+namespace {
+
+InterfaceProxy* CreateURLRequestInfoProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_URLRequestInfo_Proxy(dispatcher, target_interface);
+}
+
+} // namespace
+
+PPB_URLRequestInfo_Proxy::PPB_URLRequestInfo_Proxy(
+ Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
+}
+
+PPB_URLRequestInfo_Proxy::~PPB_URLRequestInfo_Proxy() {
+}
+
+// static
+const InterfaceProxy::Info* PPB_URLRequestInfo_Proxy::GetInfo() {
+ static const Info info = {
+ thunk::GetPPB_URLRequestInfo_Thunk(),
+ PPB_URLREQUESTINFO_INTERFACE,
+ INTERFACE_ID_PPB_URL_REQUEST_INFO,
+ false,
+ &CreateURLRequestInfoProxy,
+ };
+ return &info;
+}
+
+bool PPB_URLRequestInfo_Proxy::OnMessageReceived(const IPC::Message& msg) {
+ // No messages to handle.
+ return false;
+}
+
+} // namespace proxy
+} // namespace ppapi
diff --git a/ppapi/proxy/ppb_url_request_info_proxy.h b/ppapi/proxy/ppb_url_request_info_proxy.h
new file mode 100644
index 0000000..6242bf8
--- /dev/null
+++ b/ppapi/proxy/ppb_url_request_info_proxy.h
@@ -0,0 +1,36 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_PROXY_PPB_URL_REQUEST_INFO_PROXY_H_
+#define PPAPI_PROXY_PPB_URL_REQUEST_INFO_PROXY_H_
+
+#include "base/basictypes.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/proxy/interface_proxy.h"
+
+namespace ppapi {
+
+struct PPB_URLRequestInfo_Data;
+
+namespace proxy {
+
+class PPB_URLRequestInfo_Proxy : public InterfaceProxy {
+ public:
+ PPB_URLRequestInfo_Proxy(Dispatcher* dispatcher,
+ const void* target_interface);
+ virtual ~PPB_URLRequestInfo_Proxy();
+
+ static const Info* GetInfo();
+
+ // InterfaceProxy implementation.
+ virtual bool OnMessageReceived(const IPC::Message& msg);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PPB_URLRequestInfo_Proxy);
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PROXY_PPB_URL_REQUEST_INFO_PROXY_H_
diff --git a/ppapi/proxy/ppb_url_response_info_proxy.cc b/ppapi/proxy/ppb_url_response_info_proxy.cc
index ace317c..3801e5f 100644
--- a/ppapi/proxy/ppb_url_response_info_proxy.cc
+++ b/ppapi/proxy/ppb_url_response_info_proxy.cc
@@ -20,6 +20,15 @@ using ppapi::thunk::PPB_URLResponseInfo_API;
namespace ppapi {
namespace proxy {
+namespace {
+
+InterfaceProxy* CreateURLResponseInfoProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_URLResponseInfo_Proxy(dispatcher, target_interface);
+}
+
+} // namespace
+
// URLResponseInfo -------------------------------------------------------------
class URLResponseInfo : public Resource, public PPB_URLResponseInfo_API {
@@ -71,14 +80,28 @@ PP_Resource URLResponseInfo::GetBodyAsFileRef() {
// PPB_URLResponseInfo_Proxy ---------------------------------------------------
-PPB_URLResponseInfo_Proxy::PPB_URLResponseInfo_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher) {
+PPB_URLResponseInfo_Proxy::PPB_URLResponseInfo_Proxy(
+ Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
}
PPB_URLResponseInfo_Proxy::~PPB_URLResponseInfo_Proxy() {
}
// static
+const InterfaceProxy::Info* PPB_URLResponseInfo_Proxy::GetInfo() {
+ static const Info info = {
+ ppapi::thunk::GetPPB_URLResponseInfo_Thunk(),
+ PPB_URLRESPONSEINFO_INTERFACE,
+ INTERFACE_ID_PPB_URL_RESPONSE_INFO,
+ false,
+ &CreateURLResponseInfoProxy,
+ };
+ return &info;
+}
+
+// static
PP_Resource PPB_URLResponseInfo_Proxy::CreateResponseForResource(
const HostResource& resource) {
return (new URLResponseInfo(resource))->GetReference();
@@ -119,8 +142,10 @@ void PPB_URLResponseInfo_Proxy::OnMsgGetBodyAsFileRef(
file_ref = enter.object()->GetBodyAsFileRef();
// Use the FileRef proxy to serialize.
+ DCHECK(!dispatcher()->IsPlugin());
+ HostDispatcher* host_disp = static_cast<HostDispatcher*>(dispatcher());
PPB_FileRef_Proxy* file_ref_proxy = static_cast<PPB_FileRef_Proxy*>(
- dispatcher()->GetInterfaceProxy(INTERFACE_ID_PPB_FILE_REF));
+ host_disp->GetOrCreatePPBInterfaceProxy(INTERFACE_ID_PPB_FILE_REF));
file_ref_proxy->SerializeFileRef(file_ref, result);
}
diff --git a/ppapi/proxy/ppb_url_response_info_proxy.h b/ppapi/proxy/ppb_url_response_info_proxy.h
index 8f97a53..a81549d 100644
--- a/ppapi/proxy/ppb_url_response_info_proxy.h
+++ b/ppapi/proxy/ppb_url_response_info_proxy.h
@@ -24,9 +24,12 @@ class SerializedVarReturnValue;
class PPB_URLResponseInfo_Proxy : public InterfaceProxy {
public:
- PPB_URLResponseInfo_Proxy(Dispatcher* dispatcher);
+ PPB_URLResponseInfo_Proxy(Dispatcher* dispatcher,
+ const void* target_interface);
virtual ~PPB_URLResponseInfo_Proxy();
+ static const Info* GetInfo();
+
// URLResponseInfo objects are actually created and returned by the
// URLLoader. This function allows the URLLoader to convert a new
// HostResource representing a response info to a properly tracked
@@ -38,8 +41,6 @@ class PPB_URLResponseInfo_Proxy : public InterfaceProxy {
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
- static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_URL_RESPONSE_INFO;
-
private:
// Message handlers.
void OnMsgGetProperty(const ppapi::HostResource& response,
diff --git a/ppapi/proxy/ppb_url_util_proxy.cc b/ppapi/proxy/ppb_url_util_proxy.cc
index b3cea08..a202038 100644
--- a/ppapi/proxy/ppb_url_util_proxy.cc
+++ b/ppapi/proxy/ppb_url_util_proxy.cc
@@ -129,19 +129,16 @@ const PPB_URLUtil_Dev url_util_interface = {
&GetPluginInstanceURL
};
-InterfaceProxy* CreateURLUtilProxy(Dispatcher* dispatcher) {
- return new PPB_URLUtil_Proxy(dispatcher);
+InterfaceProxy* CreateURLUtilProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_URLUtil_Proxy(dispatcher, target_interface);
}
} // namespace
-PPB_URLUtil_Proxy::PPB_URLUtil_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
- ppb_url_util_impl_(NULL) {
- if (!dispatcher->IsPlugin()) {
- ppb_url_util_impl_ = static_cast<const PPB_URLUtil_Dev*>(
- dispatcher->local_get_interface()(PPB_URLUTIL_DEV_INTERFACE));
- }
+PPB_URLUtil_Proxy::PPB_URLUtil_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
}
PPB_URLUtil_Proxy::~PPB_URLUtil_Proxy() {
@@ -182,34 +179,34 @@ void PPB_URLUtil_Proxy::OnMsgResolveRelativeToDocument(
SerializedVarReceiveInput relative,
SerializedVarReturnValue result) {
result.Return(dispatcher(),
- ppb_url_util_impl_->ResolveRelativeToDocument(
+ ppb_url_util_target()->ResolveRelativeToDocument(
instance, relative.Get(dispatcher()), NULL));
}
void PPB_URLUtil_Proxy::OnMsgDocumentCanRequest(PP_Instance instance,
SerializedVarReceiveInput url,
PP_Bool* result) {
- *result = ppb_url_util_impl_->DocumentCanRequest(instance,
- url.Get(dispatcher()));
+ *result = ppb_url_util_target()->DocumentCanRequest(instance,
+ url.Get(dispatcher()));
}
void PPB_URLUtil_Proxy::OnMsgDocumentCanAccessDocument(PP_Instance active,
PP_Instance target,
PP_Bool* result) {
- *result = ppb_url_util_impl_->DocumentCanAccessDocument(
+ *result = ppb_url_util_target()->DocumentCanAccessDocument(
active, target);
}
void PPB_URLUtil_Proxy::OnMsgGetDocumentURL(PP_Instance instance,
SerializedVarReturnValue result) {
result.Return(dispatcher(),
- ppb_url_util_impl_->GetDocumentURL(instance, NULL));
+ ppb_url_util_target()->GetDocumentURL(instance, NULL));
}
void PPB_URLUtil_Proxy::OnMsgGetPluginInstanceURL(
PP_Instance instance, SerializedVarReturnValue result) {
result.Return(dispatcher(),
- ppb_url_util_impl_->GetPluginInstanceURL(instance, NULL));
+ ppb_url_util_target()->GetPluginInstanceURL(instance, NULL));
}
} // namespace proxy
diff --git a/ppapi/proxy/ppb_url_util_proxy.h b/ppapi/proxy/ppb_url_util_proxy.h
index 0571377..2c6cb40 100644
--- a/ppapi/proxy/ppb_url_util_proxy.h
+++ b/ppapi/proxy/ppb_url_util_proxy.h
@@ -16,11 +16,15 @@ namespace proxy {
class PPB_URLUtil_Proxy : public InterfaceProxy {
public:
- PPB_URLUtil_Proxy(Dispatcher* dispatcher);
+ PPB_URLUtil_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPB_URLUtil_Proxy();
static const Info* GetInfo();
+ const PPB_URLUtil_Dev* ppb_url_util_target() const {
+ return static_cast<const PPB_URLUtil_Dev*>(target_interface());
+ }
+
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
@@ -40,11 +44,6 @@ class PPB_URLUtil_Proxy : public InterfaceProxy {
void OnMsgGetPluginInstanceURL(PP_Instance instance,
SerializedVarReturnValue result);
- // When this proxy is in the host side, this value caches the interface
- // pointer so we don't have to retrieve it from the dispatcher each time.
- // In the plugin, this value is always NULL.
- const PPB_URLUtil_Dev* ppb_url_util_impl_;
-
DISALLOW_COPY_AND_ASSIGN(PPB_URLUtil_Proxy);
};
diff --git a/ppapi/proxy/ppb_var_deprecated_proxy.cc b/ppapi/proxy/ppb_var_deprecated_proxy.cc
index 1850dc0f..396e50e 100644
--- a/ppapi/proxy/ppb_var_deprecated_proxy.cc
+++ b/ppapi/proxy/ppb_var_deprecated_proxy.cc
@@ -288,21 +288,18 @@ const PPB_Var_Deprecated var_deprecated_interface = {
&CreateObject
};
-InterfaceProxy* CreateVarDeprecatedProxy(Dispatcher* dispatcher) {
- return new PPB_Var_Deprecated_Proxy(dispatcher );
+InterfaceProxy* CreateVarDeprecatedProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_Var_Deprecated_Proxy(dispatcher, target_interface);
}
} // namespace
PPB_Var_Deprecated_Proxy::PPB_Var_Deprecated_Proxy(
- Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
- task_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
- ppb_var_impl_(NULL) {
- if (!dispatcher->IsPlugin()) {
- ppb_var_impl_ = static_cast<const PPB_Var_Deprecated*>(
- dispatcher->local_get_interface()(PPB_VAR_DEPRECATED_INTERFACE));
- }
+ Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface),
+ task_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
}
PPB_Var_Deprecated_Proxy::~PPB_Var_Deprecated_Proxy() {
@@ -363,7 +360,7 @@ void PPB_Var_Deprecated_Proxy::OnMsgAddRefObject(int64 object_id,
PP_Var var;
var.type = PP_VARTYPE_OBJECT;
var.value.as_id = object_id;
- ppb_var_impl_->AddRef(var);
+ ppb_var_target()->AddRef(var);
}
void PPB_Var_Deprecated_Proxy::OnMsgReleaseObject(int64 object_id) {
@@ -396,7 +393,7 @@ void PPB_Var_Deprecated_Proxy::OnMsgHasProperty(
SerializedVarOutParam exception,
PP_Bool* result) {
SetAllowPluginReentrancy();
- *result = PP_FromBool(ppb_var_impl_->HasProperty(
+ *result = PP_FromBool(ppb_var_target()->HasProperty(
var.Get(dispatcher()),
name.Get(dispatcher()),
exception.OutParam(dispatcher())));
@@ -408,7 +405,7 @@ void PPB_Var_Deprecated_Proxy::OnMsgHasMethodDeprecated(
SerializedVarOutParam exception,
PP_Bool* result) {
SetAllowPluginReentrancy();
- *result = PP_FromBool(ppb_var_impl_->HasMethod(
+ *result = PP_FromBool(ppb_var_target()->HasMethod(
var.Get(dispatcher()),
name.Get(dispatcher()),
exception.OutParam(dispatcher())));
@@ -420,7 +417,7 @@ void PPB_Var_Deprecated_Proxy::OnMsgGetProperty(
SerializedVarOutParam exception,
SerializedVarReturnValue result) {
SetAllowPluginReentrancy();
- result.Return(dispatcher(), ppb_var_impl_->GetProperty(
+ result.Return(dispatcher(), ppb_var_target()->GetProperty(
var.Get(dispatcher()), name.Get(dispatcher()),
exception.OutParam(dispatcher())));
}
@@ -430,7 +427,7 @@ void PPB_Var_Deprecated_Proxy::OnMsgEnumerateProperties(
SerializedVarVectorOutParam props,
SerializedVarOutParam exception) {
SetAllowPluginReentrancy();
- ppb_var_impl_->GetAllPropertyNames(var.Get(dispatcher()),
+ ppb_var_target()->GetAllPropertyNames(var.Get(dispatcher()),
props.CountOutParam(), props.ArrayOutParam(dispatcher()),
exception.OutParam(dispatcher()));
}
@@ -441,7 +438,7 @@ void PPB_Var_Deprecated_Proxy::OnMsgSetPropertyDeprecated(
SerializedVarReceiveInput value,
SerializedVarOutParam exception) {
SetAllowPluginReentrancy();
- ppb_var_impl_->SetProperty(var.Get(dispatcher()),
+ ppb_var_target()->SetProperty(var.Get(dispatcher()),
name.Get(dispatcher()),
value.Get(dispatcher()),
exception.OutParam(dispatcher()));
@@ -453,7 +450,7 @@ void PPB_Var_Deprecated_Proxy::OnMsgDeleteProperty(
SerializedVarOutParam exception,
PP_Bool* result) {
SetAllowPluginReentrancy();
- ppb_var_impl_->RemoveProperty(var.Get(dispatcher()),
+ ppb_var_target()->RemoveProperty(var.Get(dispatcher()),
name.Get(dispatcher()),
exception.OutParam(dispatcher()));
// This deprecated function doesn't actually return a value, but we re-use
@@ -470,7 +467,7 @@ void PPB_Var_Deprecated_Proxy::OnMsgCallDeprecated(
SetAllowPluginReentrancy();
uint32_t arg_count = 0;
PP_Var* args = arg_vector.Get(dispatcher(), &arg_count);
- result.Return(dispatcher(), ppb_var_impl_->Call(
+ result.Return(dispatcher(), ppb_var_target()->Call(
object.Get(dispatcher()),
method_name.Get(dispatcher()),
arg_count, args,
@@ -485,7 +482,7 @@ void PPB_Var_Deprecated_Proxy::OnMsgConstruct(
SetAllowPluginReentrancy();
uint32_t arg_count = 0;
PP_Var* args = arg_vector.Get(dispatcher(), &arg_count);
- result.Return(dispatcher(), ppb_var_impl_->Construct(
+ result.Return(dispatcher(), ppb_var_target()->Construct(
var.Get(dispatcher()), arg_count, args,
exception.OutParam(dispatcher())));
}
@@ -505,7 +502,7 @@ void PPB_Var_Deprecated_Proxy::OnMsgCreateObjectDeprecated(
SerializedVarReturnValue result) {
SetAllowPluginReentrancy();
result.Return(dispatcher(), PPP_Class_Proxy::CreateProxiedObject(
- ppb_var_impl_, dispatcher(), instance, ppp_class, class_data));
+ ppb_var_target(), dispatcher(), instance, ppp_class, class_data));
}
void PPB_Var_Deprecated_Proxy::SetAllowPluginReentrancy() {
@@ -519,7 +516,7 @@ void PPB_Var_Deprecated_Proxy::DoReleaseObject(int64 object_id) {
PP_Var var;
var.type = PP_VARTYPE_OBJECT;
var.value.as_id = object_id;
- ppb_var_impl_->Release(var);
+ ppb_var_target()->Release(var);
}
} // namespace proxy
diff --git a/ppapi/proxy/ppb_var_deprecated_proxy.h b/ppapi/proxy/ppb_var_deprecated_proxy.h
index ac8c1fd..d1a45a0 100644
--- a/ppapi/proxy/ppb_var_deprecated_proxy.h
+++ b/ppapi/proxy/ppb_var_deprecated_proxy.h
@@ -26,11 +26,16 @@ class SerializedVarReturnValue;
class PPB_Var_Deprecated_Proxy : public InterfaceProxy {
public:
- PPB_Var_Deprecated_Proxy(Dispatcher* dispatcher);
+ PPB_Var_Deprecated_Proxy(Dispatcher* dispatcher,
+ const void* target_interface);
virtual ~PPB_Var_Deprecated_Proxy();
static const Info* GetInfo();
+ const PPB_Var_Deprecated* ppb_var_target() const {
+ return static_cast<const PPB_Var_Deprecated*>(target_interface());
+ }
+
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
@@ -91,10 +96,6 @@ class PPB_Var_Deprecated_Proxy : public InterfaceProxy {
void DoReleaseObject(int64 object_id);
ScopedRunnableMethodFactory<PPB_Var_Deprecated_Proxy> task_factory_;
-
- const PPB_Var_Deprecated* ppb_var_impl_;
-
- DISALLOW_COPY_AND_ASSIGN(PPB_Var_Deprecated_Proxy);
};
} // namespace proxy
diff --git a/ppapi/proxy/ppb_var_proxy.cc b/ppapi/proxy/ppb_var_proxy.cc
index 4ee6cc1..765deef 100644
--- a/ppapi/proxy/ppb_var_proxy.cc
+++ b/ppapi/proxy/ppb_var_proxy.cc
@@ -46,10 +46,37 @@ const PPB_Var var_interface = {
&VarToUtf8
};
+InterfaceProxy* CreateVarProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_Var_Proxy(dispatcher, target_interface);
+}
+
} // namespace
-const PPB_Var* GetPPB_Var_Interface() {
- return &var_interface;
+PPB_Var_Proxy::PPB_Var_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
+}
+
+PPB_Var_Proxy::~PPB_Var_Proxy() {
+}
+
+// static
+const InterfaceProxy::Info* PPB_Var_Proxy::GetInfo() {
+ static const Info info = {
+ &var_interface,
+ PPB_VAR_INTERFACE,
+ INTERFACE_ID_PPB_VAR,
+ false,
+ &CreateVarProxy,
+ };
+ return &info;
+}
+
+bool PPB_Var_Proxy::OnMessageReceived(const IPC::Message& msg) {
+ // All PPB_Var calls are handled locally; there is no need to send or receive
+ // messages here.
+ return false;
}
} // namespace proxy
diff --git a/ppapi/proxy/ppb_var_proxy.h b/ppapi/proxy/ppb_var_proxy.h
index 465042b9..6e060b9 100644
--- a/ppapi/proxy/ppb_var_proxy.h
+++ b/ppapi/proxy/ppb_var_proxy.h
@@ -5,7 +5,6 @@
#ifndef PPAPI_PPB_VAR_PROXY_H_
#define PPAPI_PPB_VAR_PROXY_H_
-#include "ppapi/proxy/ppapi_proxy_export.h"
#include "ppapi/proxy/interface_proxy.h"
struct PPB_Var;
@@ -13,9 +12,23 @@ struct PPB_Var;
namespace ppapi {
namespace proxy {
-// Returns a pointer to the plugin-specific implementation of PPB_Var.
-// There is no proxy object since this is implemented entirely in-process.
-PPAPI_PROXY_EXPORT const PPB_Var* GetPPB_Var_Interface();
+class PPB_Var_Proxy : public InterfaceProxy {
+ public:
+ PPB_Var_Proxy(Dispatcher* dispatcher,
+ const void* target_interface);
+ virtual ~PPB_Var_Proxy();
+
+ static const Info* GetInfo();
+
+ const PPB_Var* ppb_var_target() const {
+ return static_cast<const PPB_Var*>(target_interface());
+ }
+
+ // InterfaceProxy implementation. In this case, no messages are sent or
+ // received, so this always returns false.
+ virtual bool OnMessageReceived(const IPC::Message& msg);
+
+};
} // namespace proxy
} // namespace ppapi
diff --git a/ppapi/proxy/ppb_var_unittest.cc b/ppapi/proxy/ppb_var_unittest.cc
index 79abf39..485b599 100644
--- a/ppapi/proxy/ppb_var_unittest.cc
+++ b/ppapi/proxy/ppb_var_unittest.cc
@@ -9,7 +9,6 @@
#include "ppapi/c/pp_var.h"
#include "ppapi/c/ppb_var.h"
#include "ppapi/proxy/ppapi_proxy_test.h"
-#include "ppapi/proxy/ppb_var_proxy.h"
// TODO(dmichael): Make PPB_Var_Proxy and PluginResourceTracker thread-safe and
// add thread-safety tests here.
@@ -31,7 +30,8 @@ class PPB_VarTest : public PluginProxyTest {
};
TEST_F(PPB_VarTest, Strings) {
- const PPB_Var* ppb_var = GetPPB_Var_Interface();
+ const PPB_Var* ppb_var = static_cast<const PPB_Var*>(
+ plugin_dispatcher()->GetInterfaceFromDispatcher(PPB_VAR_INTERFACE));
// Make a vector of strings, where the value of test_strings[i] is "i".
const int kNumStrings = 5;
diff --git a/ppapi/proxy/ppb_video_capture_proxy.cc b/ppapi/proxy/ppb_video_capture_proxy.cc
index 9f40c1f..cae0b22 100644
--- a/ppapi/proxy/ppb_video_capture_proxy.cc
+++ b/ppapi/proxy/ppb_video_capture_proxy.cc
@@ -21,7 +21,6 @@
#include "ppapi/thunk/ppb_buffer_api.h"
#include "ppapi/thunk/ppb_buffer_trusted_api.h"
#include "ppapi/thunk/ppb_video_capture_api.h"
-#include "ppapi/thunk/resource_creation_api.h"
#include "ppapi/thunk/thunk.h"
using ppapi::thunk::EnterResourceNoLock;
@@ -34,8 +33,14 @@ namespace proxy {
namespace {
-InterfaceProxy* CreatePPPVideoCaptureProxy(Dispatcher* dispatcher) {
- return new PPP_VideoCapture_Proxy(dispatcher);
+InterfaceProxy* CreatePPBVideoCaptureProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_VideoCapture_Proxy(dispatcher, target_interface);
+}
+
+InterfaceProxy* CreatePPPVideoCaptureProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPP_VideoCapture_Proxy(dispatcher, target_interface);
}
void OnDeviceInfo(PP_Instance instance,
@@ -52,7 +57,7 @@ void OnDeviceInfo(PP_Instance instance,
host_resource.SetHostResource(instance, resource);
std::vector<PPPVideoCapture_Buffer> buffers(buffer_count);
const PPB_Core* core = static_cast<const PPB_Core*>(
- dispatcher->local_get_interface()(PPB_CORE_INTERFACE));
+ dispatcher->GetLocalInterface(PPB_CORE_INTERFACE));
DCHECK(core);
for (uint32_t i = 0; i < buffer_count; ++i) {
// We need to take a ref on the resource now. The browser may drop
@@ -260,14 +265,27 @@ ppapi::thunk::PPB_VideoCapture_API* VideoCapture::AsPPB_VideoCapture_API() {
return this;
}
-PPB_VideoCapture_Proxy::PPB_VideoCapture_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher) {
+PPB_VideoCapture_Proxy::PPB_VideoCapture_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
}
PPB_VideoCapture_Proxy::~PPB_VideoCapture_Proxy() {
}
// static
+const InterfaceProxy::Info* PPB_VideoCapture_Proxy::GetInfo() {
+ static const Info info = {
+ ppapi::thunk::GetPPB_VideoCapture_Thunk(),
+ PPB_VIDEO_CAPTURE_DEV_INTERFACE,
+ INTERFACE_ID_PPB_VIDEO_CAPTURE_DEV,
+ false,
+ &CreatePPBVideoCaptureProxy,
+ };
+ return &info;
+}
+
+// static
PP_Resource PPB_VideoCapture_Proxy::CreateProxyResource(PP_Instance instance) {
PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
if (!dispatcher)
@@ -299,12 +317,11 @@ bool PPB_VideoCapture_Proxy::OnMessageReceived(const IPC::Message& msg) {
void PPB_VideoCapture_Proxy::OnMsgCreate(PP_Instance instance,
HostResource* result_resource) {
- thunk::EnterResourceCreation enter(instance);
- if (enter.succeeded()) {
- result_resource->SetHostResource(
- instance,
- enter.functions()->CreateVideoCapture(instance));
- }
+ HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
+ if (!dispatcher)
+ return;
+ PP_Resource resource = ppb_video_capture_target()->Create(instance);
+ result_resource->SetHostResource(instance, resource);
}
void PPB_VideoCapture_Proxy::OnMsgStartCapture(
@@ -329,13 +346,9 @@ void PPB_VideoCapture_Proxy::OnMsgStopCapture(const HostResource& resource) {
enter.object()->StopCapture();
}
-PPP_VideoCapture_Proxy::PPP_VideoCapture_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
- ppp_video_capture_impl_(NULL) {
- if (dispatcher->IsPlugin()) {
- ppp_video_capture_impl_ = static_cast<const PPP_VideoCapture_Dev*>(
- dispatcher->local_get_interface()(PPP_VIDEO_CAPTURE_DEV_INTERFACE));
- }
+PPP_VideoCapture_Proxy::PPP_VideoCapture_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
}
PPP_VideoCapture_Proxy::~PPP_VideoCapture_Proxy() {
@@ -375,7 +388,7 @@ void PPP_VideoCapture_Proxy::OnMsgOnDeviceInfo(
EnterPluginFromHostResource<PPB_VideoCapture_API> enter(host_resource);
PluginResourceTracker* tracker = PluginResourceTracker::GetInstance();
PP_Resource resource = tracker->PluginResourceForHostResource(host_resource);
- if (!resource || !ppp_video_capture_impl_ || enter.failed())
+ if (!resource || !ppp_video_capture_target() || enter.failed())
return;
scoped_array<PP_Resource> resources(new PP_Resource[buffers.size()]);
@@ -387,7 +400,7 @@ void PPP_VideoCapture_Proxy::OnMsgOnDeviceInfo(
buffers[i].size);
}
static_cast<VideoCapture*>(enter.object())->SetBufferCount(buffers.size());
- ppp_video_capture_impl_->OnDeviceInfo(
+ ppp_video_capture_target()->OnDeviceInfo(
host_resource.instance(),
resource,
&info,
@@ -402,12 +415,12 @@ void PPP_VideoCapture_Proxy::OnMsgOnStatus(const HostResource& host_resource,
EnterPluginFromHostResource<PPB_VideoCapture_API> enter(host_resource);
PluginResourceTracker* tracker = PluginResourceTracker::GetInstance();
PP_Resource resource = tracker->PluginResourceForHostResource(host_resource);
- if (!resource || !ppp_video_capture_impl_ || enter.failed())
+ if (!resource || !ppp_video_capture_target() || enter.failed())
return;
if (!static_cast<VideoCapture*>(enter.object())->OnStatus(status))
return;
- ppp_video_capture_impl_->OnStatus(
+ ppp_video_capture_target()->OnStatus(
host_resource.instance(), resource, status);
}
@@ -416,11 +429,11 @@ void PPP_VideoCapture_Proxy::OnMsgOnError(const HostResource& host_resource,
EnterPluginFromHostResource<PPB_VideoCapture_API> enter(host_resource);
PluginResourceTracker* tracker = PluginResourceTracker::GetInstance();
PP_Resource resource = tracker->PluginResourceForHostResource(host_resource);
- if (!resource || !ppp_video_capture_impl_ || enter.failed())
+ if (!resource || !ppp_video_capture_target() || enter.failed())
return;
static_cast<VideoCapture*>(enter.object())->set_status(
PP_VIDEO_CAPTURE_STATUS_STOPPED);
- ppp_video_capture_impl_->OnError(
+ ppp_video_capture_target()->OnError(
host_resource.instance(), resource, error_code);
}
@@ -429,10 +442,10 @@ void PPP_VideoCapture_Proxy::OnMsgOnBufferReady(
EnterPluginFromHostResource<PPB_VideoCapture_API> enter(host_resource);
PluginResourceTracker* tracker = PluginResourceTracker::GetInstance();
PP_Resource resource = tracker->PluginResourceForHostResource(host_resource);
- if (!resource || !ppp_video_capture_impl_ || enter.failed())
+ if (!resource || !ppp_video_capture_target() || enter.failed())
return;
static_cast<VideoCapture*>(enter.object())->SetBufferInUse(buffer);
- ppp_video_capture_impl_->OnBufferReady(
+ ppp_video_capture_target()->OnBufferReady(
host_resource.instance(), resource, buffer);
}
diff --git a/ppapi/proxy/ppb_video_capture_proxy.h b/ppapi/proxy/ppb_video_capture_proxy.h
index 5695579..e882700 100644
--- a/ppapi/proxy/ppb_video_capture_proxy.h
+++ b/ppapi/proxy/ppb_video_capture_proxy.h
@@ -21,16 +21,20 @@ namespace proxy {
class PPB_VideoCapture_Proxy : public InterfaceProxy {
public:
- PPB_VideoCapture_Proxy(Dispatcher* dispatcher);
+ PPB_VideoCapture_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPB_VideoCapture_Proxy();
+ static const Info* GetInfo();
+
static PP_Resource CreateProxyResource(PP_Instance instance);
+ const PPB_VideoCapture_Dev* ppb_video_capture_target() const {
+ return static_cast<const PPB_VideoCapture_Dev*>(target_interface());
+ }
+
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
- static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_VIDEO_CAPTURE_DEV;
-
private:
// Message handlers.
void OnMsgCreate(PP_Instance instance, ppapi::HostResource* result_resource);
@@ -40,22 +44,22 @@ class PPB_VideoCapture_Proxy : public InterfaceProxy {
void OnMsgReuseBuffer(const ppapi::HostResource& resource,
uint32_t buffer);
void OnMsgStopCapture(const ppapi::HostResource& resource);
-
- DISALLOW_COPY_AND_ASSIGN(PPB_VideoCapture_Proxy);
};
class PPP_VideoCapture_Proxy : public InterfaceProxy {
public:
- PPP_VideoCapture_Proxy(Dispatcher* dispatcher);
+ PPP_VideoCapture_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPP_VideoCapture_Proxy();
static const Info* GetInfo();
+ const PPP_VideoCapture_Dev* ppp_video_capture_target() const {
+ return static_cast<const PPP_VideoCapture_Dev*>(target_interface());
+ }
+
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
- static const InterfaceID kInterfaceID = INTERFACE_ID_PPP_VIDEO_CAPTURE_DEV;
-
private:
// Message handlers.
void OnMsgOnDeviceInfo(const ppapi::HostResource& video_capture,
@@ -67,13 +71,6 @@ class PPP_VideoCapture_Proxy : public InterfaceProxy {
uint32_t error_code);
void OnMsgOnBufferReady(const ppapi::HostResource& video_capture,
uint32_t buffer);
-
- // When this proxy is in the plugin side, this value caches the interface
- // pointer so we don't have to retrieve it from the dispatcher each time.
- // In the host, this value is always NULL.
- const PPP_VideoCapture_Dev* ppp_video_capture_impl_;
-
- DISALLOW_COPY_AND_ASSIGN(PPP_VideoCapture_Proxy);
};
} // namespace proxy
diff --git a/ppapi/proxy/ppb_video_decoder_proxy.cc b/ppapi/proxy/ppb_video_decoder_proxy.cc
index 023b8c9..f9e4379 100644
--- a/ppapi/proxy/ppb_video_decoder_proxy.cc
+++ b/ppapi/proxy/ppb_video_decoder_proxy.cc
@@ -154,14 +154,36 @@ void VideoDecoder::EndOfBitstreamACK(
RunBitstreamBufferCallback(bitstream_buffer_id, result);
}
-PPB_VideoDecoder_Proxy::PPB_VideoDecoder_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
+namespace {
+
+InterfaceProxy* CreateVideoDecoderProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_VideoDecoder_Proxy(dispatcher, target_interface);
+}
+
+} // namespace
+
+PPB_VideoDecoder_Proxy::PPB_VideoDecoder_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface),
callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
}
PPB_VideoDecoder_Proxy::~PPB_VideoDecoder_Proxy() {
}
+// static
+const InterfaceProxy::Info* PPB_VideoDecoder_Proxy::GetInfo() {
+ static const Info info = {
+ thunk::GetPPB_VideoDecoder_Thunk(),
+ PPB_VIDEODECODER_DEV_INTERFACE,
+ INTERFACE_ID_PPB_VIDEO_DECODER_DEV,
+ false,
+ &CreateVideoDecoderProxy,
+ };
+ return &info;
+}
+
bool PPB_VideoDecoder_Proxy::OnMessageReceived(const IPC::Message& msg) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(PPB_VideoDecoder_Proxy, msg)
@@ -230,7 +252,8 @@ void PPB_VideoDecoder_Proxy::OnMsgCreate(
PP_Instance instance, const HostResource& graphics_context,
PP_VideoDecoder_Profile profile,
HostResource* result) {
- thunk::EnterResourceCreation resource_creation(instance);
+ thunk::EnterFunction<thunk::ResourceCreationAPI> resource_creation(instance,
+ true);
if (resource_creation.failed())
return;
@@ -243,52 +266,46 @@ void PPB_VideoDecoder_Proxy::OnMsgCreate(
void PPB_VideoDecoder_Proxy::OnMsgDecode(
const HostResource& decoder,
const HostResource& buffer, int32 id, int32 size) {
- EnterHostFromHostResourceForceCallback<PPB_VideoDecoder_API> enter(
- decoder, callback_factory_,
+ pp::CompletionCallback callback = callback_factory_.NewRequiredCallback(
&PPB_VideoDecoder_Proxy::SendMsgEndOfBitstreamACKToPlugin, decoder, id);
- if (enter.failed())
- return;
+
PP_VideoBitstreamBuffer_Dev bitstream = { id, buffer.host_resource(), size };
- enter.SetResult(enter.object()->Decode(&bitstream, enter.callback()));
+ ppb_video_decoder_target()->Decode(
+ decoder.host_resource(), &bitstream, callback.pp_completion_callback());
}
void PPB_VideoDecoder_Proxy::OnMsgAssignPictureBuffers(
const HostResource& decoder,
const std::vector<PP_PictureBuffer_Dev>& buffers) {
- EnterHostFromHostResource<PPB_VideoDecoder_API> enter(decoder);
- if (enter.succeeded() && !buffers.empty()) {
- const PP_PictureBuffer_Dev* buffer_array = &buffers.front();
- enter.object()->AssignPictureBuffers(buffers.size(), buffer_array);
- }
+ DCHECK(!buffers.empty());
+ const PP_PictureBuffer_Dev* buffer_array = &buffers.front();
+
+ ppb_video_decoder_target()->AssignPictureBuffers(
+ decoder.host_resource(), buffers.size(), buffer_array);
}
void PPB_VideoDecoder_Proxy::OnMsgReusePictureBuffer(
const HostResource& decoder, int32 picture_buffer_id) {
- EnterHostFromHostResource<PPB_VideoDecoder_API> enter(decoder);
- if (enter.succeeded())
- enter.object()->ReusePictureBuffer(picture_buffer_id);
+ ppb_video_decoder_target()->ReusePictureBuffer(
+ decoder.host_resource(), picture_buffer_id);
}
void PPB_VideoDecoder_Proxy::OnMsgFlush(const HostResource& decoder) {
- EnterHostFromHostResourceForceCallback<PPB_VideoDecoder_API> enter(
- decoder, callback_factory_,
+ pp::CompletionCallback callback = callback_factory_.NewRequiredCallback(
&PPB_VideoDecoder_Proxy::SendMsgFlushACKToPlugin, decoder);
- if (enter.succeeded())
- enter.SetResult(enter.object()->Flush(enter.callback()));
+ ppb_video_decoder_target()->Flush(
+ decoder.host_resource(), callback.pp_completion_callback());
}
void PPB_VideoDecoder_Proxy::OnMsgReset(const HostResource& decoder) {
- EnterHostFromHostResourceForceCallback<PPB_VideoDecoder_API> enter(
- decoder, callback_factory_,
+ pp::CompletionCallback callback = callback_factory_.NewRequiredCallback(
&PPB_VideoDecoder_Proxy::SendMsgResetACKToPlugin, decoder);
- if (enter.succeeded())
- enter.SetResult(enter.object()->Reset(enter.callback()));
+ ppb_video_decoder_target()->Reset(
+ decoder.host_resource(), callback.pp_completion_callback());
}
void PPB_VideoDecoder_Proxy::OnMsgDestroy(const HostResource& decoder) {
- EnterHostFromHostResource<PPB_VideoDecoder_API> enter(decoder);
- if (enter.succeeded())
- enter.object()->Destroy();
+ ppb_video_decoder_target()->Destroy(decoder.host_resource());
}
void PPB_VideoDecoder_Proxy::SendMsgEndOfBitstreamACKToPlugin(
diff --git a/ppapi/proxy/ppb_video_decoder_proxy.h b/ppapi/proxy/ppb_video_decoder_proxy.h
index 32d1ec6..b34cb22 100644
--- a/ppapi/proxy/ppb_video_decoder_proxy.h
+++ b/ppapi/proxy/ppb_video_decoder_proxy.h
@@ -17,9 +17,11 @@ namespace proxy {
class PPB_VideoDecoder_Proxy : public InterfaceProxy {
public:
- PPB_VideoDecoder_Proxy(Dispatcher* dispatcher);
+ PPB_VideoDecoder_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPB_VideoDecoder_Proxy();
+ static const Info* GetInfo();
+
// Creates a VideoDecoder object in the plugin process.
static PP_Resource CreateProxyResource(
PP_Instance instance,
@@ -29,7 +31,9 @@ class PPB_VideoDecoder_Proxy : public InterfaceProxy {
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
- static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_VIDEO_DECODER_DEV;
+ const PPB_VideoDecoder_Dev* ppb_video_decoder_target() const {
+ return static_cast<const PPB_VideoDecoder_Dev*>(target_interface());
+ }
private:
// Message handlers in the renderer process to receive messages from the
diff --git a/ppapi/proxy/ppp_class_proxy.cc b/ppapi/proxy/ppp_class_proxy.cc
index 9a616f42..8ab109f 100644
--- a/ppapi/proxy/ppp_class_proxy.cc
+++ b/ppapi/proxy/ppp_class_proxy.cc
@@ -175,18 +175,13 @@ void* ToUserData(int64 value) {
// PPP_Class_Proxy -------------------------------------------------------------
PPP_Class_Proxy::PPP_Class_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher) {
+ : InterfaceProxy(dispatcher, NULL) {
}
PPP_Class_Proxy::~PPP_Class_Proxy() {
}
// static
-InterfaceProxy* PPP_Class_Proxy::Create(Dispatcher* dispatcher) {
- return new PPP_Class_Proxy(dispatcher);
-}
-
-// static
PP_Var PPP_Class_Proxy::CreateProxiedObject(const PPB_Var_Deprecated* var,
Dispatcher* dispatcher,
PP_Module module_id,
diff --git a/ppapi/proxy/ppp_class_proxy.h b/ppapi/proxy/ppp_class_proxy.h
index 299c3ec..ce93770 100644
--- a/ppapi/proxy/ppp_class_proxy.h
+++ b/ppapi/proxy/ppp_class_proxy.h
@@ -31,10 +31,6 @@ class PPP_Class_Proxy : public InterfaceProxy {
PPP_Class_Proxy(Dispatcher* dispatcher);
virtual ~PPP_Class_Proxy();
- // Factory function used for registration (normal code can just use the
- // constructor).
- static InterfaceProxy* Create(Dispatcher* dispatcher);
-
// Creates a proxied object in the browser process. This takes the browser's
// PPB_Var_Deprecated interface to use to create the object. The class and
static PP_Var CreateProxiedObject(const PPB_Var_Deprecated* var,
diff --git a/ppapi/proxy/ppp_graphics_3d_proxy.cc b/ppapi/proxy/ppp_graphics_3d_proxy.cc
index 3cac4646..a477227 100644
--- a/ppapi/proxy/ppp_graphics_3d_proxy.cc
+++ b/ppapi/proxy/ppp_graphics_3d_proxy.cc
@@ -24,19 +24,16 @@ static const PPP_Graphics3D graphics_3d_interface = {
&ContextLost
};
-InterfaceProxy* CreateGraphics3DProxy(Dispatcher* dispatcher) {
- return new PPP_Graphics3D_Proxy(dispatcher);
+InterfaceProxy* CreateGraphics3DProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPP_Graphics3D_Proxy(dispatcher, target_interface);
}
} // namespace
-PPP_Graphics3D_Proxy::PPP_Graphics3D_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
- ppp_graphics_3d_impl_(NULL) {
- if (dispatcher->IsPlugin()) {
- ppp_graphics_3d_impl_ = static_cast<const PPP_Graphics3D*>(
- dispatcher->local_get_interface()(PPP_GRAPHICS_3D_INTERFACE));
- }
+PPP_Graphics3D_Proxy::PPP_Graphics3D_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
}
PPP_Graphics3D_Proxy::~PPP_Graphics3D_Proxy() {
@@ -65,8 +62,8 @@ bool PPP_Graphics3D_Proxy::OnMessageReceived(const IPC::Message& msg) {
}
void PPP_Graphics3D_Proxy::OnMsgContextLost(PP_Instance instance) {
- if (ppp_graphics_3d_impl_)
- ppp_graphics_3d_impl_->Graphics3DContextLost(instance);
+ if (ppp_graphics_3d_target())
+ ppp_graphics_3d_target()->Graphics3DContextLost(instance);
}
} // namespace proxy
diff --git a/ppapi/proxy/ppp_graphics_3d_proxy.h b/ppapi/proxy/ppp_graphics_3d_proxy.h
index e340424..eb3d3b0 100644
--- a/ppapi/proxy/ppp_graphics_3d_proxy.h
+++ b/ppapi/proxy/ppp_graphics_3d_proxy.h
@@ -16,24 +16,21 @@ namespace proxy {
class PPP_Graphics3D_Proxy : public InterfaceProxy {
public:
- PPP_Graphics3D_Proxy(Dispatcher* dispatcher);
+ PPP_Graphics3D_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPP_Graphics3D_Proxy();
static const Info* GetInfo();
+ const PPP_Graphics3D* ppp_graphics_3d_target() const {
+ return reinterpret_cast<const PPP_Graphics3D*>(target_interface());
+ }
+
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
private:
// Message handlers.
void OnMsgContextLost(PP_Instance instance);
-
- // When this proxy is in the plugin side, this value caches the interface
- // pointer so we don't have to retrieve it from the dispatcher each time.
- // In the host, this value is always NULL.
- const PPP_Graphics3D* ppp_graphics_3d_impl_;
-
- DISALLOW_COPY_AND_ASSIGN(PPP_Graphics3D_Proxy);
};
} // namespace proxy
diff --git a/ppapi/proxy/ppp_input_event_proxy.cc b/ppapi/proxy/ppp_input_event_proxy.cc
index 7d72dfe..a8843f5 100644
--- a/ppapi/proxy/ppp_input_event_proxy.cc
+++ b/ppapi/proxy/ppp_input_event_proxy.cc
@@ -11,6 +11,7 @@
#include "ppapi/proxy/plugin_dispatcher.h"
#include "ppapi/proxy/plugin_resource_tracker.h"
#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/proxy/ppb_input_event_proxy.h"
#include "ppapi/shared_impl/input_event_impl.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppb_input_event_api.h"
@@ -52,19 +53,16 @@ static const PPP_InputEvent input_event_interface = {
&HandleInputEvent
};
-InterfaceProxy* CreateInputEventProxy(Dispatcher* dispatcher) {
- return new PPP_InputEvent_Proxy(dispatcher);
+InterfaceProxy* CreateInputEventProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPP_InputEvent_Proxy(dispatcher, target_interface);
}
} // namespace
-PPP_InputEvent_Proxy::PPP_InputEvent_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
- ppp_input_event_impl_(NULL) {
- if (dispatcher->IsPlugin()) {
- ppp_input_event_impl_ = static_cast<const PPP_InputEvent*>(
- dispatcher->local_get_interface()(PPP_INPUT_EVENT_INTERFACE));
- }
+PPP_InputEvent_Proxy::PPP_InputEvent_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
}
PPP_InputEvent_Proxy::~PPP_InputEvent_Proxy() {
@@ -98,7 +96,7 @@ void PPP_InputEvent_Proxy::OnMsgHandleInputEvent(PP_Instance instance,
const InputEventData& data) {
scoped_refptr<InputEventImpl> resource(new InputEventImpl(
InputEventImpl::InitAsProxy(), instance, data));
- ppp_input_event_impl_->HandleInputEvent(instance, resource->pp_resource());
+ ppp_input_event_target()->HandleInputEvent(instance, resource->pp_resource());
}
void PPP_InputEvent_Proxy::OnMsgHandleFilteredInputEvent(
@@ -107,8 +105,8 @@ void PPP_InputEvent_Proxy::OnMsgHandleFilteredInputEvent(
PP_Bool* result) {
scoped_refptr<InputEventImpl> resource(new InputEventImpl(
InputEventImpl::InitAsProxy(), instance, data));
- *result = ppp_input_event_impl_->HandleInputEvent(instance,
- resource->pp_resource());
+ *result = ppp_input_event_target()->HandleInputEvent(instance,
+ resource->pp_resource());
}
} // namespace proxy
diff --git a/ppapi/proxy/ppp_input_event_proxy.h b/ppapi/proxy/ppp_input_event_proxy.h
index ffe5e868..e286250 100644
--- a/ppapi/proxy/ppp_input_event_proxy.h
+++ b/ppapi/proxy/ppp_input_event_proxy.h
@@ -18,11 +18,15 @@ namespace proxy {
class PPP_InputEvent_Proxy : public InterfaceProxy {
public:
- PPP_InputEvent_Proxy(Dispatcher* dispatcher);
+ PPP_InputEvent_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPP_InputEvent_Proxy();
static const Info* GetInfo();
+ const PPP_InputEvent* ppp_input_event_target() const {
+ return static_cast<const PPP_InputEvent*>(target_interface());
+ }
+
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
@@ -33,13 +37,6 @@ class PPP_InputEvent_Proxy : public InterfaceProxy {
void OnMsgHandleFilteredInputEvent(PP_Instance instance,
const ppapi::InputEventData& data,
PP_Bool* result);
-
- // When this proxy is in the plugin side, this value caches the interface
- // pointer so we don't have to retrieve it from the dispatcher each time.
- // In the host, this value is always NULL.
- const PPP_InputEvent* ppp_input_event_impl_;
-
- DISALLOW_COPY_AND_ASSIGN(PPP_InputEvent_Proxy);
};
} // namespace proxy
diff --git a/ppapi/proxy/ppp_instance_private_proxy.cc b/ppapi/proxy/ppp_instance_private_proxy.cc
index 82057a6..4ecd6a6 100644
--- a/ppapi/proxy/ppp_instance_private_proxy.cc
+++ b/ppapi/proxy/ppp_instance_private_proxy.cc
@@ -30,19 +30,16 @@ static const PPP_Instance_Private instance_private_interface = {
&GetInstanceObject
};
-InterfaceProxy* CreateInstancePrivateProxy(Dispatcher* dispatcher) {
- return new PPP_Instance_Private_Proxy(dispatcher);
+InterfaceProxy* CreateInstancePrivateProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPP_Instance_Private_Proxy(dispatcher, target_interface);
}
} // namespace
-PPP_Instance_Private_Proxy::PPP_Instance_Private_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
- ppp_instance_private_impl_(NULL) {
- if (dispatcher->IsPlugin()) {
- ppp_instance_private_impl_ = static_cast<const PPP_Instance_Private*>(
- dispatcher->local_get_interface()(PPP_INSTANCE_PRIVATE_INTERFACE));
- }
+PPP_Instance_Private_Proxy::PPP_Instance_Private_Proxy(
+ Dispatcher* dispatcher, const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
}
PPP_Instance_Private_Proxy::~PPP_Instance_Private_Proxy() {
@@ -74,7 +71,7 @@ void PPP_Instance_Private_Proxy::OnMsgGetInstanceObject(
PP_Instance instance,
SerializedVarReturnValue result) {
result.Return(dispatcher(),
- ppp_instance_private_impl_->GetInstanceObject(instance));
+ ppp_instance_private_target()->GetInstanceObject(instance));
}
} // namespace proxy
diff --git a/ppapi/proxy/ppp_instance_private_proxy.h b/ppapi/proxy/ppp_instance_private_proxy.h
index 1759eb9..afab722 100644
--- a/ppapi/proxy/ppp_instance_private_proxy.h
+++ b/ppapi/proxy/ppp_instance_private_proxy.h
@@ -20,11 +20,16 @@ class SerializedVarReturnValue;
class PPP_Instance_Private_Proxy : public InterfaceProxy {
public:
- PPP_Instance_Private_Proxy(Dispatcher* dispatcher);
+ PPP_Instance_Private_Proxy(Dispatcher* dispatcher,
+ const void* target_interface);
virtual ~PPP_Instance_Private_Proxy();
static const Info* GetInfo();
+ const PPP_Instance_Private* ppp_instance_private_target() const {
+ return reinterpret_cast<const PPP_Instance_Private*>(target_interface());
+ }
+
private:
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
@@ -32,13 +37,6 @@ class PPP_Instance_Private_Proxy : public InterfaceProxy {
// Message handlers.
void OnMsgGetInstanceObject(PP_Instance instance,
SerializedVarReturnValue result);
-
- // When this proxy is in the plugin side, this value caches the interface
- // pointer so we don't have to retrieve it from the dispatcher each time.
- // In the host, this value is always NULL.
- const PPP_Instance_Private* ppp_instance_private_impl_;
-
- DISALLOW_COPY_AND_ASSIGN(PPP_Instance_Private_Proxy);
};
} // namespace proxy
diff --git a/ppapi/proxy/ppp_instance_proxy.cc b/ppapi/proxy/ppp_instance_proxy.cc
index aa4b7e7..1da10be 100644
--- a/ppapi/proxy/ppp_instance_proxy.cc
+++ b/ppapi/proxy/ppp_instance_proxy.cc
@@ -50,7 +50,7 @@ void DidChangeView(PP_Instance instance,
HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
const PPB_Fullscreen_Dev* fullscreen_interface =
static_cast<const PPB_Fullscreen_Dev*>(
- dispatcher->local_get_interface()(PPB_FULLSCREEN_DEV_INTERFACE));
+ dispatcher->GetLocalInterface(PPB_FULLSCREEN_DEV_INTERFACE));
DCHECK(fullscreen_interface);
PP_Bool fullscreen = fullscreen_interface->IsFullscreen(instance);
dispatcher->Send(
@@ -73,7 +73,7 @@ PP_Bool HandleDocumentLoad(PP_Instance instance,
// Set up the URLLoader for proxying.
PPB_URLLoader_Proxy* url_loader_proxy = static_cast<PPB_URLLoader_Proxy*>(
- dispatcher->GetInterfaceProxy(INTERFACE_ID_PPB_URL_LOADER));
+ dispatcher->GetOrCreatePPBInterfaceProxy(INTERFACE_ID_PPB_URL_LOADER));
url_loader_proxy->PrepareURLLoaderForSendingToPlugin(url_loader);
// PluginResourceTracker in the plugin process assumes that resources that it
@@ -83,7 +83,7 @@ PP_Bool HandleDocumentLoad(PP_Instance instance,
// Please also see comments in PPP_Instance_Proxy::OnMsgHandleDocumentLoad()
// about releasing of this extra reference.
const PPB_Core* core = reinterpret_cast<const PPB_Core*>(
- dispatcher->local_get_interface()(PPB_CORE_INTERFACE));
+ dispatcher->GetLocalInterface(PPB_CORE_INTERFACE));
if (!core) {
NOTREACHED();
return PP_FALSE;
@@ -105,21 +105,16 @@ static const PPP_Instance_1_0 instance_interface_1_0 = {
&HandleDocumentLoad
};
-InterfaceProxy* CreateInstanceProxy(Dispatcher* dispatcher) {
- return new PPP_Instance_Proxy(dispatcher);
+template <class PPP_Instance_Type>
+InterfaceProxy* CreateInstanceProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPP_Instance_Proxy(
+ dispatcher,
+ static_cast<const PPP_Instance_Type*>(target_interface));
}
} // namespace
-PPP_Instance_Proxy::PPP_Instance_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher) {
- if (dispatcher->IsPlugin()) {
- combined_interface_.reset(
- new PPP_Instance_Combined(*static_cast<const PPP_Instance_1_0*>(
- dispatcher->local_get_interface()(PPP_INSTANCE_INTERFACE_1_0))));
- }
-}
-
PPP_Instance_Proxy::~PPP_Instance_Proxy() {
}
@@ -130,7 +125,7 @@ const InterfaceProxy::Info* PPP_Instance_Proxy::GetInfo1_0() {
PPP_INSTANCE_INTERFACE_1_0,
INTERFACE_ID_PPP_INSTANCE,
false,
- &CreateInstanceProxy
+ &CreateInstanceProxy<PPP_Instance_1_0>,
};
return &info;
}
diff --git a/ppapi/proxy/ppp_instance_proxy.h b/ppapi/proxy/ppp_instance_proxy.h
index 7b70245..f9b471c 100644
--- a/ppapi/proxy/ppp_instance_proxy.h
+++ b/ppapi/proxy/ppp_instance_proxy.h
@@ -25,7 +25,12 @@ class SerializedVarReturnValue;
class PPP_Instance_Proxy : public InterfaceProxy {
public:
- PPP_Instance_Proxy(Dispatcher* dispatcher);
+ template <class PPP_Instance_Type>
+ PPP_Instance_Proxy(Dispatcher* dispatcher,
+ const PPP_Instance_Type* target_interface)
+ : InterfaceProxy(dispatcher, static_cast<const void*>(target_interface)),
+ combined_interface_(new PPP_Instance_Combined(*target_interface)) {
+ }
virtual ~PPP_Instance_Proxy();
// Return the info for the 1.0 (latest, canonical) version of the interface.
diff --git a/ppapi/proxy/ppp_messaging_proxy.cc b/ppapi/proxy/ppp_messaging_proxy.cc
index 390794a..59f4574 100644
--- a/ppapi/proxy/ppp_messaging_proxy.cc
+++ b/ppapi/proxy/ppp_messaging_proxy.cc
@@ -37,19 +37,16 @@ static const PPP_Messaging messaging_interface = {
&HandleMessage
};
-InterfaceProxy* CreateMessagingProxy(Dispatcher* dispatcher) {
- return new PPP_Messaging_Proxy(dispatcher);
+InterfaceProxy* CreateMessagingProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPP_Messaging_Proxy(dispatcher, target_interface);
}
} // namespace
-PPP_Messaging_Proxy::PPP_Messaging_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
- ppp_messaging_impl_(NULL) {
- if (dispatcher->IsPlugin()) {
- ppp_messaging_impl_ = static_cast<const PPP_Messaging*>(
- dispatcher->local_get_interface()(PPP_MESSAGING_INTERFACE));
- }
+PPP_Messaging_Proxy::PPP_Messaging_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
}
PPP_Messaging_Proxy::~PPP_Messaging_Proxy() {
@@ -83,7 +80,7 @@ void PPP_Messaging_Proxy::OnMsgHandleMessage(
// SerializedVarReceiveInput will decrement the reference count, but we want
// to give the recipient a reference.
PluginResourceTracker::GetInstance()->var_tracker().AddRefVar(received_var);
- ppp_messaging_impl_->HandleMessage(instance, received_var);
+ ppp_messaging_target()->HandleMessage(instance, received_var);
}
} // namespace proxy
diff --git a/ppapi/proxy/ppp_messaging_proxy.h b/ppapi/proxy/ppp_messaging_proxy.h
index bc898f31..2deb40f 100644
--- a/ppapi/proxy/ppp_messaging_proxy.h
+++ b/ppapi/proxy/ppp_messaging_proxy.h
@@ -17,11 +17,15 @@ class SerializedVarReceiveInput;
class PPP_Messaging_Proxy : public InterfaceProxy {
public:
- PPP_Messaging_Proxy(Dispatcher* dispatcher);
+ PPP_Messaging_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPP_Messaging_Proxy();
static const Info* GetInfo();
+ const PPP_Messaging* ppp_messaging_target() const {
+ return static_cast<const PPP_Messaging*>(target_interface());
+ }
+
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
@@ -29,13 +33,6 @@ class PPP_Messaging_Proxy : public InterfaceProxy {
// Message handlers.
void OnMsgHandleMessage(PP_Instance instance,
SerializedVarReceiveInput data);
-
- // When this proxy is in the plugin side, this value caches the interface
- // pointer so we don't have to retrieve it from the dispatcher each time.
- // In the host, this value is always NULL.
- const PPP_Messaging* ppp_messaging_impl_;
-
- DISALLOW_COPY_AND_ASSIGN(PPP_Messaging_Proxy);
};
} // namespace proxy
diff --git a/ppapi/proxy/ppp_mouse_lock_proxy.cc b/ppapi/proxy/ppp_mouse_lock_proxy.cc
index e39a914..8980bcf 100644
--- a/ppapi/proxy/ppp_mouse_lock_proxy.cc
+++ b/ppapi/proxy/ppp_mouse_lock_proxy.cc
@@ -29,18 +29,16 @@ static const PPP_MouseLock_Dev mouse_lock_interface = {
&MouseLockLost
};
-InterfaceProxy* CreateMouseLockProxy(Dispatcher* dispatcher) {
- return new PPP_MouseLock_Proxy(dispatcher);
+InterfaceProxy* CreateMouseLockProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPP_MouseLock_Proxy(dispatcher, target_interface);
}
} // namespace
-PPP_MouseLock_Proxy::PPP_MouseLock_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher) {
- if (dispatcher->IsPlugin()) {
- ppp_mouse_lock_impl_ = static_cast<const PPP_MouseLock_Dev*>(
- dispatcher->local_get_interface()(PPP_MOUSELOCK_DEV_INTERFACE));
- }
+PPP_MouseLock_Proxy::PPP_MouseLock_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
}
PPP_MouseLock_Proxy::~PPP_MouseLock_Proxy() {
@@ -69,8 +67,8 @@ bool PPP_MouseLock_Proxy::OnMessageReceived(const IPC::Message& msg) {
}
void PPP_MouseLock_Proxy::OnMsgMouseLockLost(PP_Instance instance) {
- if (ppp_mouse_lock_impl_)
- ppp_mouse_lock_impl_->MouseLockLost(instance);
+ if (ppp_mouse_lock_target())
+ ppp_mouse_lock_target()->MouseLockLost(instance);
}
} // namespace proxy
diff --git a/ppapi/proxy/ppp_mouse_lock_proxy.h b/ppapi/proxy/ppp_mouse_lock_proxy.h
index 752e97a..cfd451c 100644
--- a/ppapi/proxy/ppp_mouse_lock_proxy.h
+++ b/ppapi/proxy/ppp_mouse_lock_proxy.h
@@ -15,24 +15,21 @@ namespace proxy {
class PPP_MouseLock_Proxy : public InterfaceProxy {
public:
- PPP_MouseLock_Proxy(Dispatcher* dispatcher);
+ PPP_MouseLock_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPP_MouseLock_Proxy();
static const Info* GetInfo();
+ const PPP_MouseLock_Dev* ppp_mouse_lock_target() const {
+ return static_cast<const PPP_MouseLock_Dev*>(target_interface());
+ }
+
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
private:
// Message handlers.
void OnMsgMouseLockLost(PP_Instance instance);
-
- // When this proxy is in the plugin side, this value caches the interface
- // pointer so we don't have to retrieve it from the dispatcher each time.
- // In the host, this value is always NULL.
- const PPP_MouseLock_Dev* ppp_mouse_lock_impl_;
-
- DISALLOW_COPY_AND_ASSIGN(PPP_MouseLock_Proxy);
};
} // namespace proxy
diff --git a/ppapi/proxy/ppp_video_decoder_proxy.cc b/ppapi/proxy/ppp_video_decoder_proxy.cc
index 325a695..35a29c0 100644
--- a/ppapi/proxy/ppp_video_decoder_proxy.cc
+++ b/ppapi/proxy/ppp_video_decoder_proxy.cc
@@ -78,19 +78,16 @@ static const PPP_VideoDecoder_Dev video_decoder_interface = {
&NotifyError
};
-InterfaceProxy* CreateVideoDecoderPPPProxy(Dispatcher* dispatcher) {
- return new PPP_VideoDecoder_Proxy(dispatcher);
+InterfaceProxy* CreateVideoDecoderPPPProxy(
+ Dispatcher* dispatcher, const void* target_interface) {
+ return new PPP_VideoDecoder_Proxy(dispatcher, target_interface);
}
} // namespace
-PPP_VideoDecoder_Proxy::PPP_VideoDecoder_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
- ppp_video_decoder_impl_(NULL) {
- if (dispatcher->IsPlugin()) {
- ppp_video_decoder_impl_ = static_cast<const PPP_VideoDecoder_Dev*>(
- dispatcher->local_get_interface()(PPP_VIDEODECODER_DEV_INTERFACE));
- }
+PPP_VideoDecoder_Proxy::PPP_VideoDecoder_Proxy(
+ Dispatcher* dispatcher, const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
}
PPP_VideoDecoder_Proxy::~PPP_VideoDecoder_Proxy() {
@@ -132,7 +129,7 @@ void PPP_VideoDecoder_Proxy::OnMsgProvidePictureBuffers(
const PP_Size& dimensions) {
PP_Resource plugin_decoder = PluginResourceTracker::GetInstance()->
PluginResourceForHostResource(decoder);
- ppp_video_decoder_impl_->ProvidePictureBuffers(
+ ppp_video_decoder_target()->ProvidePictureBuffers(
decoder.instance(), plugin_decoder, req_num_of_bufs, dimensions);
}
@@ -140,7 +137,7 @@ void PPP_VideoDecoder_Proxy::OnMsgDismissPictureBuffer(
const HostResource& decoder, int32_t picture_id) {
PP_Resource plugin_decoder = PluginResourceTracker::GetInstance()->
PluginResourceForHostResource(decoder);
- ppp_video_decoder_impl_->DismissPictureBuffer(
+ ppp_video_decoder_target()->DismissPictureBuffer(
decoder.instance(), plugin_decoder, picture_id);
}
@@ -148,7 +145,7 @@ void PPP_VideoDecoder_Proxy::OnMsgPictureReady(
const HostResource& decoder, const PP_Picture_Dev& picture) {
PP_Resource plugin_decoder = PluginResourceTracker::GetInstance()->
PluginResourceForHostResource(decoder);
- ppp_video_decoder_impl_->PictureReady(
+ ppp_video_decoder_target()->PictureReady(
decoder.instance(), plugin_decoder, picture);
}
@@ -156,7 +153,7 @@ void PPP_VideoDecoder_Proxy::OnMsgNotifyEndOfStream(
const HostResource& decoder) {
PP_Resource plugin_decoder = PluginResourceTracker::GetInstance()->
PluginResourceForHostResource(decoder);
- ppp_video_decoder_impl_->EndOfStream(decoder.instance(),
+ ppp_video_decoder_target()->EndOfStream(decoder.instance(),
plugin_decoder);
}
@@ -164,7 +161,7 @@ void PPP_VideoDecoder_Proxy::OnMsgNotifyError(
const HostResource& decoder, PP_VideoDecodeError_Dev error) {
PP_Resource plugin_decoder = PluginResourceTracker::GetInstance()->
PluginResourceForHostResource(decoder);
- ppp_video_decoder_impl_->NotifyError(
+ ppp_video_decoder_target()->NotifyError(
decoder.instance(), plugin_decoder, error);
}
diff --git a/ppapi/proxy/ppp_video_decoder_proxy.h b/ppapi/proxy/ppp_video_decoder_proxy.h
index e12c668..84346ba 100644
--- a/ppapi/proxy/ppp_video_decoder_proxy.h
+++ b/ppapi/proxy/ppp_video_decoder_proxy.h
@@ -18,11 +18,15 @@ namespace proxy {
class PPP_VideoDecoder_Proxy : public InterfaceProxy {
public:
- PPP_VideoDecoder_Proxy(Dispatcher* dispatcher);
+ PPP_VideoDecoder_Proxy(Dispatcher* dispatcher, const void* target_interface);
virtual ~PPP_VideoDecoder_Proxy();
static const Info* GetInfo();
+ const PPP_VideoDecoder_Dev* ppp_video_decoder_target() const {
+ return static_cast<const PPP_VideoDecoder_Dev*>(target_interface());
+ }
+
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
@@ -39,11 +43,6 @@ class PPP_VideoDecoder_Proxy : public InterfaceProxy {
void OnMsgNotifyError(const ppapi::HostResource& decoder,
PP_VideoDecodeError_Dev error);
- // When this proxy is in the plugin side, this value caches the interface
- // pointer so we don't have to retrieve it from the dispatcher each time.
- // In the host, this value is always NULL.
- const PPP_VideoDecoder_Dev* ppp_video_decoder_impl_;
-
DISALLOW_COPY_AND_ASSIGN(PPP_VideoDecoder_Proxy);
};
diff --git a/ppapi/proxy/resource_creation_proxy.cc b/ppapi/proxy/resource_creation_proxy.cc
index f3ee425..0a0c791 100644
--- a/ppapi/proxy/resource_creation_proxy.cc
+++ b/ppapi/proxy/resource_creation_proxy.cc
@@ -45,17 +45,12 @@ namespace ppapi {
namespace proxy {
ResourceCreationProxy::ResourceCreationProxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher) {
+ : dispatcher_(dispatcher) {
}
ResourceCreationProxy::~ResourceCreationProxy() {
}
-// static
-InterfaceProxy* ResourceCreationProxy::Create(Dispatcher* dispatcher) {
- return new ResourceCreationProxy(dispatcher);
-}
-
ResourceCreationAPI* ResourceCreationProxy::AsResourceCreationAPI() {
return this;
}
@@ -342,7 +337,7 @@ PP_Resource ResourceCreationProxy::CreateWheelInputEvent(
}
bool ResourceCreationProxy::Send(IPC::Message* msg) {
- return dispatcher()->Send(msg);
+ return dispatcher_->Send(msg);
}
bool ResourceCreationProxy::OnMessageReceived(const IPC::Message& msg) {
@@ -400,14 +395,14 @@ void ResourceCreationProxy::OnMsgCreateImageData(
// Get the shared memory handle.
const PPB_ImageDataTrusted* trusted =
reinterpret_cast<const PPB_ImageDataTrusted*>(
- dispatcher()->local_get_interface()(PPB_IMAGEDATA_TRUSTED_INTERFACE));
+ dispatcher_->GetLocalInterface(PPB_IMAGEDATA_TRUSTED_INTERFACE));
uint32_t byte_count = 0;
if (trusted) {
int32_t handle;
if (trusted->GetSharedMemory(resource, &handle, &byte_count) == PP_OK) {
#if defined(OS_WIN)
ImageHandle ih = ImageData::HandleFromInt(handle);
- *result_image_handle = dispatcher()->ShareHandleWithRemote(ih, false);
+ *result_image_handle = dispatcher_->ShareHandleWithRemote(ih, false);
#else
*result_image_handle = ImageData::HandleFromInt(handle);
#endif
diff --git a/ppapi/proxy/resource_creation_proxy.h b/ppapi/proxy/resource_creation_proxy.h
index 1db9164..0f1589b 100644
--- a/ppapi/proxy/resource_creation_proxy.h
+++ b/ppapi/proxy/resource_creation_proxy.h
@@ -11,8 +11,8 @@
#include "ipc/ipc_channel.h"
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_instance.h"
-#include "ppapi/proxy/interface_proxy.h"
#include "ppapi/proxy/serialized_structs.h"
+#include "ppapi/shared_impl/function_group_base.h"
#include "ppapi/thunk/resource_creation_api.h"
struct PP_Size;
@@ -25,16 +25,14 @@ namespace proxy {
class Dispatcher;
-class ResourceCreationProxy : public InterfaceProxy,
- public thunk::ResourceCreationAPI {
+class ResourceCreationProxy : public FunctionGroupBase,
+ public thunk::ResourceCreationAPI,
+ public IPC::Channel::Listener,
+ public IPC::Message::Sender {
public:
explicit ResourceCreationProxy(Dispatcher* dispatcher);
virtual ~ResourceCreationProxy();
- // Factory function used for registration (normal code can just use the
- // constructor).
- static InterfaceProxy* Create(Dispatcher* dispatcher);
-
virtual thunk::ResourceCreationAPI* AsResourceCreationAPI() OVERRIDE;
// ResourceCreationAPI (called in plugin).
@@ -151,6 +149,8 @@ class ResourceCreationProxy : public InterfaceProxy,
std::string* image_data_desc,
ImageHandle* result_image_handle);
+ Dispatcher* dispatcher_;
+
DISALLOW_COPY_AND_ASSIGN(ResourceCreationProxy);
};
diff --git a/ppapi/thunk/enter.cc b/ppapi/thunk/enter.cc
deleted file mode 100644
index da3f85c..0000000
--- a/ppapi/thunk/enter.cc
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ppapi/thunk/enter.h"
-
-#include "ppapi/thunk/ppb_instance_api.h"
-#include "ppapi/thunk/resource_creation_api.h"
-
-namespace ppapi {
-namespace thunk {
-
-EnterResourceCreation::EnterResourceCreation(PP_Instance instance)
- : EnterFunctionNoLock<ResourceCreationAPI>(instance, true) {
-}
-
-EnterResourceCreation::~EnterResourceCreation() {
-}
-
-EnterInstance::EnterInstance(PP_Instance instance)
- : EnterFunctionNoLock<PPB_Instance_FunctionAPI>(instance, true) {
-}
-
-EnterInstance::~EnterInstance() {
-}
-
-} // namespace thunk
-} // namespace ppapi
diff --git a/ppapi/thunk/enter.h b/ppapi/thunk/enter.h
index 45cee70..e83a1a1 100644
--- a/ppapi/thunk/enter.h
+++ b/ppapi/thunk/enter.h
@@ -12,7 +12,6 @@
#include "ppapi/shared_impl/resource.h"
#include "ppapi/shared_impl/tracker_base.h"
#include "ppapi/shared_impl/resource_tracker.h"
-#include "ppapi/thunk/ppapi_thunk_export.h"
namespace ppapi {
namespace thunk {
@@ -129,26 +128,6 @@ class EnterResourceNoLock : public EnterResource<ResourceT> {
}
};
-// Simpler wrapper to enter the resource creation API. This is used for every
-// class so we have this helper function to save template instantiations and
-// typing.
-class PPAPI_THUNK_EXPORT EnterResourceCreation
- : public EnterFunctionNoLock<ResourceCreationAPI> {
- public:
- EnterResourceCreation(PP_Instance instance);
- ~EnterResourceCreation();
-};
-
-// Simpler wrapper to enter the instance API from proxy code. This is used for
-// many interfaces so we have this helper function to save template
-// instantiations and typing.
-class PPAPI_THUNK_EXPORT EnterInstance
- : public EnterFunctionNoLock<PPB_Instance_FunctionAPI> {
- public:
- EnterInstance(PP_Instance instance);
- ~EnterInstance();
-};
-
} // namespace thunk
} // namespace ppapi
diff --git a/ppapi/thunk/interfaces_postamble.h b/ppapi/thunk/interfaces_postamble.h
deleted file mode 100644
index cebfe74..0000000
--- a/ppapi/thunk/interfaces_postamble.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Cleans up after interfaces_preamble.h, see that file for more.
-
-#ifdef UNDEFINE_PROXIED_API
-#undef UNDEFINE_PROXIED_API
-#undef PROXIED_API
-#endif
-
-#ifdef UNDEFINE_UNPROXIED_API
-#undef UNDEFINE_UNPROXIED_API
-#undef UNPROXIED_API
-#endif
-
-#ifdef UNDEFINE_PROXIED_IFACE
-#undef UNDEFINE_PROXIED_IFACE
-#undef PROXIED_IFACE
-#endif
-
-#ifdef UNDEFINE_UNPROXIED_IFACE
-#undef UNDEFINE_UNPROXIED_IFACE
-#undef UNPROXIED_IFACE
-#endif
diff --git a/ppapi/thunk/interfaces_ppb_private.h b/ppapi/thunk/interfaces_ppb_private.h
deleted file mode 100644
index 19e9065..0000000
--- a/ppapi/thunk/interfaces_ppb_private.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Please see inteface_ppb_public_stable for the documentation on the format of
-// this file.
-
-#include "ppapi/thunk/interfaces_preamble.h"
-
-PROXIED_API(PPB_Broker)
-
-PROXIED_IFACE(PPB_Broker, PPB_BROKER_TRUSTED_INTERFACE_0_2, PPB_Broker)
-
-#include "ppapi/thunk/interfaces_postamble.h"
diff --git a/ppapi/thunk/interfaces_ppb_public_dev.h b/ppapi/thunk/interfaces_ppb_public_dev.h
deleted file mode 100644
index 3e202a5..0000000
--- a/ppapi/thunk/interfaces_ppb_public_dev.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Please see inteface_ppb_public_stable for the documentation on the format of
-// this file.
-
-#include "ppapi/thunk/interfaces_preamble.h"
-
-PROXIED_API(PPB_Buffer)
-PROXIED_API(PPB_CharSet)
-PROXIED_API(PPB_Context3D)
-PROXIED_API(PPB_CursorControl)
-PROXIED_API(PPB_FileChooser)
-PROXIED_API(PPB_Font)
-PROXIED_API(PPB_Graphics3D)
-PROXIED_API(PPB_Surface3D)
-PROXIED_API(PPB_VideoCapture)
-PROXIED_API(PPB_VideoDecoder)
-
-PROXIED_IFACE(PPB_Buffer, PPB_BUFFER_DEV_INTERFACE_0_4, PPB_Buffer_Dev)
-PROXIED_IFACE(PPB_CharSet, PPB_CHAR_SET_DEV_INTERFACE_0_4, PPB_CharSet_Dev)
-PROXIED_IFACE(PPB_Context3D, PPB_CONTEXT_3D_DEV_INTERFACE_0_1,
- PPB_Context3D_Dev)
-PROXIED_IFACE(PPB_Context3D, PPB_GLES_CHROMIUM_TEXTURE_MAPPING_DEV_INTERFACE,
- PPB_GLESChromiumTextureMapping_Dev)
-PROXIED_IFACE(PPB_CursorControl, PPB_CURSOR_CONTROL_DEV_INTERFACE_0_4,
- PPB_CursorControl_Dev)
-PROXIED_IFACE(PPB_FileChooser, PPB_FILECHOOSER_DEV_INTERFACE_0_5,
- PPB_FileChooser_Dev)
-PROXIED_IFACE(PPB_Font, PPB_FONT_DEV_INTERFACE_0_6, PPB_Font_Dev)
-PROXIED_IFACE(PPB_Instance, PPB_CONSOLE_DEV_INTERFACE, PPB_Console_Dev)
-PROXIED_IFACE(PPB_Instance, PPB_MOUSELOCK_DEV_INTERFACE_0_1,
- PPB_MouseLock_Dev)
-PROXIED_IFACE(PPB_Surface3D, PPB_SURFACE_3D_DEV_INTERFACE_0_2,
- PPB_Surface3D_Dev)
-PROXIED_IFACE(PPB_VideoCapture, PPB_VIDEO_CAPTURE_DEV_INTERFACE_0_1,
- PPB_VideoCapture_Dev)
-PROXIED_IFACE(PPB_VideoDecoder, PPB_VIDEODECODER_DEV_INTERFACE_0_16,
- PPB_VideoDecoder_Dev)
-
-#include "ppapi/thunk/interfaces_postamble.h"
diff --git a/ppapi/thunk/interfaces_ppb_public_stable.h b/ppapi/thunk/interfaces_ppb_public_stable.h
deleted file mode 100644
index 579ce15..0000000
--- a/ppapi/thunk/interfaces_ppb_public_stable.h
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ppapi/thunk/interfaces_preamble.h"
-
-// This file contains lists of interfaces. It's intended to be included by
-// another file which defines implementations of the macros. This allows files
-// to do specific registration tasks for each supported interface.
-
-
-// Api categories
-// --------------
-// Enumerates the categories of APIs. These correspnd to the *_api.h files in
-// this directory. One API may implement one or more actual interfaces.
-//
-// For PROXIED_APIs, these also correspond to *_Proxy objects. The proxied ones
-// define factory functions for each of these classes. UNPROXIED_APIs are ones
-// that exist in the webkit/plugins/ppapi/*_impl.h, but not in the proxy.
-PROXIED_API(PPB_Audio)
-// AudioConfig isn't proxied in the normal way, we have only local classes and
-// serialize it to a struct when we need it on the host side.
-UNPROXIED_API(PPB_AudioConfig)
-PROXIED_API(PPB_Core)
-UNPROXIED_API(PPB_FileIO)
-PROXIED_API(PPB_FileRef)
-PROXIED_API(PPB_FileSystem)
-PROXIED_API(PPB_Graphics2D)
-UNPROXIED_API(PPB_ImageData)
-PROXIED_API(PPB_Instance)
-PROXIED_API(PPB_URLLoader)
-PROXIED_API(PPB_URLResponseInfo)
-
-// Interfaces
-// ----------
-// Enumerates interfaces as (api_name, interface_name, interface_struct).
-//
-// The api_name corresponds to the class in the list above for the object
-// that implements the API. Some things may be special and aren't implemented
-// by any specific API object, and we use "NoAPIName" for those. Implementors
-// of these macros should handle this case. There can be more than one line
-// referring to the same api_name (typically different versions of the
-// same interface).
-//
-// The interface_name is the string that corresponds to the interface.
-//
-// The interface_struct is the typename of the struct corresponding to the
-// interface string.
-PROXIED_IFACE(PPB_Audio, PPB_AUDIO_INTERFACE_1_0, PPB_Audio)
-// This has no corresponding _Proxy object since it does no IPC.
-PROXIED_IFACE(NoAPIName, PPB_AUDIO_CONFIG_INTERFACE_1_0, PPB_AudioConfig)
-// Note: Core is special and is registered manually.
-UNPROXIED_IFACE(PPB_FileIO, PPB_FILEIO_INTERFACE_1_0, PPB_FileIO)
-PROXIED_IFACE(PPB_FileRef, PPB_FILEREF_INTERFACE_1_0, PPB_FileRef)
-PROXIED_IFACE(PPB_FileSystem, PPB_FILESYSTEM_INTERFACE_1_0, PPB_FileSystem)
-PROXIED_IFACE(PPB_Graphics2D, PPB_GRAPHICS_2D_INTERFACE_1_0, PPB_Graphics2D)
-PROXIED_IFACE(PPB_Graphics3D, PPB_GRAPHICS_3D_INTERFACE_1_0, PPB_Graphics3D)
-// ImageData doesn't have a normal _Proxy object since it only uses Create
-// to proxy, and that happens in the ResourceCreationAPI.
-PROXIED_IFACE(NoAPIName, PPB_IMAGEDATA_INTERFACE_1_0, PPB_ImageData)
-PROXIED_IFACE(PPB_Instance, PPB_INSTANCE_INTERFACE_1_0, PPB_Instance)
-PROXIED_IFACE(NoAPIName, PPB_INPUT_EVENT_INTERFACE_1_0, PPB_InputEvent)
-PROXIED_IFACE(NoAPIName, PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0,
- PPB_KeyboardInputEvent)
-PROXIED_IFACE(NoAPIName, PPB_MOUSE_INPUT_EVENT_INTERFACE_1_0,
- PPB_MouseInputEvent_1_0)
-PROXIED_IFACE(NoAPIName, PPB_MOUSE_INPUT_EVENT_INTERFACE_1_1,
- PPB_MouseInputEvent)
-PROXIED_IFACE(NoAPIName, PPB_WHEEL_INPUT_EVENT_INTERFACE_1_0,
- PPB_WheelInputEvent)
-PROXIED_IFACE(PPB_Instance, PPB_MESSAGING_INTERFACE_1_0, PPB_Messaging)
-PROXIED_IFACE(PPB_URLLoader, PPB_URLLOADER_INTERFACE_1_0, PPB_URLLoader)
-PROXIED_IFACE(NoAPIName, PPB_URLREQUESTINFO_INTERFACE_1_0, PPB_URLRequestInfo)
-PROXIED_IFACE(PPB_URLResponseInfo, PPB_URLRESPONSEINFO_INTERFACE_1_0,
- PPB_URLResponseInfo)
-// Note: PPB_Var is special and registered manually.
-
-#include "ppapi/thunk/interfaces_postamble.h"
diff --git a/ppapi/thunk/interfaces_preamble.h b/ppapi/thunk/interfaces_preamble.h
deleted file mode 100644
index 7fe1d77..0000000
--- a/ppapi/thunk/interfaces_preamble.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// This file defines empty versions of the macros used in the interfaces_*.h
-// files, as long as they aren't already defined. This allows users of those
-// files to only implement the macros they need, and everything else will
-// compile.
-//
-// Include this file at the top, and interfaces_postamble.h at the bottom. The
-// postamble will clean up these definitions.
-
-#ifndef PROXIED_API
-#define PROXIED_API(api_name)
-#define UNDEFINE_PROXIED_API
-#endif
-
-#ifndef UNPROXIED_API
-#define UNPROXIED_API(api_name)
-#define UNDEFINE_UNPROXIED_API
-#endif
-
-#ifndef PROXIED_IFACE
-#define PROXIED_IFACE(api_name, iface_str, iface_struct)
-#define UNDEFINE_PROXIED_IFACE
-#endif
-
-#ifndef UNPROXIED_IFACE
-#define UNPROXIED_IFACE(api_name, iface_str, iface_struct)
-#define UNDEFINE_UNPROXIED_IFACE
-#endif
diff --git a/ppapi/thunk/ppb_buffer_thunk.cc b/ppapi/thunk/ppb_buffer_thunk.cc
index 1772048..cf4952c 100644
--- a/ppapi/thunk/ppb_buffer_thunk.cc
+++ b/ppapi/thunk/ppb_buffer_thunk.cc
@@ -57,7 +57,7 @@ const PPB_Buffer_Dev g_ppb_buffer_thunk = {
} // namespace
-const PPB_Buffer_Dev* GetPPB_Buffer_Dev_Thunk() {
+const PPB_Buffer_Dev* GetPPB_Buffer_Thunk() {
return &g_ppb_buffer_thunk;
}
diff --git a/ppapi/thunk/ppb_char_set_thunk.cc b/ppapi/thunk/ppb_char_set_thunk.cc
index 1b02038..bc36bad 100644
--- a/ppapi/thunk/ppb_char_set_thunk.cc
+++ b/ppapi/thunk/ppb_char_set_thunk.cc
@@ -54,7 +54,7 @@ const PPB_CharSet_Dev g_ppb_char_set_thunk = {
} // namespace
-const PPB_CharSet_Dev* GetPPB_CharSet_Dev_Thunk() {
+const PPB_CharSet_Dev* GetPPB_CharSet_Thunk() {
return &g_ppb_char_set_thunk;
}
diff --git a/ppapi/thunk/ppb_console_thunk.cc b/ppapi/thunk/ppb_console_thunk.cc
deleted file mode 100644
index 509c128..0000000
--- a/ppapi/thunk/ppb_console_thunk.cc
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ppapi/c/dev/ppb_console_dev.h"
-#include "ppapi/thunk/thunk.h"
-#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/ppb_instance_api.h"
-
-namespace ppapi {
-namespace thunk {
-
-namespace {
-
-void Log(PP_Instance instance, PP_LogLevel_Dev level, struct PP_Var value) {
- EnterInstance enter(instance);
- if (enter.succeeded())
- return enter.functions()->Log(instance, level, value);
-}
-
-void LogWithSource(PP_Instance instance,
- PP_LogLevel_Dev level,
- PP_Var source,
- PP_Var value) {
- EnterInstance enter(instance);
- if (enter.succeeded())
- return enter.functions()->LogWithSource(instance, level, source, value);
-}
-
-const PPB_Console_Dev g_ppb_console_thunk = {
- &Log,
- &LogWithSource
-};
-
-} // namespace
-
-const PPB_Console_Dev* GetPPB_Console_Dev_Thunk() {
- return &g_ppb_console_thunk;
-}
-
-} // namespace thunk
-} // namespace ppapi
diff --git a/ppapi/thunk/ppb_context_3d_thunk.cc b/ppapi/thunk/ppb_context_3d_thunk.cc
index 200e044..cbb035a 100644
--- a/ppapi/thunk/ppb_context_3d_thunk.cc
+++ b/ppapi/thunk/ppb_context_3d_thunk.cc
@@ -64,7 +64,7 @@ const PPB_Context3D_Dev g_ppb_context_3d_thunk = {
} // namespace
-const PPB_Context3D_Dev* GetPPB_Context3D_Dev_Thunk() {
+const PPB_Context3D_Dev* GetPPB_Context3D_Thunk() {
return &g_ppb_context_3d_thunk;
}
diff --git a/ppapi/thunk/ppb_cursor_control_thunk.cc b/ppapi/thunk/ppb_cursor_control_thunk.cc
index b1f5409..56ba078 100644
--- a/ppapi/thunk/ppb_cursor_control_thunk.cc
+++ b/ppapi/thunk/ppb_cursor_control_thunk.cc
@@ -59,7 +59,7 @@ const PPB_CursorControl_Dev g_ppb_cursor_control_thunk = {
} // namespace
-const PPB_CursorControl_Dev* GetPPB_CursorControl_Dev_Thunk() {
+const PPB_CursorControl_Dev* GetPPB_CursorControl_Thunk() {
return &g_ppb_cursor_control_thunk;
}
diff --git a/ppapi/thunk/ppb_directory_reader_thunk.cc b/ppapi/thunk/ppb_directory_reader_thunk.cc
index f8e95537..c631194 100644
--- a/ppapi/thunk/ppb_directory_reader_thunk.cc
+++ b/ppapi/thunk/ppb_directory_reader_thunk.cc
@@ -46,7 +46,7 @@ const PPB_DirectoryReader_Dev g_ppb_directory_reader_thunk = {
} // namespace
-const PPB_DirectoryReader_Dev* GetPPB_DirectoryReader_Dev_Thunk() {
+const PPB_DirectoryReader_Dev* GetPPB_DirectoryReader_Thunk() {
return &g_ppb_directory_reader_thunk;
}
diff --git a/ppapi/thunk/ppb_file_chooser_thunk.cc b/ppapi/thunk/ppb_file_chooser_thunk.cc
index 774ef03..c58f052 100644
--- a/ppapi/thunk/ppb_file_chooser_thunk.cc
+++ b/ppapi/thunk/ppb_file_chooser_thunk.cc
@@ -55,7 +55,7 @@ const PPB_FileChooser_Dev g_ppb_file_chooser_thunk = {
} // namespace
-const PPB_FileChooser_Dev* GetPPB_FileChooser_Dev_Thunk() {
+const PPB_FileChooser_Dev* GetPPB_FileChooser_Thunk() {
return &g_ppb_file_chooser_thunk;
}
diff --git a/ppapi/thunk/ppb_font_thunk.cc b/ppapi/thunk/ppb_font_thunk.cc
index 841170a..ae13e01 100644
--- a/ppapi/thunk/ppb_font_thunk.cc
+++ b/ppapi/thunk/ppb_font_thunk.cc
@@ -93,7 +93,7 @@ const PPB_Font_Dev g_ppb_font_thunk = {
} // namespace
-const PPB_Font_Dev* GetPPB_Font_Dev_Thunk() {
+const PPB_Font_Dev* GetPPB_Font_Thunk() {
return &g_ppb_font_thunk;
}
diff --git a/ppapi/thunk/ppb_gles_chromium_texture_mapping_thunk.cc b/ppapi/thunk/ppb_gles_chromium_texture_mapping_thunk.cc
index 085578a..6e8e7c5 100644
--- a/ppapi/thunk/ppb_gles_chromium_texture_mapping_thunk.cc
+++ b/ppapi/thunk/ppb_gles_chromium_texture_mapping_thunk.cc
@@ -69,7 +69,7 @@ g_ppb_gles_chromium_texture_mapping_thunk = {
} // namespace
const PPB_GLESChromiumTextureMapping_Dev*
-GetPPB_GLESChromiumTextureMapping_Dev_Thunk() {
+GetPPB_GLESChromiumTextureMapping_Thunk() {
return &g_ppb_gles_chromium_texture_mapping_thunk;
}
diff --git a/ppapi/thunk/ppb_input_event_thunk.cc b/ppapi/thunk/ppb_input_event_thunk.cc
index 6028c6e..bd28495 100644
--- a/ppapi/thunk/ppb_input_event_thunk.cc
+++ b/ppapi/thunk/ppb_input_event_thunk.cc
@@ -281,7 +281,7 @@ const PPB_MouseInputEvent_1_0* GetPPB_MouseInputEvent_1_0_Thunk() {
return &g_ppb_mouse_input_event_1_0_thunk;
}
-const PPB_MouseInputEvent* GetPPB_MouseInputEvent_Thunk() {
+const PPB_MouseInputEvent* GetPPB_MouseInputEvent_1_1_Thunk() {
return &g_ppb_mouse_input_event_1_1_thunk;
}
diff --git a/ppapi/thunk/ppb_instance_api.h b/ppapi/thunk/ppb_instance_api.h
index 9a5628b..e9cacef 100644
--- a/ppapi/thunk/ppb_instance_api.h
+++ b/ppapi/thunk/ppb_instance_api.h
@@ -29,15 +29,6 @@ class PPB_Instance_FunctionAPI {
PP_Var script,
PP_Var* exception) = 0;
- // Console.
- virtual void Log(PP_Instance instance,
- int log_level,
- PP_Var value) = 0;
- virtual void LogWithSource(PP_Instance instance,
- int log_level,
- PP_Var source,
- PP_Var value) = 0;
-
// Fullscreen.
virtual PP_Bool IsFullscreen(PP_Instance instance) = 0;
virtual PP_Bool SetFullscreen(PP_Instance instance, PP_Bool fullscreen) = 0;
diff --git a/ppapi/thunk/ppb_instance_thunk.cc b/ppapi/thunk/ppb_instance_thunk.cc
index 9cc9bd5..a05f030 100644
--- a/ppapi/thunk/ppb_instance_thunk.cc
+++ b/ppapi/thunk/ppb_instance_thunk.cc
@@ -49,7 +49,7 @@ PP_Var ExecuteScript(PP_Instance instance,
return enter.functions()->ExecuteScript(instance, script, exception);
}
-const PPB_Instance g_ppb_instance_thunk = {
+const PPB_Instance_1_0 g_ppb_instance_1_0_thunk = {
&BindGraphics,
&IsFullFrame
};
@@ -62,8 +62,8 @@ const PPB_Instance_Private g_ppb_instance_private_thunk = {
} // namespace
-const PPB_Instance* GetPPB_Instance_Thunk() {
- return &g_ppb_instance_thunk;
+const PPB_Instance_1_0* GetPPB_Instance_1_0_Thunk() {
+ return &g_ppb_instance_1_0_thunk;
}
const PPB_Instance_Private* GetPPB_Instance_Private_Thunk() {
return &g_ppb_instance_private_thunk;
diff --git a/ppapi/thunk/ppb_mouse_lock_thunk.cc b/ppapi/thunk/ppb_mouse_lock_thunk.cc
index 3f1d6d3..d9116b0 100644
--- a/ppapi/thunk/ppb_mouse_lock_thunk.cc
+++ b/ppapi/thunk/ppb_mouse_lock_thunk.cc
@@ -36,7 +36,7 @@ const PPB_MouseLock_Dev g_ppb_mouse_lock_thunk = {
} // namespace
-const PPB_MouseLock_Dev* GetPPB_MouseLock_Dev_Thunk() {
+const PPB_MouseLock_Dev* GetPPB_MouseLock_Thunk() {
return &g_ppb_mouse_lock_thunk;
}
diff --git a/ppapi/thunk/ppb_surface_3d_thunk.cc b/ppapi/thunk/ppb_surface_3d_thunk.cc
index ba1df6f..e7034cb 100644
--- a/ppapi/thunk/ppb_surface_3d_thunk.cc
+++ b/ppapi/thunk/ppb_surface_3d_thunk.cc
@@ -63,7 +63,7 @@ const PPB_Surface3D_Dev g_ppb_surface_3d_thunk = {
} // namespace
-const PPB_Surface3D_Dev* GetPPB_Surface3D_Dev_Thunk() {
+const PPB_Surface3D_Dev* GetPPB_Surface3D_Thunk() {
return &g_ppb_surface_3d_thunk;
}
diff --git a/ppapi/thunk/ppb_transport_thunk.cc b/ppapi/thunk/ppb_transport_thunk.cc
index 17c572e..b245514 100644
--- a/ppapi/thunk/ppb_transport_thunk.cc
+++ b/ppapi/thunk/ppb_transport_thunk.cc
@@ -108,7 +108,7 @@ const PPB_Transport_Dev g_ppb_transport_thunk = {
} // namespace
-const PPB_Transport_Dev* GetPPB_Transport_Dev_Thunk() {
+const PPB_Transport_Dev* GetPPB_Transport_Thunk() {
return &g_ppb_transport_thunk;
}
diff --git a/ppapi/thunk/ppb_video_capture_thunk.cc b/ppapi/thunk/ppb_video_capture_thunk.cc
index f8704d0..c320cb5 100644
--- a/ppapi/thunk/ppb_video_capture_thunk.cc
+++ b/ppapi/thunk/ppb_video_capture_thunk.cc
@@ -65,7 +65,7 @@ const PPB_VideoCapture_Dev g_ppb_videocapture_thunk = {
} // namespace
-const PPB_VideoCapture_Dev* GetPPB_VideoCapture_Dev_Thunk() {
+const PPB_VideoCapture_Dev* GetPPB_VideoCapture_Thunk() {
return &g_ppb_videocapture_thunk;
}
diff --git a/ppapi/thunk/ppb_video_decoder_thunk.cc b/ppapi/thunk/ppb_video_decoder_thunk.cc
index 40b837b..b7a72d9 100644
--- a/ppapi/thunk/ppb_video_decoder_thunk.cc
+++ b/ppapi/thunk/ppb_video_decoder_thunk.cc
@@ -90,7 +90,7 @@ const PPB_VideoDecoder_Dev g_ppb_videodecoder_thunk = {
} // namespace
-const PPB_VideoDecoder_Dev* GetPPB_VideoDecoder_Dev_Thunk() {
+const PPB_VideoDecoder_Dev* GetPPB_VideoDecoder_Thunk() {
return &g_ppb_videodecoder_thunk;
}
diff --git a/ppapi/thunk/ppb_video_layer_thunk.cc b/ppapi/thunk/ppb_video_layer_thunk.cc
index ea31b9f..4a1a258 100644
--- a/ppapi/thunk/ppb_video_layer_thunk.cc
+++ b/ppapi/thunk/ppb_video_layer_thunk.cc
@@ -73,7 +73,7 @@ const PPB_VideoLayer_Dev g_ppb_videolayer_thunk = {
} // namespace
-const PPB_VideoLayer_Dev* GetPPB_VideoLayer_Dev_Thunk() {
+const PPB_VideoLayer_Dev* GetPPB_VideoLayer_Thunk() {
return &g_ppb_videolayer_thunk;
}
diff --git a/ppapi/thunk/ppb_widget_thunk.cc b/ppapi/thunk/ppb_widget_thunk.cc
index ec77352..374296b 100644
--- a/ppapi/thunk/ppb_widget_thunk.cc
+++ b/ppapi/thunk/ppb_widget_thunk.cc
@@ -54,7 +54,7 @@ const PPB_Widget_Dev g_ppb_widget_thunk = {
} // namespace
-const PPB_Widget_Dev* GetPPB_Widget_Dev_Thunk() {
+const PPB_Widget_Dev* GetPPB_Widget_Thunk() {
return &g_ppb_widget_thunk;
}
diff --git a/ppapi/thunk/thunk.h b/ppapi/thunk/thunk.h
index 47d3660..94c31a7 100644
--- a/ppapi/thunk/thunk.h
+++ b/ppapi/thunk/thunk.h
@@ -7,56 +7,55 @@
#include "ppapi/thunk/ppapi_thunk_export.h"
-// Declares a getter for the interface thunk of the form:
-//
-// const PPB_Foo* ppapi::thunk::GetPPB_Foo_Thunk();
-//
-#define IFACE(api_name, interface_name, InterfaceType) \
- struct InterfaceType; \
- namespace ppapi { namespace thunk { \
- PPAPI_THUNK_EXPORT const InterfaceType* Get##InterfaceType##_Thunk(); \
- } }
-#define PROXIED_IFACE IFACE
-#define UNPROXIED_IFACE IFACE
-
-#include "ppapi/thunk/interfaces_ppb_public_stable.h"
-#include "ppapi/thunk/interfaces_ppb_public_dev.h"
-
-#undef UNPROXIED_IFACE
-#undef PROXIED_IFACE
-#undef IFACE
-
+struct PPB_Audio;
+struct PPB_AudioConfig;
struct PPB_AudioTrusted;
struct PPB_BrokerTrusted;
struct PPB_Buffer_Dev;
struct PPB_BufferTrusted;
struct PPB_CharSet_Dev;
-struct PPB_Console_Dev;
+struct PPB_Context3D_Dev;
struct PPB_Context3DTrusted_Dev;
struct PPB_CursorControl_Dev;
struct PPB_DirectoryReader_Dev;
struct PPB_FileChooser_Dev;
+struct PPB_FileIO;
struct PPB_FileIOTrusted;
+struct PPB_FileRef;
+struct PPB_FileSystem;
struct PPB_Find_Dev;
struct PPB_Flash_Menu;
struct PPB_Flash_NetConnector;
struct PPB_Flash_TCPSocket;
struct PPB_Font_Dev;
struct PPB_Fullscreen_Dev;
+struct PPB_GLESChromiumTextureMapping_Dev;
+struct PPB_Graphics2D;
struct PPB_Graphics3D;
struct PPB_Graphics3DTrusted;
struct PPB_ImageData;
struct PPB_ImageDataTrusted;
+struct PPB_InputEvent;
+struct PPB_Instance;
struct PPB_Instance_Private;
+struct PPB_KeyboardInputEvent;
struct PPB_LayerCompositor_Dev;
+struct PPB_Messaging;
+struct PPB_MouseInputEvent_1_0;
+struct PPB_MouseInputEvent;
+struct PPB_MouseLock_Dev;
struct PPB_QueryPolicy_Dev;
struct PPB_Scrollbar_0_5_Dev;
struct PPB_Surface3D_Dev;
struct PPB_Transport_Dev;
+struct PPB_URLLoader;
struct PPB_URLLoaderTrusted;
+struct PPB_URLRequestInfo;
+struct PPB_URLResponseInfo;
struct PPB_VideoCapture_Dev;
struct PPB_VideoDecoder_Dev;
struct PPB_VideoLayer_Dev;
+struct PPB_WheelInputEvent;
struct PPB_Widget_Dev;
struct PPB_Zoom_Dev;
@@ -65,34 +64,65 @@ typedef PPB_Instance PPB_Instance_1_0;
namespace ppapi {
namespace thunk {
+PPAPI_THUNK_EXPORT const PPB_Audio* GetPPB_Audio_Thunk();
+PPAPI_THUNK_EXPORT const PPB_AudioConfig* GetPPB_AudioConfig_Thunk();
PPAPI_THUNK_EXPORT const PPB_AudioTrusted* GetPPB_AudioTrusted_Thunk();
PPAPI_THUNK_EXPORT const PPB_BrokerTrusted* GetPPB_Broker_Thunk();
+PPAPI_THUNK_EXPORT const PPB_Buffer_Dev* GetPPB_Buffer_Thunk();
PPAPI_THUNK_EXPORT const PPB_BufferTrusted* GetPPB_BufferTrusted_Thunk();
-PPAPI_THUNK_EXPORT const PPB_Console_Dev* GetPPB_Console_Dev_Thunk();
+PPAPI_THUNK_EXPORT const PPB_CharSet_Dev* GetPPB_CharSet_Thunk();
+PPAPI_THUNK_EXPORT const PPB_Context3D_Dev* GetPPB_Context3D_Thunk();
PPAPI_THUNK_EXPORT const PPB_Context3DTrusted_Dev*
GetPPB_Context3DTrusted_Thunk();
PPAPI_THUNK_EXPORT const PPB_CursorControl_Dev* GetPPB_CursorControl_Thunk();
PPAPI_THUNK_EXPORT const PPB_DirectoryReader_Dev*
- GetPPB_DirectoryReader_Dev_Thunk();
+ GetPPB_DirectoryReader_Thunk();
+PPAPI_THUNK_EXPORT const PPB_FileChooser_Dev* GetPPB_FileChooser_Thunk();
+PPAPI_THUNK_EXPORT const PPB_FileIO* GetPPB_FileIO_Thunk();
PPAPI_THUNK_EXPORT const PPB_FileIOTrusted* GetPPB_FileIOTrusted_Thunk();
+PPAPI_THUNK_EXPORT const PPB_FileRef* GetPPB_FileRef_Thunk();
+PPAPI_THUNK_EXPORT const PPB_FileSystem* GetPPB_FileSystem_Thunk();
PPAPI_THUNK_EXPORT const PPB_Find_Dev* GetPPB_Find_Thunk();
PPAPI_THUNK_EXPORT const PPB_Flash_Menu* GetPPB_Flash_Menu_Thunk();
PPAPI_THUNK_EXPORT const PPB_Flash_NetConnector*
GetPPB_Flash_NetConnector_Thunk();
PPAPI_THUNK_EXPORT const PPB_Flash_TCPSocket* GetPPB_Flash_TCPSocket_Thunk();
+PPAPI_THUNK_EXPORT const PPB_Font_Dev* GetPPB_Font_Thunk();
PPAPI_THUNK_EXPORT const PPB_Fullscreen_Dev* GetPPB_Fullscreen_Thunk();
+PPAPI_THUNK_EXPORT const PPB_GLESChromiumTextureMapping_Dev*
+ GetPPB_GLESChromiumTextureMapping_Thunk();
+PPAPI_THUNK_EXPORT const PPB_Graphics2D* GetPPB_Graphics2D_Thunk();
+PPAPI_THUNK_EXPORT const PPB_Graphics3D* GetPPB_Graphics3D_Thunk();
PPAPI_THUNK_EXPORT const PPB_Graphics3DTrusted*
GetPPB_Graphics3DTrusted_Thunk();
+PPAPI_THUNK_EXPORT const PPB_InputEvent* GetPPB_InputEvent_Thunk();
+PPAPI_THUNK_EXPORT const PPB_ImageData* GetPPB_ImageData_Thunk();
PPAPI_THUNK_EXPORT const PPB_ImageDataTrusted* GetPPB_ImageDataTrusted_Thunk();
+PPAPI_THUNK_EXPORT const PPB_Instance_1_0* GetPPB_Instance_1_0_Thunk();
PPAPI_THUNK_EXPORT const PPB_Instance_Private* GetPPB_Instance_Private_Thunk();
+PPAPI_THUNK_EXPORT const PPB_KeyboardInputEvent*
+ GetPPB_KeyboardInputEvent_Thunk();
PPAPI_THUNK_EXPORT const PPB_LayerCompositor_Dev*
GetPPB_LayerCompositor_Thunk();
PPAPI_THUNK_EXPORT const PPB_QueryPolicy_Dev* GetPPB_QueryPolicy_Thunk();
+PPAPI_THUNK_EXPORT const PPB_Messaging* GetPPB_Messaging_Thunk();
+PPAPI_THUNK_EXPORT const PPB_MouseInputEvent_1_0*
+ GetPPB_MouseInputEvent_1_0_Thunk();
+PPAPI_THUNK_EXPORT const PPB_MouseInputEvent*
+ GetPPB_MouseInputEvent_1_1_Thunk();
+PPAPI_THUNK_EXPORT const PPB_MouseLock_Dev* GetPPB_MouseLock_Thunk();
PPAPI_THUNK_EXPORT const PPB_Scrollbar_0_5_Dev* GetPPB_Scrollbar_Thunk();
-PPAPI_THUNK_EXPORT const PPB_Transport_Dev* GetPPB_Transport_Dev_Thunk();
+PPAPI_THUNK_EXPORT const PPB_Surface3D_Dev* GetPPB_Surface3D_Thunk();
+PPAPI_THUNK_EXPORT const PPB_Transport_Dev* GetPPB_Transport_Thunk();
+PPAPI_THUNK_EXPORT const PPB_URLLoader* GetPPB_URLLoader_Thunk();
PPAPI_THUNK_EXPORT const PPB_URLLoaderTrusted* GetPPB_URLLoaderTrusted_Thunk();
-PPAPI_THUNK_EXPORT const PPB_VideoLayer_Dev* GetPPB_VideoLayer_Dev_Thunk();
-PPAPI_THUNK_EXPORT const PPB_Widget_Dev* GetPPB_Widget_Dev_Thunk();
+PPAPI_THUNK_EXPORT const PPB_URLRequestInfo* GetPPB_URLRequestInfo_Thunk();
+PPAPI_THUNK_EXPORT const PPB_URLResponseInfo* GetPPB_URLResponseInfo_Thunk();
+PPAPI_THUNK_EXPORT const PPB_VideoCapture_Dev* GetPPB_VideoCapture_Thunk();
+PPAPI_THUNK_EXPORT const PPB_VideoDecoder_Dev* GetPPB_VideoDecoder_Thunk();
+PPAPI_THUNK_EXPORT const PPB_VideoLayer_Dev* GetPPB_VideoLayer_Thunk();
+PPAPI_THUNK_EXPORT const PPB_WheelInputEvent* GetPPB_WheelInputEvent_Thunk();
+PPAPI_THUNK_EXPORT const PPB_Widget_Dev* GetPPB_Widget_Thunk();
PPAPI_THUNK_EXPORT const PPB_Zoom_Dev* GetPPB_Zoom_Thunk();
} // namespace thunk
diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi
index cb126a6..1112558 100644
--- a/webkit/glue/webkit_glue.gypi
+++ b/webkit/glue/webkit_glue.gypi
@@ -225,6 +225,8 @@
'../plugins/ppapi/ppb_buffer_impl.h',
'../plugins/ppapi/ppb_char_set_impl.cc',
'../plugins/ppapi/ppb_char_set_impl.h',
+ '../plugins/ppapi/ppb_console_impl.cc',
+ '../plugins/ppapi/ppb_console_impl.h',
'../plugins/ppapi/ppb_context_3d_impl.cc',
'../plugins/ppapi/ppb_context_3d_impl.h',
'../plugins/ppapi/ppb_crypto_impl.cc',
diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc
index efb8859..aa20704 100644
--- a/webkit/plugins/ppapi/plugin_module.cc
+++ b/webkit/plugins/ppapi/plugin_module.cc
@@ -86,6 +86,7 @@
#include "webkit/plugins/ppapi/common.h"
#include "webkit/plugins/ppapi/ppapi_interface_factory.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
+#include "webkit/plugins/ppapi/ppb_console_impl.h"
#include "webkit/plugins/ppapi/ppb_crypto_impl.h"
#include "webkit/plugins/ppapi/ppb_directory_reader_impl.h"
#include "webkit/plugins/ppapi/ppb_flash_clipboard_impl.h"
@@ -227,36 +228,42 @@ const void* GetInterface(const char* name) {
if (custom_interface)
return custom_interface;
- // TODO(brettw) put these in a hash map for better performance.
- #define UNPROXIED_IFACE(api_name, iface_str, iface_struct) \
- if (strcmp(name, iface_str) == 0) \
- return ::ppapi::thunk::Get##iface_struct##_Thunk();
- #define PROXIED_IFACE(api_name, iface_str, iface_struct) \
- UNPROXIED_IFACE(api_name, iface_str, iface_struct)
-
- #include "ppapi/thunk/interfaces_ppb_public_stable.h"
- #include "ppapi/thunk/interfaces_ppb_public_dev.h"
- #include "ppapi/thunk/interfaces_ppb_private.h"
-
- #undef UNPROXIED_API
- #undef PROXIED_IFACE
-
// Please keep alphabetized by interface macro name with "special" stuff at
// the bottom.
+ if (strcmp(name, PPB_AUDIO_CONFIG_INTERFACE_1_0) == 0)
+ return ::ppapi::thunk::GetPPB_AudioConfig_Thunk();
+ if (strcmp(name, PPB_AUDIO_INTERFACE_1_0) == 0)
+ return ::ppapi::thunk::GetPPB_Audio_Thunk();
if (strcmp(name, PPB_AUDIO_TRUSTED_INTERFACE) == 0)
return ::ppapi::thunk::GetPPB_AudioTrusted_Thunk();
+ if (strcmp(name, PPB_BROKER_TRUSTED_INTERFACE) == 0)
+ return ::ppapi::thunk::GetPPB_Broker_Thunk();
+ if (strcmp(name, PPB_BUFFER_DEV_INTERFACE) == 0)
+ return ::ppapi::thunk::GetPPB_Buffer_Thunk();
if (strcmp(name, PPB_BUFFER_TRUSTED_INTERFACE) == 0)
return ::ppapi::thunk::GetPPB_BufferTrusted_Thunk();
- if (strcmp(name, PPB_CONTEXT_3D_TRUSTED_DEV_INTERFACE) == 0)
- return ::ppapi::thunk::GetPPB_Context3DTrusted_Thunk();
+ if (strcmp(name, PPB_CHAR_SET_DEV_INTERFACE) == 0)
+ return ::ppapi::thunk::GetPPB_CharSet_Thunk();
+ if (strcmp(name, PPB_CONSOLE_DEV_INTERFACE) == 0)
+ return PPB_Console_Impl::GetInterface();
if (strcmp(name, PPB_CORE_INTERFACE) == 0)
return &core_interface;
if (strcmp(name, PPB_CRYPTO_DEV_INTERFACE) == 0)
return PPB_Crypto_Impl::GetInterface();
+ if (strcmp(name, PPB_CURSOR_CONTROL_DEV_INTERFACE) == 0)
+ return ::ppapi::thunk::GetPPB_CursorControl_Thunk();
if (strcmp(name, PPB_DIRECTORYREADER_DEV_INTERFACE) == 0)
- return ::ppapi::thunk::GetPPB_DirectoryReader_Dev_Thunk();
+ return ::ppapi::thunk::GetPPB_DirectoryReader_Thunk();
+ if (strcmp(name, PPB_FILECHOOSER_DEV_INTERFACE) == 0)
+ return ::ppapi::thunk::GetPPB_FileChooser_Thunk();
+ if (strcmp(name, PPB_FILEIO_INTERFACE_1_0) == 0)
+ return ::ppapi::thunk::GetPPB_FileIO_Thunk();
if (strcmp(name, PPB_FILEIOTRUSTED_INTERFACE) == 0)
return ::ppapi::thunk::GetPPB_FileIOTrusted_Thunk();
+ if (strcmp(name, PPB_FILEREF_INTERFACE_1_0) == 0)
+ return ::ppapi::thunk::GetPPB_FileRef_Thunk();
+ if (strcmp(name, PPB_FILESYSTEM_INTERFACE_1_0) == 0)
+ return ::ppapi::thunk::GetPPB_FileSystem_Thunk();
if (strcmp(name, PPB_FIND_DEV_INTERFACE) == 0)
return ::ppapi::thunk::GetPPB_Find_Thunk();
if (strcmp(name, PPB_FLASH_INTERFACE) == 0)
@@ -271,24 +278,36 @@ const void* GetInterface(const char* name) {
return ::ppapi::thunk::GetPPB_Flash_Menu_Thunk();
if (strcmp(name, PPB_FLASH_TCPSOCKET_INTERFACE) == 0)
return ::ppapi::thunk::GetPPB_Flash_TCPSocket_Thunk();
+ if (strcmp(name, PPB_FONT_DEV_INTERFACE) == 0)
+ return ::ppapi::thunk::GetPPB_Font_Thunk();
if (strcmp(name, PPB_FULLSCREEN_DEV_INTERFACE) == 0)
return ::ppapi::thunk::GetPPB_Fullscreen_Thunk();
if (strcmp(name, PPB_GPU_BLACKLIST_INTERFACE) == 0)
return PPB_GpuBlacklist_Private_Impl::GetInterface();
- if (strcmp(name, PPB_GRAPHICS_3D_TRUSTED_INTERFACE) == 0)
- return ::ppapi::thunk::GetPPB_Graphics3DTrusted_Thunk();
+ if (strcmp(name, PPB_GRAPHICS_2D_INTERFACE_1_0) == 0)
+ return ::ppapi::thunk::GetPPB_Graphics2D_Thunk();
+ if (strcmp(name, PPB_IMAGEDATA_INTERFACE_1_0) == 0)
+ return ::ppapi::thunk::GetPPB_ImageData_Thunk();
if (strcmp(name, PPB_IMAGEDATA_TRUSTED_INTERFACE) == 0)
return ::ppapi::thunk::GetPPB_ImageDataTrusted_Thunk();
if (strcmp(name, PPB_INPUT_EVENT_INTERFACE_1_0) == 0)
return ::ppapi::thunk::GetPPB_InputEvent_Thunk();
+ if (strcmp(name, PPB_INSTANCE_INTERFACE_1_0) == 0)
+ return ::ppapi::thunk::GetPPB_Instance_1_0_Thunk();
if (strcmp(name, PPB_INSTANCE_PRIVATE_INTERFACE) == 0)
return ::ppapi::thunk::GetPPB_Instance_Private_Thunk();
- if (strcmp(name, PPB_LAYER_COMPOSITOR_DEV_INTERFACE) == 0)
- return ::ppapi::thunk::GetPPB_LayerCompositor_Thunk();
+ if (strcmp(name, PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0) == 0)
+ return ::ppapi::thunk::GetPPB_KeyboardInputEvent_Thunk();
if (strcmp(name, PPB_MEMORY_DEV_INTERFACE) == 0)
return PPB_Memory_Impl::GetInterface();
- if (strcmp(name, PPB_OPENGLES2_INTERFACE) == 0)
- return PPB_OpenGLES_Impl::GetInterface();
+ if (strcmp(name, PPB_MESSAGING_INTERFACE_1_0) == 0)
+ return ::ppapi::thunk::GetPPB_Messaging_Thunk();
+ if (strcmp(name, PPB_MOUSE_INPUT_EVENT_INTERFACE_1_0) == 0)
+ return ::ppapi::thunk::GetPPB_MouseInputEvent_1_0_Thunk();
+ if (strcmp(name, PPB_MOUSE_INPUT_EVENT_INTERFACE_1_1) == 0)
+ return ::ppapi::thunk::GetPPB_MouseInputEvent_1_1_Thunk();
+ if (strcmp(name, PPB_MOUSELOCK_DEV_INTERFACE) == 0)
+ return ::ppapi::thunk::GetPPB_MouseLock_Thunk();
if (strcmp(name, PPB_PROXY_PRIVATE_INTERFACE) == 0)
return PPB_Proxy_Impl::GetInterface();
if (strcmp(name, PPB_QUERY_POLICY_DEV_INTERFACE_0_1) == 0)
@@ -301,21 +320,52 @@ const void* GetInterface(const char* name) {
return ::ppapi::thunk::GetPPB_Scrollbar_Thunk();
if (strcmp(name, PPB_UMA_PRIVATE_INTERFACE) == 0)
return PPB_UMA_Private_Impl::GetInterface();
+ if (strcmp(name, PPB_URLLOADER_INTERFACE_1_0) == 0)
+ return ::ppapi::thunk::GetPPB_URLLoader_Thunk();
if (strcmp(name, PPB_URLLOADERTRUSTED_INTERFACE) == 0)
return ::ppapi::thunk::GetPPB_URLLoaderTrusted_Thunk();
+ if (strcmp(name, PPB_URLREQUESTINFO_INTERFACE_1_0) == 0)
+ return ::ppapi::thunk::GetPPB_URLRequestInfo_Thunk();
+ if (strcmp(name, PPB_URLRESPONSEINFO_INTERFACE_1_0) == 0)
+ return ::ppapi::thunk::GetPPB_URLResponseInfo_Thunk();
if (strcmp(name, PPB_URLUTIL_DEV_INTERFACE) == 0)
return PPB_URLUtil_Impl::GetInterface();
if (strcmp(name, PPB_VAR_DEPRECATED_INTERFACE) == 0)
return PPB_Var_Impl::GetVarDeprecatedInterface();
if (strcmp(name, PPB_VAR_INTERFACE_1_0) == 0)
return PPB_Var_Impl::GetVarInterface();
+ if (strcmp(name, PPB_VIDEODECODER_DEV_INTERFACE) == 0)
+ return ::ppapi::thunk::GetPPB_VideoDecoder_Thunk();
+ if (strcmp(name, PPB_VIDEO_CAPTURE_DEV_INTERFACE) == 0)
+ return ::ppapi::thunk::GetPPB_VideoCapture_Thunk();
if (strcmp(name, PPB_VIDEOLAYER_DEV_INTERFACE) == 0)
- return ::ppapi::thunk::GetPPB_VideoLayer_Dev_Thunk();
+ return ::ppapi::thunk::GetPPB_VideoLayer_Thunk();
+ if (strcmp(name, PPB_WHEEL_INPUT_EVENT_INTERFACE_1_0) == 0)
+ return ::ppapi::thunk::GetPPB_WheelInputEvent_Thunk();
if (strcmp(name, PPB_WIDGET_DEV_INTERFACE) == 0)
- return ::ppapi::thunk::GetPPB_Widget_Dev_Thunk();
+ return ::ppapi::thunk::GetPPB_Widget_Thunk();
if (strcmp(name, PPB_ZOOM_DEV_INTERFACE) == 0)
return ::ppapi::thunk::GetPPB_Zoom_Thunk();
+#ifdef ENABLE_GPU
+ if (strcmp(name, PPB_GRAPHICS_3D_INTERFACE) == 0)
+ return ::ppapi::thunk::GetPPB_Graphics3D_Thunk();
+ if (strcmp(name, PPB_GRAPHICS_3D_TRUSTED_INTERFACE) == 0)
+ return ::ppapi::thunk::GetPPB_Graphics3DTrusted_Thunk();
+ if (strcmp(name, PPB_CONTEXT_3D_DEV_INTERFACE) == 0)
+ return ::ppapi::thunk::GetPPB_Context3D_Thunk();
+ if (strcmp(name, PPB_CONTEXT_3D_TRUSTED_DEV_INTERFACE) == 0)
+ return ::ppapi::thunk::GetPPB_Context3DTrusted_Thunk();
+ if (strcmp(name, PPB_GLES_CHROMIUM_TEXTURE_MAPPING_DEV_INTERFACE) == 0)
+ return ::ppapi::thunk::GetPPB_GLESChromiumTextureMapping_Thunk();
+ if (strcmp(name, PPB_OPENGLES2_INTERFACE) == 0)
+ return PPB_OpenGLES_Impl::GetInterface();
+ if (strcmp(name, PPB_SURFACE_3D_DEV_INTERFACE) == 0)
+ return ::ppapi::thunk::GetPPB_Surface3D_Thunk();
+ if (strcmp(name, PPB_LAYER_COMPOSITOR_DEV_INTERFACE) == 0)
+ return ::ppapi::thunk::GetPPB_LayerCompositor_Thunk();
+#endif // ENABLE_GPU
+
#ifdef ENABLE_FLAPPER_HACKS
if (strcmp(name, PPB_FLASH_NETCONNECTOR_INTERFACE) == 0)
return ::ppapi::thunk::GetPPB_Flash_NetConnector_Thunk();
@@ -323,7 +373,7 @@ const void* GetInterface(const char* name) {
#if defined(ENABLE_P2P_APIS)
if (strcmp(name, PPB_TRANSPORT_DEV_INTERFACE) == 0)
- return ::ppapi::thunk::GetPPB_Transport_Dev_Thunk();
+ return ::ppapi::thunk::GetPPB_Transport_Thunk();
#endif
// Only support the testing interface when the command line switch is
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index df52f19..b18df2c 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -9,7 +9,6 @@
#include "base/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/utf_string_conversions.h"
-#include "ppapi/c/dev/ppb_console_dev.h"
#include "ppapi/c/dev/ppb_find_dev.h"
#include "ppapi/c/dev/ppb_fullscreen_dev.h"
#include "ppapi/c/dev/ppb_memory_dev.h"
@@ -39,7 +38,6 @@
#include "printing/units.h"
#include "skia/ext/platform_canvas.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
@@ -106,7 +104,6 @@ using ppapi::thunk::PPB_Surface3D_API;
using ppapi::Var;
using WebKit::WebBindings;
using WebKit::WebCanvas;
-using WebKit::WebConsoleMessage;
using WebKit::WebCursorInfo;
using WebKit::WebDocument;
using WebKit::WebFrame;
@@ -1445,49 +1442,6 @@ PP_Var PluginInstance::ExecuteScript(PP_Instance instance,
return ret;
}
-void PluginInstance::Log(PP_Instance instance,
- int log_level,
- PP_Var value) {
- // TODO(brettw) get the plugin name and use it as the source.
- LogWithSource(instance, log_level, PP_MakeUndefined(), value);
-}
-
-void PluginInstance::LogWithSource(PP_Instance instance,
- int log_level,
- PP_Var source,
- PP_Var value) {
- // Convert the log level, defaulting to error.
- WebConsoleMessage::Level web_level;
- switch (log_level) {
- case PP_LOGLEVEL_TIP:
- web_level = WebConsoleMessage::LevelTip;
- break;
- case PP_LOGLEVEL_LOG:
- web_level = WebConsoleMessage::LevelLog;
- break;
- case PP_LOGLEVEL_WARNING:
- web_level = WebConsoleMessage::LevelWarning;
- break;
- case PP_LOGLEVEL_ERROR:
- default:
- web_level = WebConsoleMessage::LevelError;
- break;
- }
-
- // Format is the "<source>: <value>". The source defaults to the module name
- // if the source isn't a string or is empty.
- std::string message;
- if (source.type == PP_VARTYPE_STRING)
- message = Var::PPVarToLogString(source);
- if (message.empty())
- message = module()->name();
- message.append(": ");
- message.append(Var::PPVarToLogString(value));
-
- container()->element().document().frame()->addMessageToConsole(
- WebConsoleMessage(web_level, WebString(UTF8ToUTF16(message))));
-}
-
PP_Bool PluginInstance::IsFullscreen(PP_Instance instance) {
return PP_FromBool(fullscreen_);
}
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h
index 643828a..48f9019 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.h
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h
@@ -264,13 +264,6 @@ class PluginInstance : public base::RefCounted<PluginInstance>,
virtual PP_Var ExecuteScript(PP_Instance instance,
PP_Var script,
PP_Var* exception) OVERRIDE;
- virtual void Log(PP_Instance instance,
- int log_level,
- PP_Var value) OVERRIDE;
- virtual void LogWithSource(PP_Instance instance,
- int log_level,
- PP_Var source,
- PP_Var value) OVERRIDE;
virtual PP_Bool IsFullscreen(PP_Instance instance) OVERRIDE;
virtual PP_Bool SetFullscreen(PP_Instance instance,
PP_Bool fullscreen) OVERRIDE;
diff --git a/webkit/plugins/ppapi/ppb_console_impl.cc b/webkit/plugins/ppapi/ppb_console_impl.cc
new file mode 100644
index 0000000..1b08ebf
--- /dev/null
+++ b/webkit/plugins/ppapi/ppb_console_impl.cc
@@ -0,0 +1,87 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "webkit/plugins/ppapi/ppb_console_impl.h"
+
+#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
+#include "ppapi/c/dev/ppb_console_dev.h"
+#include "ppapi/shared_impl/var.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h"
+#include "webkit/plugins/ppapi/plugin_module.h"
+#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
+#include "webkit/plugins/ppapi/resource_tracker.h"
+
+using ppapi::Var;
+using WebKit::WebConsoleMessage;
+using WebKit::WebString;
+
+namespace webkit {
+namespace ppapi {
+
+namespace {
+
+void LogWithSource(PP_Instance instance_id,
+ PP_LogLevel_Dev level,
+ PP_Var source,
+ PP_Var value) {
+ PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id);
+ if (!instance)
+ return;
+
+ // Convert the log level, defaulting to error.
+ WebConsoleMessage::Level web_level;
+ switch (level) {
+ case PP_LOGLEVEL_TIP:
+ web_level = WebConsoleMessage::LevelTip;
+ break;
+ case PP_LOGLEVEL_LOG:
+ web_level = WebConsoleMessage::LevelLog;
+ break;
+ case PP_LOGLEVEL_WARNING:
+ web_level = WebConsoleMessage::LevelWarning;
+ break;
+ case PP_LOGLEVEL_ERROR:
+ default:
+ web_level = WebConsoleMessage::LevelError;
+ break;
+ }
+
+ // Format is the "<source>: <value>". The source defaults to the module name
+ // if the source isn't a string or is empty.
+ std::string message;
+ if (source.type == PP_VARTYPE_STRING)
+ message = Var::PPVarToLogString(source);
+ if (message.empty())
+ message = instance->module()->name();
+ message.append(": ");
+ message.append(Var::PPVarToLogString(value));
+
+ instance->container()->element().document().frame()->addMessageToConsole(
+ WebConsoleMessage(web_level, WebString(UTF8ToUTF16(message))));
+}
+
+void Log(PP_Instance instance, PP_LogLevel_Dev level, PP_Var value) {
+ LogWithSource(instance, level, PP_MakeUndefined(), value);
+}
+
+const PPB_Console_Dev ppb_console = {
+ &Log,
+ &LogWithSource
+};
+
+} // namespace
+
+// static
+const struct PPB_Console_Dev* PPB_Console_Impl::GetInterface() {
+ return &ppb_console;
+}
+
+} // namespace ppapi
+} // namespace webkit
+
diff --git a/webkit/plugins/ppapi/ppb_console_impl.h b/webkit/plugins/ppapi/ppb_console_impl.h
new file mode 100644
index 0000000..2d47587
--- /dev/null
+++ b/webkit/plugins/ppapi/ppb_console_impl.h
@@ -0,0 +1,23 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_PLUGINS_PPAPI_PPB_CONSOLE_IMPL_H_
+#define WEBKIT_PLUGINS_PPAPI_PPB_CONSOLE_IMPL_H_
+
+struct PPB_Console_Dev;
+
+namespace webkit {
+namespace ppapi {
+
+class PPB_Console_Impl {
+ public:
+ // Returns a pointer to the interface implementing PPB_Console_Dev that is
+ // exposed to the plugin.
+ static const PPB_Console_Dev* GetInterface();
+};
+
+} // namespace ppapi
+} // namespace webkit
+
+#endif // WEBKIT_PLUGINS_PPAPI_PPB_CONSOLE_IMPL_H_
diff --git a/webkit/plugins/ppapi/ppb_url_request_info_impl.cc b/webkit/plugins/ppapi/ppb_url_request_info_impl.cc
index 358c533..0ebffb7 100644
--- a/webkit/plugins/ppapi/ppb_url_request_info_impl.cc
+++ b/webkit/plugins/ppapi/ppb_url_request_info_impl.cc
@@ -129,8 +129,7 @@ bool PPB_URLRequestInfo_Impl::ToWebURLRequest(WebFrame* frame,
return false;
dest->initialize();
- dest->setURL(frame->document().completeURL(WebString::fromUTF8(
- data().url)));
+ dest->setURL(frame->document().completeURL(WebString::fromUTF8(data().url)));
dest->setDownloadToFile(data().stream_to_file);
dest->setReportUploadProgress(data().record_upload_progress);