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

Unified Diff: cc/trees/layer_tree_impl.cc

Issue 1126963006: Move VISUAL_STATE promise to activation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: amend comments Created 5 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
Index: cc/trees/layer_tree_impl.cc
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index 27688591420284b6853c22b0b7cb93350d623402..01a4cfd19ec4a53ace4d83314cb4c2dc60bf2774 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -70,7 +70,8 @@ LayerTreeImpl::LayerTreeImpl(
}
LayerTreeImpl::~LayerTreeImpl() {
- BreakSwapPromises(SwapPromise::SWAP_FAILS);
+ BreakSwapPromises(IsActiveTree() ? SwapPromise::SWAP_FAILS
+ : SwapPromise::ACTIVATION_FAILS);
// Need to explicitly clear the tree prior to destroying this so that
// the LayerTreeImpl pointer is still valid in the LayerImpl dtor.
@@ -744,6 +745,8 @@ void LayerTreeImpl::DidBecomeActive() {
root_layer(), [](LayerImpl* layer) { layer->DidBecomeActive(); });
}
+ for (auto* swap_promise : swap_promise_list_)
+ swap_promise->DidActivate();
devtools_instrumentation::DidActivateLayerTree(layer_tree_host_impl_->id(),
source_frame_number_);
}
@@ -990,8 +993,8 @@ void LayerTreeImpl::AsValueInto(base::trace_event::TracedValue* state) const {
state->EndArray();
state->BeginArray("swap_promise_trace_ids");
- for (size_t i = 0; i < swap_promise_list_.size(); i++)
- state->AppendDouble(swap_promise_list_[i]->TraceId());
+ for (auto* swap_promise : swap_promise_list_)
+ state->AppendDouble(swap_promise->TraceId());
state->EndArray();
}
@@ -1072,20 +1075,20 @@ void LayerTreeImpl::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) {
void LayerTreeImpl::PassSwapPromises(
ScopedPtrVector<SwapPromise>* new_swap_promise) {
- swap_promise_list_.insert_and_take(swap_promise_list_.end(),
- new_swap_promise);
- new_swap_promise->clear();
+ // Any left over promises have failed to swap before the next frame.
+ BreakSwapPromises(SwapPromise::SWAP_FAILS);
+ swap_promise_list_.swap(*new_swap_promise);
}
void LayerTreeImpl::FinishSwapPromises(CompositorFrameMetadata* metadata) {
- for (size_t i = 0; i < swap_promise_list_.size(); i++)
- swap_promise_list_[i]->DidSwap(metadata);
+ for (auto* swap_promise : swap_promise_list_)
+ swap_promise->DidSwap(metadata);
swap_promise_list_.clear();
}
void LayerTreeImpl::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) {
- for (size_t i = 0; i < swap_promise_list_.size(); i++)
- swap_promise_list_[i]->DidNotSwap(reason);
+ for (auto* swap_promise : swap_promise_list_)
+ swap_promise->DidNotSwap(reason);
swap_promise_list_.clear();
}
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | content/browser/android/in_process/synchronous_compositor_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698