summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy/ppp_instance_proxy.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-12 20:07:29 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-12 20:07:29 +0000
commit62cccdac4221f25d83c84da8da70e7c540d4af35 (patch)
tree227fb39351ee5df0d6ac143f31527270b0c493d2 /ppapi/proxy/ppp_instance_proxy.cc
parentcc89cd9a46629ca8230aae41f8ad2855c8b30264 (diff)
downloadchromium_src-62cccdac4221f25d83c84da8da70e7c540d4af35.zip
chromium_src-62cccdac4221f25d83c84da8da70e7c540d4af35.tar.gz
chromium_src-62cccdac4221f25d83c84da8da70e7c540d4af35.tar.bz2
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 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100748 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/ppp_instance_proxy.cc')
-rw-r--r--ppapi/proxy/ppp_instance_proxy.cc25
1 files changed, 15 insertions, 10 deletions
diff --git a/ppapi/proxy/ppp_instance_proxy.cc b/ppapi/proxy/ppp_instance_proxy.cc
index 1da10be..aa4b7e7 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->GetLocalInterface(PPB_FULLSCREEN_DEV_INTERFACE));
+ dispatcher->local_get_interface()(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->GetOrCreatePPBInterfaceProxy(INTERFACE_ID_PPB_URL_LOADER));
+ dispatcher->GetInterfaceProxy(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->GetLocalInterface(PPB_CORE_INTERFACE));
+ dispatcher->local_get_interface()(PPB_CORE_INTERFACE));
if (!core) {
NOTREACHED();
return PP_FALSE;
@@ -105,16 +105,21 @@ static const PPP_Instance_1_0 instance_interface_1_0 = {
&HandleDocumentLoad
};
-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));
+InterfaceProxy* CreateInstanceProxy(Dispatcher* dispatcher) {
+ return new PPP_Instance_Proxy(dispatcher);
}
} // 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() {
}
@@ -125,7 +130,7 @@ const InterfaceProxy::Info* PPP_Instance_Proxy::GetInfo1_0() {
PPP_INSTANCE_INTERFACE_1_0,
INTERFACE_ID_PPP_INSTANCE,
false,
- &CreateInstanceProxy<PPP_Instance_1_0>,
+ &CreateInstanceProxy
};
return &info;
}