summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy/ppb_pdf_proxy.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-21 00:26:43 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-21 00:26:43 +0000
commit4614f1974881ecfd0a0118683bac628c6128c2a9 (patch)
treec69836459560dd8003f7e18ca554f2e1d7f79b4d /ppapi/proxy/ppb_pdf_proxy.cc
parentb8e6654fb91108033580f510e2d411093936fc2f (diff)
downloadchromium_src-4614f1974881ecfd0a0118683bac628c6128c2a9.zip
chromium_src-4614f1974881ecfd0a0118683bac628c6128c2a9.tar.gz
chromium_src-4614f1974881ecfd0a0118683bac628c6128c2a9.tar.bz2
First pass at making the proxy handle multiple renderers. This associates the
instance with resources and has most callers retrieve the dispatcher according to the appropriate instance. This isn't hooked up to anything yet. This changes some PPB_Flash interface methods to use PP_Bool. The most challenging part of the change is in the plugin_var_tracker which now needs to track which dispatcher each var object came from, and remap var IDs since each renderer will be generating var IDs in its own space, which will likely overlap. A similar system will need to be done for resources which is not implemented yet. I added some null checks in audio_impl because audio_ can be NULL in some cases when using the trusted API. I discovered this when testing NaCl for this patch. Review URL: http://codereview.chromium.org/6282007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72053 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/ppb_pdf_proxy.cc')
-rw-r--r--ppapi/proxy/ppb_pdf_proxy.cc21
1 files changed, 14 insertions, 7 deletions
diff --git a/ppapi/proxy/ppb_pdf_proxy.cc b/ppapi/proxy/ppb_pdf_proxy.cc
index 776a90a..7ad8326 100644
--- a/ppapi/proxy/ppb_pdf_proxy.cc
+++ b/ppapi/proxy/ppb_pdf_proxy.cc
@@ -14,6 +14,7 @@
#include "ppapi/c/private/ppb_pdf.h"
#include "ppapi/proxy/plugin_dispatcher.h"
#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/proxy/plugin_resource_tracker.h"
#include "ppapi/proxy/ppapi_messages.h"
namespace pp {
@@ -21,7 +22,7 @@ namespace proxy {
class PrivateFontFile : public PluginResource {
public:
- PrivateFontFile() {}
+ PrivateFontFile(PP_Instance instance) : PluginResource(instance) {}
virtual ~PrivateFontFile() {}
// Resource overrides.
@@ -60,7 +61,10 @@ PP_Resource GetFontFileWithFallback(
PP_Instance instance,
const PP_FontDescription_Dev* description,
PP_PrivateFontCharset charset) {
- PluginDispatcher* dispatcher = PluginDispatcher::Get();
+ PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
+ if (!dispatcher)
+ return 0;
+
SerializedFontDescription desc;
desc.SetFromPPFontDescription(dispatcher, *description, true);
@@ -70,8 +74,8 @@ PP_Resource GetFontFileWithFallback(
if (!result)
return 0;
- linked_ptr<PrivateFontFile> object(new PrivateFontFile);
- dispatcher->plugin_resource_tracker()->AddResource(result, object);
+ linked_ptr<PrivateFontFile> object(new PrivateFontFile(instance));
+ PluginResourceTracker::GetInstance()->AddResource(result, object);
return result;
}
@@ -82,13 +86,16 @@ bool GetFontTableForPrivateFontFile(PP_Resource font_file,
PrivateFontFile* object = PluginResource::GetAs<PrivateFontFile>(font_file);
if (!object)
return false;
+ PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(
+ object->instance());
+ if (!dispatcher)
+ return false;
std::string* contents = object->GetFontTable(table);
if (!contents) {
std::string deserialized;
- PluginDispatcher::Get()->Send(
- new PpapiHostMsg_PPBPDF_GetFontTableForPrivateFontFile(
- INTERFACE_ID_PPB_PDF, font_file, table, &deserialized));
+ dispatcher->Send(new PpapiHostMsg_PPBPDF_GetFontTableForPrivateFontFile(
+ INTERFACE_ID_PPB_PDF, font_file, table, &deserialized));
if (deserialized.empty())
return false;
contents = object->AddFontTable(table, deserialized);