diff options
author | dmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-12 20:37:04 +0000 |
---|---|---|
committer | dmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-12 20:37:04 +0000 |
commit | c77a8dd4b83d07233202f99ce7951e7f002ebec7 (patch) | |
tree | 3f7aa1c79cca700e5f1d96a833c0cb474b8b285c /ppapi/proxy/ppb_instance_proxy.cc | |
parent | 358be972e7edb780004c66be2b8b343beb755b00 (diff) | |
download | chromium_src-c77a8dd4b83d07233202f99ce7951e7f002ebec7.zip chromium_src-c77a8dd4b83d07233202f99ce7951e7f002ebec7.tar.gz chromium_src-c77a8dd4b83d07233202f99ce7951e7f002ebec7.tar.bz2 |
Revert 100748 - This patch tries to remove most of the manual registration for Pepper interfaces, and replaces it with a list of macros. When files want to know which Pepper interface names and structs there are, they define what they want to do with the macros, and then include the relevant files for the classes of interfaces they want (stable, private, dev).
This does not convert all the dev interfaces. I just did a few to keep the patch smaller. So there is still a lot of manual registration.
This fixes the previous design problem where we assumed one *_Proxy object == one interface. We have been hacking around this lately with duplicate GetInfo calls, but this doesn't work for PPP interfaces.
Now, a _Proxy object is just there to help keep things organized. One proxy can handle zero, one, or many interfaces, and this mapping is controlled by just one line in the interfaces file.
So for example, to add a new function to a new version of an interface with backward compatibility, you would add that function to the _api.h file, and write a thunk for the new interface. Then you only need to add one line to the interfaces_ppb_public_stable.h file and that will be hooked up with the proxy and the implementation.
This removes some _proxy objects/files that were used only to declare that the interfaces existed, since they're no longer necessary.
I folded Console into the Instance API which removed a bunch of code.
I removed FileChooser 0.4. I think everybody has converted to the new one, and I think parts of it weren't even hooked up properly anymore.
Review URL: http://codereview.chromium.org/7740038
TBR=brettw@chromium.org
Review URL: http://codereview.chromium.org/7844018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100754 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/ppb_instance_proxy.cc')
-rw-r--r-- | ppapi/proxy/ppb_instance_proxy.cc | 122 |
1 files changed, 64 insertions, 58 deletions
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())); } |