Index: cc/trees/thread_proxy.cc |
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc |
index b25f8c23a16c819caffa216eb4fa67a3f1eaaab5..dc832a26bd79a6a73e3eb06d22450c73c62b93a9 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 { |
@@ -730,6 +748,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 |