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

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
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 97d208c74bf1cdb5d1bbc5aece4bc164f97b38d8..e55abac379bb8c5f3271bd1f2b3ecfacb1ff83fe 100644
--- a/content/renderer/pepper/pepper_graphics_2d_host.cc
+++ b/content/renderer/pepper/pepper_graphics_2d_host.cc
@@ -166,15 +166,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;
}
@@ -200,10 +203,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()) {

Powered by Google App Engine
This is Rietveld 408576698