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

Unified Diff: webkit/plugins/ppapi/ppb_graphics_2d_impl.cc

Issue 7206016: Convert most remaining resources to use the API/thunk system. The significant (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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
Index: webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
===================================================================
--- webkit/plugins/ppapi/ppb_graphics_2d_impl.cc (revision 89672)
+++ webkit/plugins/ppapi/ppb_graphics_2d_impl.cc (working copy)
@@ -15,6 +15,7 @@
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/ppb_graphics_2d.h"
#include "ppapi/cpp/common.h"
+#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/thunk.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/blit.h"
@@ -29,6 +30,9 @@
#include "base/mac/scoped_cftyperef.h"
#endif
+using ppapi::thunk::EnterResourceNoLock;
+using ppapi::thunk::PPB_ImageData_API;
+
namespace webkit {
namespace ppapi {
@@ -199,10 +203,11 @@
if (!top_left)
return;
- scoped_refptr<PPB_ImageData_Impl> image_resource(
- Resource::GetAs<PPB_ImageData_Impl>(image_data));
- if (!image_resource)
+ EnterResourceNoLock<PPB_ImageData_API> enter(image_data, true);
+ if (enter.failed())
return;
+ PPB_ImageData_Impl* image_resource =
+ static_cast<PPB_ImageData_Impl*>(enter.object());
QueuedOperation operation(QueuedOperation::PAINT);
operation.paint_image = image_resource;
@@ -253,10 +258,12 @@
}
void PPB_Graphics2D_Impl::ReplaceContents(PP_Resource image_data) {
- scoped_refptr<PPB_ImageData_Impl> image_resource(
- Resource::GetAs<PPB_ImageData_Impl>(image_data));
- if (!image_resource)
+ EnterResourceNoLock<PPB_ImageData_API> enter(image_data, true);
+ if (enter.failed())
return;
+ PPB_ImageData_Impl* image_resource =
+ static_cast<PPB_ImageData_Impl*>(enter.object());
+
if (!PPB_ImageData_Impl::IsImageDataFormatSupported(
image_resource->format()))
return;
@@ -335,10 +342,11 @@
bool PPB_Graphics2D_Impl::ReadImageData(PP_Resource image,
const PP_Point* top_left) {
// Get and validate the image object to paint into.
- scoped_refptr<PPB_ImageData_Impl> image_resource(
- Resource::GetAs<PPB_ImageData_Impl>(image));
- if (!image_resource)
+ EnterResourceNoLock<PPB_ImageData_API> enter(image, true);
+ if (enter.failed())
return false;
+ PPB_ImageData_Impl* image_resource =
+ static_cast<PPB_ImageData_Impl*>(enter.object());
if (!PPB_ImageData_Impl::IsImageDataFormatSupported(
image_resource->format()))
return false; // Must be in the right format.
@@ -369,7 +377,7 @@
if (image_resource->format() != image_data_->format()) {
// Convert the image data if the format does not match.
- ConvertImageData(image_data_, src_irect, image_resource.get(), dest_rect);
+ ConvertImageData(image_data_, src_irect, image_resource, dest_rect);
} else {
skia::PlatformCanvas* dest_canvas = image_resource->mapped_canvas();
« no previous file with comments | « webkit/plugins/ppapi/ppb_gles_chromium_texture_mapping_impl.cc ('k') | webkit/plugins/ppapi/ppb_graphics_3d_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698