Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7639)

Unified Diff: chrome/renderer/chrome_ppb_pdf_impl.cc

Issue 7669055: Remove webkit::ppapi::Resource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nulls auditeed Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/chrome_ppb_pdf_impl.h ('k') | content/renderer/pepper_plugin_delegate_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « chrome/renderer/chrome_ppb_pdf_impl.h ('k') | content/renderer/pepper_plugin_delegate_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698