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

Unified Diff: chrome/browser/tab_contents/thumbnail_generator.cc

Issue 9582003: Support browser side thumbnailing for GPU composited pages on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 8 years, 10 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: chrome/browser/tab_contents/thumbnail_generator.cc
diff --git a/chrome/browser/tab_contents/thumbnail_generator.cc b/chrome/browser/tab_contents/thumbnail_generator.cc
index 76c63c8a7e084761aa30b5568db1f5713c247fa1..8623a6838500fbf8213d4a72f5d7945606871241 100644
--- a/chrome/browser/tab_contents/thumbnail_generator.cc
+++ b/chrome/browser/tab_contents/thumbnail_generator.cc
@@ -70,14 +70,24 @@ SkBitmap GetBitmapForRenderWidgetHost(
ThumbnailGenerator::ClipResult* clip_result) {
base::TimeTicks begin_compute_thumbnail = base::TimeTicks::Now();
- SkBitmap result;
+ bool is_accelerated_compositing_active = false;
+ content::RenderWidgetHostView* view = render_widget_host->view();
+ if (view) {
+ RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::FromRWHV(view);
+ is_accelerated_compositing_active =
+ rwhi->is_accelerated_compositing_active();
+ }
// Get the bitmap as a Skia object so we can resample it. This is a large
// allocation and we can tolerate failure here, so give up if the allocation
// fails.
skia::PlatformCanvas temp_canvas;
- if (!render_widget_host->CopyFromBackingStore(&temp_canvas))
- return result;
+ const bool copy_result = is_accelerated_compositing_active ?
+ render_widget_host->CopyFromCompositingSurface(&temp_canvas) :
+ render_widget_host->CopyFromBackingStore(&temp_canvas);
+ if (!copy_result)
+ return SkBitmap();
+
const SkBitmap& bmp_with_scrollbars =
skia::GetTopDevice(temp_canvas)->accessBitmap(false);
// Clip the edgemost 15 pixels as that will commonly hold a scrollbar, which
@@ -89,6 +99,7 @@ SkBitmap GetBitmapForRenderWidgetHost(
SkBitmap bmp;
bmp_with_scrollbars.extractSubset(&bmp, scrollbarless_rect);
+ SkBitmap result;
// Check if a clipped thumbnail is requested.
if (options & ThumbnailGenerator::kClippedThumbnail) {
SkBitmap clipped_bitmap = ThumbnailGenerator::GetClippedBitmap(

Powered by Google App Engine
This is Rietveld 408576698