summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-28 20:01:41 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-28 20:01:41 +0000
commit8c23a87bd4f1c7aa5b7426bc6e0ab4f959669cbf (patch)
treeed659f744a8eba01d47b6e35cfd579c3717d3fa8 /webkit
parent2031aeb7449a3cdf6a344fd3338d6d675e275592 (diff)
downloadchromium_src-8c23a87bd4f1c7aa5b7426bc6e0ab4f959669cbf.zip
chromium_src-8c23a87bd4f1c7aa5b7426bc6e0ab4f959669cbf.tar.gz
chromium_src-8c23a87bd4f1c7aa5b7426bc6e0ab4f959669cbf.tar.bz2
Ensure the plugin backing store is always mapped, even when it's been swapped
in. This was causing a crash after Swap when running out of process. TEST=manual BUG=none Review URL: http://codereview.chromium.org/5972010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73004 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/plugins/ppapi/ppb_graphics_2d_impl.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
index 3105b61..28c8a7b 100644
--- a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
+++ b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
@@ -79,9 +79,12 @@ void ConvertBetweenBGRAandRGBA(const uint32_t* input,
}
// Converts ImageData from PP_IMAGEDATAFORMAT_BGRA_PREMUL to
-// PP_IMAGEDATAFORMAT_RGBA_PREMUL, or reverse.
+// PP_IMAGEDATAFORMAT_RGBA_PREMUL, or reverse. It's assumed that the
+// destination image is always mapped (so will have non-NULL data).
void ConvertImageData(PPB_ImageData_Impl* src_image, const SkIRect& src_rect,
PPB_ImageData_Impl* dest_image, const SkRect& dest_rect) {
+ ImageDataAutoMapper auto_mapper(src_image);
+
DCHECK(src_image->format() != dest_image->format());
DCHECK(PPB_ImageData_Impl::IsImageDataFormatSupported(src_image->format()));
DCHECK(PPB_ImageData_Impl::IsImageDataFormatSupported(dest_image->format()));
@@ -430,7 +433,6 @@ bool PPB_Graphics2D_Impl::ReadImageData(PP_Resource image,
SkIntToScalar(image_resource->width()),
SkIntToScalar(image_resource->height()) };
- ImageDataAutoMapper auto_mapper2(image_data_);
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);
@@ -636,6 +638,11 @@ void PPB_Graphics2D_Impl::ExecuteReplaceContents(PPB_ImageData_Impl* image,
SkIntToScalar(image_data_->height()) };
ConvertImageData(image, src_irect, image_data_, dest_rect);
} else {
+ // The passed-in image may not be mapped in our process, and we need to
+ // guarantee that the current backing store is always mapped.
+ if (!image->Map())
+ return;
+ image_data_->Unmap();
image_data_->Swap(image);
}
*invalidated_rect = gfx::Rect(0, 0,