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

Unified Diff: chrome/browser/thumbnails/thumbnail_tab_helper.cc

Issue 12881005: Allow CopyFromBackingStore to fallback to copying from the renderer side if the accelerated surface… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unused include Created 7 years, 9 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/thumbnails/thumbnail_tab_helper.cc
diff --git a/chrome/browser/thumbnails/thumbnail_tab_helper.cc b/chrome/browser/thumbnails/thumbnail_tab_helper.cc
index f786ba4143f3cb584f802672d405c690562a191c..c55920abbf1f0498273a9e53e608a8ecaec2cbf8 100644
--- a/chrome/browser/thumbnails/thumbnail_tab_helper.cc
+++ b/chrome/browser/thumbnails/thumbnail_tab_helper.cc
@@ -73,6 +73,13 @@ void ProcessCapturedBitmap(ThumbnailingContext* context,
algorithm->ProcessBitmap(context, base::Bind(&UpdateThumbnail), bitmap);
}
+void GotSnapshotFromRenderer(base::Callback<void(const SkBitmap&)> callback,
+ bool success,
+ const SkBitmap& bitmap) {
+ if (success)
+ callback.Run(bitmap);
+}
+
void AsyncProcessThumbnail(content::WebContents* web_contents,
scoped_refptr<ThumbnailingContext> context,
scoped_refptr<ThumbnailingAlgorithm> algorithm) {
@@ -82,21 +89,15 @@ void AsyncProcessThumbnail(content::WebContents* web_contents,
if (!view)
return;
if (!view->IsSurfaceAvailableForCopy()) {
-#if defined(OS_WIN)
- // On Windows XP, neither the backing store nor the compositing surface is
- // available in the browser when accelerated compositing is active, so ask
- // the renderer to send a snapshot for creating the thumbnail.
- if (base::win::GetVersion() < base::win::VERSION_VISTA) {
- gfx::Size view_size =
- render_widget_host->GetView()->GetViewBounds().size();
- g_browser_process->GetRenderWidgetSnapshotTaker()->AskForSnapshot(
- render_widget_host,
- base::Bind(&ThumbnailingAlgorithm::ProcessBitmap,
- algorithm, context, base::Bind(&UpdateThumbnail)),
- view_size,
- view_size);
- }
-#endif
+ // On Windows XP and possibly due to driver issues, neither the backing
+ // store nor the compositing surface is available in the browser when
+ // accelerated compositing is active, so ask the renderer to send a snapshot
+ // for creating the thumbnail.
+ render_widget_host->GetSnapshotFromRenderer(
+ gfx::Rect(),
+ base::Bind(GotSnapshotFromRenderer, base::Bind(
+ &ThumbnailingAlgorithm::ProcessBitmap,
+ algorithm, context, base::Bind(&UpdateThumbnail))));
return;
}

Powered by Google App Engine
This is Rietveld 408576698