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

Unified Diff: content/browser/compositor/delegated_frame_host.cc

Issue 1113573002: Maintain minimal error response. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed build issue. Created 5 years, 7 months 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/browser/compositor/delegated_frame_host.cc
diff --git a/content/browser/compositor/delegated_frame_host.cc b/content/browser/compositor/delegated_frame_host.cc
index f45e7f40c1c3028defaba8746b6d81954ee7bd0f..9c653bd617b09ef4c5905387a0974e806e368fde 100644
--- a/content/browser/compositor/delegated_frame_host.cc
+++ b/content/browser/compositor/delegated_frame_host.cc
@@ -128,11 +128,11 @@ void DelegatedFrameHost::CopyFromCompositingSurface(
const gfx::Rect& src_subrect,
const gfx::Size& output_size,
ReadbackRequestCallback& callback,
- const SkColorType color_type) {
+ const SkColorType preferred_color_type) {
// Only ARGB888 and RGB565 supported as of now.
- bool format_support = ((color_type == kAlpha_8_SkColorType) ||
- (color_type == kRGB_565_SkColorType) ||
- (color_type == kN32_SkColorType));
+ bool format_support = ((preferred_color_type == kAlpha_8_SkColorType) ||
+ (preferred_color_type == kRGB_565_SkColorType) ||
+ (preferred_color_type == kN32_SkColorType));
DCHECK(format_support);
if (!CanCopyToBitmap()) {
callback.Run(SkBitmap(), content::READBACK_SURFACE_UNAVAILABLE);
@@ -140,11 +140,9 @@ void DelegatedFrameHost::CopyFromCompositingSurface(
}
scoped_ptr<cc::CopyOutputRequest> request =
- cc::CopyOutputRequest::CreateRequest(base::Bind(
- &DelegatedFrameHost::CopyFromCompositingSurfaceHasResult,
- output_size,
- color_type,
- callback));
+ cc::CopyOutputRequest::CreateRequest(
+ base::Bind(&DelegatedFrameHost::CopyFromCompositingSurfaceHasResult,
+ output_size, preferred_color_type, callback));
if (!src_subrect.IsEmpty())
request->set_area(src_subrect);
RequestCopyOfOutput(request.Pass());
@@ -582,15 +580,17 @@ void DelegatedFrameHost::PrepareTextureCopyOutputResult(
base::ScopedClosureRunner scoped_callback_runner(
base::Bind(callback, SkBitmap(), content::READBACK_FAILED));
- // TODO(sikugu): We should be able to validate the format here using
+ // TODO(siva.gunturi): We should be able to validate the format here using
// GLHelper::IsReadbackConfigSupported before we processs the result.
- // See crbug.com/415682.
+ // See crbug.com/415682 and crbug.com/415131.
scoped_ptr<SkBitmap> bitmap(new SkBitmap);
- if (!bitmap->tryAllocPixels(SkImageInfo::Make(dst_size_in_pixel.width(),
- dst_size_in_pixel.height(),
- color_type,
- kOpaque_SkAlphaType)))
+ if (!bitmap->tryAllocPixels(SkImageInfo::Make(
+ dst_size_in_pixel.width(), dst_size_in_pixel.height(), color_type,
+ kOpaque_SkAlphaType))) {
+ scoped_callback_runner.Reset(base::Bind(
+ callback, SkBitmap(), content::READBACK_BITMAP_ALLOCATION_FAILURE));
return;
+ }
ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
GLHelper* gl_helper = factory->GetGLHelper();
@@ -627,13 +627,13 @@ void DelegatedFrameHost::PrepareTextureCopyOutputResult(
// static
void DelegatedFrameHost::PrepareBitmapCopyOutputResult(
const gfx::Size& dst_size_in_pixel,
- const SkColorType color_type,
+ const SkColorType preferred_color_type,
ReadbackRequestCallback& callback,
scoped_ptr<cc::CopyOutputResult> result) {
+ SkColorType color_type = preferred_color_type;
if (color_type != kN32_SkColorType && color_type != kAlpha_8_SkColorType) {
- NOTIMPLEMENTED();
- callback.Run(SkBitmap(), READBACK_FORMAT_NOT_SUPPORTED);
- return;
+ // Switch back to default colortype if format not supported.
+ color_type = kN32_SkColorType;
}
DCHECK(result->HasBitmap());
scoped_ptr<SkBitmap> source = result->TakeBitmap();
@@ -663,7 +663,7 @@ void DelegatedFrameHost::PrepareBitmapCopyOutputResult(
bool success = grayscale_bitmap.tryAllocPixels(
SkImageInfo::MakeA8(scaled_bitmap.width(), scaled_bitmap.height()));
if (!success) {
- callback.Run(SkBitmap(), content::READBACK_MEMORY_ALLOCATION_FAILURE);
+ callback.Run(SkBitmap(), content::READBACK_BITMAP_ALLOCATION_FAILURE);
return;
}
SkCanvas canvas(grayscale_bitmap);
« no previous file with comments | « content/browser/compositor/delegated_frame_host.h ('k') | content/browser/frame_host/render_widget_host_view_child_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698