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

Unified Diff: cc/trees/layer_tree_impl.cc

Issue 2185823005: Make RenderViewImpl::OnForceRedraw more robust (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reimplemented using ForcedRedrawSwapPromise Created 4 years, 4 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 | « cc/trees/layer_tree_impl.h ('k') | content/browser/devtools/protocol/page_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_impl.cc
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index ff5da70a7e7ec633092d56de8cc7282b1316b21e..83502b88e7e04e985459ae813fc0725770a2cf8e 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -1483,11 +1483,16 @@ void LayerTreeImpl::QueuePinnedSwapPromise(
}
void LayerTreeImpl::PassSwapPromises(
- std::vector<std::unique_ptr<SwapPromise>>* new_swap_promise) {
- for (const auto& swap_promise : swap_promise_list_)
- swap_promise->DidNotSwap(SwapPromise::SWAP_FAILS);
+ std::vector<std::unique_ptr<SwapPromise>>* new_swap_promises) {
+ for (auto& swap_promise : swap_promise_list_) {
+ if (swap_promise->DidNotSwap(SwapPromise::SWAP_FAILS)) {
+ // |swap_promise| must remain active, so place it to |new_swap_promises|
+ // in order to keep it alive.
+ new_swap_promises->push_back(std::move(swap_promise));
+ }
+ }
swap_promise_list_.clear();
- swap_promise_list_.swap(*new_swap_promise);
+ swap_promise_list_.swap(*new_swap_promises);
}
void LayerTreeImpl::FinishSwapPromises(CompositorFrameMetadata* metadata) {
@@ -1500,9 +1505,16 @@ void LayerTreeImpl::FinishSwapPromises(CompositorFrameMetadata* metadata) {
}
void LayerTreeImpl::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) {
- for (const auto& swap_promise : swap_promise_list_)
- swap_promise->DidNotSwap(reason);
- swap_promise_list_.clear();
+ {
+ std::vector<std::unique_ptr<SwapPromise>> persistent_swap_promises;
+ for (auto& swap_promise : swap_promise_list_) {
+ if (swap_promise->DidNotSwap(SwapPromise::SWAP_FAILS)) {
piman 2016/08/03 16:38:55 this should be |reason| instead of |SWAP_FAILS|
svartmetal 2016/08/04 14:58:49 Fixed.
+ persistent_swap_promises.push_back(std::move(swap_promise));
+ }
+ }
+ // |persistent_swap_promises| will remain active even when swap fails.
+ swap_promise_list_.swap(persistent_swap_promises);
+ }
for (const auto& swap_promise : pinned_swap_promise_list_)
swap_promise->DidNotSwap(reason);
piman 2016/08/03 16:38:55 Should the logic apply here too?
svartmetal 2016/08/04 14:58:48 I think, it should (to be consistent). But maybe w
pinned_swap_promise_list_.clear();
« no previous file with comments | « cc/trees/layer_tree_impl.h ('k') | content/browser/devtools/protocol/page_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698