Chromium Code Reviews| 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..d17e7da7d58f72437630f8c311421c2117783389 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() { |
| } |
| @@ -134,7 +133,7 @@ PP_Var GetLocalizedString(PP_Instance instance_id, |
| return ppapi::StringVar::StringToPPVar(instance->module()->pp_module(), rv); |
| } |
| -PP_Resource GetResourceImage(PP_Instance instance_id, |
| +PP_Resource GetResourceImage(PP_Instance instance, |
| PP_ResourceImage image_id) { |
| int res_id = 0; |
| for (size_t i = 0; i < arraysize(kResourceImageMap); ++i) { |
| @@ -149,9 +148,8 @@ 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)) |
|
viettrungluu
2011/08/22 23:19:46
I really wish we had a consistent convention for i
brettw
2011/08/23 17:16:28
This patch generally removes uses of PluginInstanc
|
| return 0; |
| scoped_refptr<webkit::ppapi::PPB_ImageData_Impl> image_data( |
| new webkit::ppapi::PPB_ImageData_Impl(instance)); |
| @@ -174,13 +172,12 @@ PP_Resource GetResourceImage(PP_Instance instance_id, |
| } |
| PP_Resource GetFontFileWithFallback( |
| - PP_Instance instance_id, |
| + PP_Instance instance, |
| 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)) |
| return 0; |
| scoped_refptr<ppapi::StringVar> face_name(ppapi::StringVar::FromPPVar( |