summaryrefslogtreecommitdiffstats
path: root/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-22 20:57:00 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-22 20:57:00 +0000
commite18e6392bb61e5a525b87951b9e42df0f2d07c83 (patch)
tree55c67d9ffaf42151ca259e32f043030c9afa7d16 /webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
parent627c4549e3d258ed34d896ac7910f04694cbc7b0 (diff)
downloadchromium_src-e18e6392bb61e5a525b87951b9e42df0f2d07c83.zip
chromium_src-e18e6392bb61e5a525b87951b9e42df0f2d07c83.tar.gz
chromium_src-e18e6392bb61e5a525b87951b9e42df0f2d07c83.tar.bz2
Convert most remaining resources to use the API/thunk system. The significant
changes here are around the 3D API. Having separate files for the texture mapping interface is no longer necessary for the proxy and the implementation. This also removes the uses of the "old" dynamic casting system (using "GetAs") for other resources that I could find. TEST=ui tests BUG=none Review URL: http://codereview.chromium.org/7206016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90096 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins/ppapi/ppb_graphics_2d_impl.cc')
-rw-r--r--webkit/plugins/ppapi/ppb_graphics_2d_impl.cc28
1 files changed, 18 insertions, 10 deletions
diff --git a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
index ff54442..b8f148a 100644
--- a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
+++ b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
@@ -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 @@ void PPB_Graphics2D_Impl::PaintImageData(PP_Resource image_data,
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::Scroll(const PP_Rect* clip_rect,
}
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 @@ int32_t PPB_Graphics2D_Impl::Flush(PP_CompletionCallback callback) {
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 @@ bool PPB_Graphics2D_Impl::ReadImageData(PP_Resource image,
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();