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

Unified Diff: content/renderer/pepper/pepper_graphics_2d_host.cc

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
« no previous file with comments | « content/renderer/pepper/pepper_graphics_2d_host.h ('k') | content/renderer/pepper/ppb_image_data_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper/pepper_graphics_2d_host.cc
diff --git a/content/renderer/pepper/pepper_graphics_2d_host.cc b/content/renderer/pepper/pepper_graphics_2d_host.cc
index fc108c776b66057ef7283369007eec7a570adf14..f03f5cd67205855f017d1ca156600c45d0260bbd 100644
--- a/content/renderer/pepper/pepper_graphics_2d_host.cc
+++ b/content/renderer/pepper/pepper_graphics_2d_host.cc
@@ -163,15 +163,18 @@ struct PepperGraphics2DHost::QueuedOperation {
};
// static
-PepperGraphics2DHost* PepperGraphics2DHost::Create(RendererPpapiHost* host,
- PP_Instance instance,
- PP_Resource resource,
- const PP_Size& size,
- PP_Bool is_always_opaque) {
+PepperGraphics2DHost* PepperGraphics2DHost::Create(
+ RendererPpapiHost* host,
+ PP_Instance instance,
+ PP_Resource resource,
+ const PP_Size& size,
+ PP_Bool is_always_opaque,
+ scoped_refptr<PPB_ImageData_Impl> backing_store) {
PepperGraphics2DHost* resource_host =
new PepperGraphics2DHost(host, instance, resource);
if (!resource_host->Init(size.width, size.height,
- PP_ToBool(is_always_opaque))) {
+ PP_ToBool(is_always_opaque),
+ backing_store)) {
delete resource_host;
return NULL;
}
@@ -197,10 +200,13 @@ PepperGraphics2DHost::~PepperGraphics2DHost() {
bound_instance_->BindGraphics(bound_instance_->pp_instance(), 0);
}
-bool PepperGraphics2DHost::Init(int width, int height, bool is_always_opaque) {
+bool PepperGraphics2DHost::Init(
+ int width,
+ int height,
+ bool is_always_opaque,
+ scoped_refptr<PPB_ImageData_Impl> backing_store) {
// The underlying PPB_ImageData_Impl will validate the dimensions.
- image_data_ = new PPB_ImageData_Impl(pp_instance(),
- PPB_ImageData_Impl::PLATFORM);
+ image_data_ = backing_store;
if (!image_data_->Init(PPB_ImageData_Impl::GetNativeImageDataFormat(),
width, height, true) ||
!image_data_->Map()) {
« no previous file with comments | « content/renderer/pepper/pepper_graphics_2d_host.h ('k') | content/renderer/pepper/ppb_image_data_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698