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

Unified Diff: content/renderer/pepper/ppb_image_data_impl.h

Issue 61813003: Allow PPB_ImageData_Impl to be created in a way that is compatible with unittests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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: content/renderer/pepper/ppb_image_data_impl.h
diff --git a/content/renderer/pepper/ppb_image_data_impl.h b/content/renderer/pepper/ppb_image_data_impl.h
index a16bbfa104b2a9cd9d06a5bffab82dbb8ba57383..578854cfe80998dae89630ca526543053ee9ac9a 100644
--- a/content/renderer/pepper/ppb_image_data_impl.h
+++ b/content/renderer/pepper/ppb_image_data_impl.h
@@ -51,8 +51,15 @@ class CONTENT_EXPORT PPB_ImageData_Impl
// If you call this constructor, you must also call Init before use. Normally
// you should use the static Create function, but this constructor is needed
// for some internal uses of ImageData (like Graphics2D).
+ // |is_browser_allocated| indicates whether the backing shared memory should
+ // be allocated by the browser process.
PPB_ImageData_Impl(PP_Instance instance,
- PPB_ImageData_Shared::ImageDataType type);
+ PPB_ImageData_Shared::ImageDataType type,
+ bool is_browser_allocated);
+
+ // Returns true if the ImageData shared memory should be allocated in the
+ // browser process for the current platform.
+ static bool IsBrowserAllocated(ImageDataType format);
bool Init(PP_ImageDataFormat format,
int width, int height,
@@ -102,7 +109,7 @@ class CONTENT_EXPORT PPB_ImageData_Impl
class ImageDataPlatformBackend : public PPB_ImageData_Impl::Backend {
public:
- ImageDataPlatformBackend();
+ ImageDataPlatformBackend(bool is_browser_allocated);
virtual ~ImageDataPlatformBackend();
// PPB_ImageData_Impl::Backend implementation.
@@ -124,6 +131,8 @@ class ImageDataPlatformBackend : public PPB_ImageData_Impl::Backend {
int height_;
scoped_ptr<TransportDIB> dib_;
+ bool is_browser_allocated_;
+
// When the device is mapped, this is the image. Null when umapped.
scoped_ptr<SkCanvas> mapped_canvas_;

Powered by Google App Engine
This is Rietveld 408576698