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

Unified Diff: content/shell/renderer/test_runner/WebTestProxy.cpp

Issue 266243002: Make displayAsyncThen use the CompositeAndReadbackAsync path. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: displayasync: Created 6 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
« no previous file with comments | « content/shell/renderer/test_runner/WebTestProxy.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/renderer/test_runner/WebTestProxy.cpp
diff --git a/content/shell/renderer/test_runner/WebTestProxy.cpp b/content/shell/renderer/test_runner/WebTestProxy.cpp
index 02cdbd4bbe8cae3cc8e785cfb9ea9bd3cf06cbb5..e44556ddc0363e1d7e96f2434b8d7394e9a1a028 100644
--- a/content/shell/renderer/test_runner/WebTestProxy.cpp
+++ b/content/shell/renderer/test_runner/WebTestProxy.cpp
@@ -489,19 +489,23 @@ void WebTestProxyBase::didCompositeAndReadback(const SkBitmap& bitmap) {
void WebTestProxyBase::CapturePixelsAsync(
base::Callback<void(const SkBitmap&)> callback) {
- m_compositeAndReadbackCallback = callback;
TRACE_EVENT0("shell", "WebTestProxyBase::CapturePixelsAsync");
+ m_compositeAndReadbackCallback = callback;
+
// Do a layout here because it might leave compositing mode! x.x
// TODO(danakj): Remove this when we have kForceCompositingMode everywhere.
webWidget()->layout();
- if (!webWidget()->compositeAndReadbackAsync(this)) {
+ if (!webWidget()->isAcceleratedCompositingActive()) {
danakj 2014/05/05 18:35:17 This was the only way that compositeAndReadbackAsy
TRACE_EVENT0("shell",
"WebTestProxyBase::CapturePixelsAsync "
- "compositeAndReadbackAsync failed");
+ "isAcceleratedCompositingActive false");
didCompositeAndReadback(SkBitmap());
+ return;
}
+
+ webWidget()->compositeAndReadbackAsync(this);
}
void WebTestProxyBase::setLogConsoleOutput(bool enabled)
@@ -597,8 +601,7 @@ SkCanvas* WebTestProxyBase::canvas()
return m_canvas.get();
}
-void WebTestProxyBase::display(base::Closure callback)
-{
+void WebTestProxyBase::DisplayForSoftwareMode(const base::Closure& callback) {
const blink::WebSize& size = webWidget()->size();
WebRect rect(0, 0, size.width, size.height);
m_paintRect = rect;
@@ -608,15 +611,33 @@ void WebTestProxyBase::display(base::Closure callback)
callback.Run();
}
+void WebTestProxyBase::DidDisplayAsync(const base::Closure& callback,
+ const SkBitmap& bitmap) {
+ if (!callback.is_null())
+ callback.Run();
+}
+
void WebTestProxyBase::displayAsyncThen(base::Closure callback)
{
- // TODO(enne): When compositing, this should invoke a real rAF, paint,
- // and commit. For now, just make sure that displayAsync is actually
- // async so that callers can't depend on synchronous behavior.
- m_delegate->postTask(new ClosureTask(
- this,
- base::Bind(
- &WebTestProxyBase::display, base::Unretained(this), callback)));
+ TRACE_EVENT0("shell", "WebTestProxyBase::displayAsyncThen");
+
+ // TODO(danakj): Just call CapturePixelsAsyc when we have
+ // kForceCompositingMode everywhere.
+
+ // Do a layout here because it might leave compositing mode! x.x
+ webWidget()->layout();
+
+ if (!webWidget()->isAcceleratedCompositingActive()) {
+ TRACE_EVENT0("shell",
+ "WebTestProxyBase::displayAsyncThen "
+ "isAcceleratedCompositingActive false");
+ DisplayForSoftwareMode(callback);
+ return;
+ }
+
+ m_compositeAndReadbackCallback = base::Bind(
danakj 2014/05/05 18:35:17 I could call CapturePixelsAsync here instead of se
enne (OOO) 2014/05/05 19:55:13 Yeah, I think that'd be cleaner. Can you just mov
+ &WebTestProxyBase::DidDisplayAsync, base::Unretained(this), callback);
+ webWidget()->compositeAndReadbackAsync(this);
}
void WebTestProxyBase::discardBackingStore()
« no previous file with comments | « content/shell/renderer/test_runner/WebTestProxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698