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

Unified Diff: cc/trees/thread_proxy.cc

Issue 60513007: Add SwapPromise support to LayerTreeHost and LayerTreeImpl (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: add OVERRIDE to TestSwapPromise::DidNotSwap Created 7 years, 1 month 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 | « cc/trees/layer_tree_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/thread_proxy.cc
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index 89a6773ef38d8bd94fff36ecaf528e046124a866..c4b164cb0f615cfedf25edacee511eed17cd7344 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -10,6 +10,7 @@
#include "base/bind.h"
#include "base/debug/trace_event.h"
#include "base/metrics/histogram.h"
+#include "cc/base/swap_promise.h"
#include "cc/debug/benchmark_instrumentation.h"
#include "cc/input/input_handler.h"
#include "cc/output/context_provider.h"
@@ -24,6 +25,8 @@
#include "cc/trees/layer_tree_impl.h"
#include "ui/gfx/frame_time.h"
+namespace {
+
// Measured in seconds.
const double kSmoothnessTakesPriorityExpirationDelay = 0.25;
@@ -32,6 +35,21 @@ const double kCommitAndActivationDurationEstimationPercentile = 50.0;
const double kDrawDurationEstimationPercentile = 100.0;
const int kDrawDurationEstimatePaddingInMicroseconds = 0;
+class SwapPromiseChecker {
+ public:
+ explicit SwapPromiseChecker(cc::LayerTreeHost* layer_tree_host)
+ : layer_tree_host_(layer_tree_host) {}
+
+ ~SwapPromiseChecker() {
+ layer_tree_host_->BreakSwapPromises(cc::SwapPromise::COMMIT_FAILS);
+ }
+
+ private:
+ cc::LayerTreeHost* layer_tree_host_;
+};
+
+} // namespace
+
namespace cc {
struct ThreadProxy::ReadbackRequest {
@@ -754,6 +772,11 @@ void ThreadProxy::BeginMainFrame(
return;
}
+ // If the commit finishes, LayerTreeHost will transfer its swap promises to
+ // LayerTreeImpl. The destructor of SwapPromiseChecker checks LayerTressHost's
+ // swap promises.
+ SwapPromiseChecker swap_promise_checker(layer_tree_host());
+
// Do not notify the impl thread of commit requests that occur during
// the apply/animate/layout part of the BeginMainFrameAndCommit process since
// those commit requests will get painted immediately. Once we have done
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698