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

Unified Diff: chrome/renderer/chrome_render_view_observer.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/renderer/chrome_render_view_observer.cc
diff --git a/chrome/renderer/chrome_render_view_observer.cc b/chrome/renderer/chrome_render_view_observer.cc
index 020979a3710c207c28ebc86058bb83875bfbdc12..48651a7b8370133c3b8fac0b6ab1831db5e609d7 100644
--- a/chrome/renderer/chrome_render_view_observer.cc
+++ b/chrome/renderer/chrome_render_view_observer.cc
@@ -194,7 +194,6 @@ bool ChromeRenderViewObserver::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(ChromeRenderViewObserver, message)
IPC_MESSAGE_HANDLER(ChromeViewMsg_WebUIJavaScript, OnWebUIJavaScript)
- IPC_MESSAGE_HANDLER(ChromeViewMsg_CaptureSnapshot, OnCaptureSnapshot)
IPC_MESSAGE_HANDLER(ChromeViewMsg_HandleMessageFromExternalHost,
OnHandleMessageFromExternalHost)
IPC_MESSAGE_HANDLER(ChromeViewMsg_JavaScriptStressTestControl,
@@ -236,24 +235,6 @@ void ChromeRenderViewObserver::OnWebUIJavaScript(
webui_javascript_->notify_result = notify_result;
}
-void ChromeRenderViewObserver::OnCaptureSnapshot() {
- SkBitmap snapshot;
- bool error = false;
-
- WebFrame* main_frame = render_view()->GetWebView()->mainFrame();
- if (!main_frame)
- error = true;
-
- if (!error && !CaptureSnapshot(render_view()->GetWebView(), &snapshot))
- error = true;
-
- DCHECK(error == snapshot.empty()) <<
- "Snapshot should be empty on error, non-empty otherwise.";
-
- // Send the snapshot to the browser process.
- Send(new ChromeViewHostMsg_Snapshot(routing_id(), snapshot));
-}
-
void ChromeRenderViewObserver::OnHandleMessageFromExternalHost(
const std::string& message,
const std::string& origin,
@@ -795,35 +776,6 @@ void ChromeRenderViewObserver::CaptureText(WebFrame* frame,
}
}
-bool ChromeRenderViewObserver::CaptureSnapshot(WebView* view,
- SkBitmap* snapshot) {
- base::TimeTicks beginning_time = base::TimeTicks::Now();
-
- view->layout();
- const WebSize& size = view->size();
-
- skia::RefPtr<SkCanvas> canvas = skia::AdoptRef(
- skia::CreatePlatformCanvas(
- size.width, size.height, true, NULL, skia::RETURN_NULL_ON_FAILURE));
- if (!canvas)
- return false;
-
- view->paint(webkit_glue::ToWebCanvas(canvas.get()),
- WebRect(0, 0, size.width, size.height));
- // TODO: Add a way to snapshot the whole page, not just the currently
- // visible part.
-
- SkDevice* device = skia::GetTopDevice(*canvas);
-
- const SkBitmap& bitmap = device->accessBitmap(false);
- if (!bitmap.copyTo(snapshot, SkBitmap::kARGB_8888_Config))
- return false;
-
- UMA_HISTOGRAM_TIMES("Renderer4.Snapshot",
- base::TimeTicks::Now() - beginning_time);
- return true;
-}
-
ExternalHostBindings* ChromeRenderViewObserver::GetExternalHostBindings() {
if (!external_host_bindings_.get()) {
external_host_bindings_.reset(new ExternalHostBindings(

Powered by Google App Engine
This is Rietveld 408576698