From 465faa29046328890a224677db522f1aece8cad0 Mon Sep 17 00:00:00 2001 From: "brettw@chromium.org" Date: Tue, 8 Feb 2011 16:31:46 +0000 Subject: Rent syncemove all uses of the global Dispatcher Get function. This reqired reworking how plugin->host GetInterface works. Previously, interface requests were symmetric where each side would first do a SupportsInterface to see if the remote side supports the interface, then create the proxy. Since the plugin may talk to multiple renderers, we don't know where to send these requests. The solution is to make the assumption that the renderer always supports all PPB interfaces (which is possible since the proxy is compiled with the executable). This also adds some better lookup for interfaces to avoid having multiple lists of interfaces. We now have a list of interfaces and factory functions in dispatcher.cc. Add some additional testing infrastructure for the dispatchers with simple tests. Review URL: http://codereview.chromium.org/6286070 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74121 0039d316-1c4b-4281-b951-d872f2087c98 --- ppapi/proxy/ppb_pdf_proxy.cc | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'ppapi/proxy/ppb_pdf_proxy.cc') diff --git a/ppapi/proxy/ppb_pdf_proxy.cc b/ppapi/proxy/ppb_pdf_proxy.cc index e3c656f..b7e0744 100644 --- a/ppapi/proxy/ppb_pdf_proxy.cc +++ b/ppapi/proxy/ppb_pdf_proxy.cc @@ -107,13 +107,18 @@ bool GetFontTableForPrivateFontFile(PP_Resource font_file, return true; } -const PPB_PDF ppb_pdf = { +const PPB_PDF pdf_interface = { NULL, // &GetLocalizedString, NULL, // &GetResourceImage, &GetFontFileWithFallback, &GetFontTableForPrivateFontFile, }; +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, @@ -124,12 +129,16 @@ PPB_PDF_Proxy::PPB_PDF_Proxy(Dispatcher* dispatcher, PPB_PDF_Proxy::~PPB_PDF_Proxy() { } -const void* PPB_PDF_Proxy::GetSourceInterface() const { - return &ppb_pdf; -} - -InterfaceID PPB_PDF_Proxy::GetInterfaceId() const { - return INTERFACE_ID_PPB_PDF; +// static +const InterfaceProxy::Info* PPB_PDF_Proxy::GetInfo() { + static const Info info = { + &pdf_interface, + PPB_PDF_INTERFACE, + INTERFACE_ID_PPB_PDF, + true, + &CreatePDFProxy, + }; + return &info; } bool PPB_PDF_Proxy::OnMessageReceived(const IPC::Message& msg) { -- cgit v1.1