Index: chrome/renderer/chrome_ppb_pdf_impl.cc |
diff --git a/chrome/renderer/chrome_ppb_pdf_impl.cc b/chrome/renderer/chrome_ppb_pdf_impl.cc |
index 8f4f31a74185691b4652ee68643df4d3a300ff00..f4df30bbf82fc277e03bed7657fa2e2912b10056 100644 |
--- a/chrome/renderer/chrome_ppb_pdf_impl.cc |
+++ b/chrome/renderer/chrome_ppb_pdf_impl.cc |
@@ -27,15 +27,14 @@ |
#include "webkit/plugins/ppapi/plugin_module.h" |
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
#include "webkit/plugins/ppapi/ppb_image_data_impl.h" |
+#include "webkit/plugins/ppapi/resource_tracker.h" |
namespace chrome { |
#if defined(OS_LINUX) |
-class PrivateFontFile : public webkit::ppapi::Resource { |
+class PrivateFontFile : public ppapi::Resource { |
public: |
- PrivateFontFile(webkit::ppapi::PluginInstance* instance, int fd) |
- : webkit::ppapi::Resource(instance), |
- fd_(fd) { |
+ PrivateFontFile(PP_Instance instance, int fd) : Resource(instance), fd_(fd) { |
} |
virtual ~PrivateFontFile() { |
} |
@@ -149,12 +148,11 @@ PP_Resource GetResourceImage(PP_Instance instance_id, |
SkBitmap* res_bitmap = |
ResourceBundle::GetSharedInstance().GetBitmapNamed(res_id); |
- webkit::ppapi::PluginInstance* instance = |
- webkit::ppapi::ResourceTracker::Get()->GetInstance(instance_id); |
- if (!instance) |
+ // Validate the instance. |
+ if (!webkit::ppapi::ResourceTracker::Get()->GetInstance(instance_id)) |
return 0; |
scoped_refptr<webkit::ppapi::PPB_ImageData_Impl> image_data( |
- new webkit::ppapi::PPB_ImageData_Impl(instance)); |
+ new webkit::ppapi::PPB_ImageData_Impl(instance_id)); |
if (!image_data->Init( |
webkit::ppapi::PPB_ImageData_Impl::GetNativeImageDataFormat(), |
res_bitmap->width(), res_bitmap->height(), false)) { |
@@ -178,9 +176,8 @@ PP_Resource GetFontFileWithFallback( |
const PP_FontDescription_Dev* description, |
PP_PrivateFontCharset charset) { |
#if defined(OS_LINUX) |
- webkit::ppapi::PluginInstance* instance = |
- webkit::ppapi::ResourceTracker::Get()->GetInstance(instance_id); |
- if (!instance) |
+ // Validate the instance before using it below. |
+ if (!webkit::ppapi::ResourceTracker::Get()->GetInstance(instance_id)) |
return 0; |
scoped_refptr<ppapi::StringVar> face_name(ppapi::StringVar::FromPPVar( |
@@ -196,7 +193,7 @@ PP_Resource GetFontFileWithFallback( |
if (fd == -1) |
return 0; |
- scoped_refptr<PrivateFontFile> font(new PrivateFontFile(instance, fd)); |
+ scoped_refptr<PrivateFontFile> font(new PrivateFontFile(instance_id, fd)); |
return font->GetReference(); |
#else |