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

Side by Side Diff: cc/trees/layer_tree_host.cc

Issue 2185823005: Make RenderViewImpl::OnForceRedraw more robust (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 sync_tree->SetPropertyTrees(&property_trees_); 510 sync_tree->SetPropertyTrees(&property_trees_);
511 511
512 sync_tree->PushPageScaleFromMainThread( 512 sync_tree->PushPageScaleFromMainThread(
513 page_scale_factor_, min_page_scale_factor_, max_page_scale_factor_); 513 page_scale_factor_, min_page_scale_factor_, max_page_scale_factor_);
514 sync_tree->elastic_overscroll()->PushFromMainThread(elastic_overscroll_); 514 sync_tree->elastic_overscroll()->PushFromMainThread(elastic_overscroll_);
515 if (sync_tree->IsActiveTree()) 515 if (sync_tree->IsActiveTree())
516 sync_tree->elastic_overscroll()->PushPendingToActive(); 516 sync_tree->elastic_overscroll()->PushPendingToActive();
517 517
518 sync_tree->PassSwapPromises(&swap_promise_list_); 518 sync_tree->PassSwapPromises(&swap_promise_list_);
519 519
520 for (auto& swap_promise : forced_redraw_swap_promises_) {
521 host_impl->QueueForcedRedrawSwapPromise(std::move(swap_promise));
522 }
523 forced_redraw_swap_promises_.clear();
524
520 sync_tree->set_top_controls_shrink_blink_size( 525 sync_tree->set_top_controls_shrink_blink_size(
521 top_controls_shrink_blink_size_); 526 top_controls_shrink_blink_size_);
522 sync_tree->set_top_controls_height(top_controls_height_); 527 sync_tree->set_top_controls_height(top_controls_height_);
523 sync_tree->PushTopControlsFromMainThread(top_controls_shown_ratio_); 528 sync_tree->PushTopControlsFromMainThread(top_controls_shown_ratio_);
524 529
525 host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_); 530 host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_);
526 host_impl->SetContentIsSuitableForGpuRasterization( 531 host_impl->SetContentIsSuitableForGpuRasterization(
527 content_is_suitable_for_gpu_rasterization_); 532 content_is_suitable_for_gpu_rasterization_);
528 RecordGpuRasterizationHistogram(); 533 RecordGpuRasterizationHistogram();
529 534
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 return proxy_->BeginMainFrameRequested(); 747 return proxy_->BeginMainFrameRequested();
743 } 748 }
744 749
745 void LayerTreeHost::SetNextCommitWaitsForActivation() { 750 void LayerTreeHost::SetNextCommitWaitsForActivation() {
746 proxy_->SetNextCommitWaitsForActivation(); 751 proxy_->SetNextCommitWaitsForActivation();
747 } 752 }
748 753
749 void LayerTreeHost::SetNextCommitForcesRedraw() { 754 void LayerTreeHost::SetNextCommitForcesRedraw() {
750 next_commit_forces_redraw_ = true; 755 next_commit_forces_redraw_ = true;
751 proxy_->SetNeedsUpdateLayers(); 756 proxy_->SetNeedsUpdateLayers();
757 NotifySwapPromiseMonitorsOfSetNeedsForcedRedraw();
752 } 758 }
753 759
754 void LayerTreeHost::SetAnimationEvents( 760 void LayerTreeHost::SetAnimationEvents(
755 std::unique_ptr<AnimationEvents> events) { 761 std::unique_ptr<AnimationEvents> events) {
756 DCHECK(task_runner_provider_->IsMainThread()); 762 DCHECK(task_runner_provider_->IsMainThread());
757 animation_host_->SetAnimationEvents(std::move(events)); 763 animation_host_->SetAnimationEvents(std::move(events));
758 } 764 }
759 765
760 void LayerTreeHost::SetRootLayer(scoped_refptr<Layer> root_layer) { 766 void LayerTreeHost::SetRootLayer(scoped_refptr<Layer> root_layer) {
761 if (root_layer_.get() == root_layer.get()) 767 if (root_layer_.get() == root_layer.get())
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 void LayerTreeHost::RemoveSwapPromiseMonitor(SwapPromiseMonitor* monitor) { 1284 void LayerTreeHost::RemoveSwapPromiseMonitor(SwapPromiseMonitor* monitor) {
1279 swap_promise_monitor_.erase(monitor); 1285 swap_promise_monitor_.erase(monitor);
1280 } 1286 }
1281 1287
1282 void LayerTreeHost::NotifySwapPromiseMonitorsOfSetNeedsCommit() { 1288 void LayerTreeHost::NotifySwapPromiseMonitorsOfSetNeedsCommit() {
1283 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); 1289 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin();
1284 for (; it != swap_promise_monitor_.end(); it++) 1290 for (; it != swap_promise_monitor_.end(); it++)
1285 (*it)->OnSetNeedsCommitOnMain(); 1291 (*it)->OnSetNeedsCommitOnMain();
1286 } 1292 }
1287 1293
1294 void LayerTreeHost::NotifySwapPromiseMonitorsOfSetNeedsForcedRedraw() {
1295 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin();
1296 for (; it != swap_promise_monitor_.end(); it++)
1297 (*it)->OnSetNeedsForcedRedrawOnMain();
1298 }
1299
1288 void LayerTreeHost::QueueSwapPromise( 1300 void LayerTreeHost::QueueSwapPromise(
1289 std::unique_ptr<SwapPromise> swap_promise) { 1301 std::unique_ptr<SwapPromise> swap_promise) {
1290 DCHECK(swap_promise); 1302 DCHECK(swap_promise);
1291 swap_promise_list_.push_back(std::move(swap_promise)); 1303 swap_promise_list_.push_back(std::move(swap_promise));
1292 } 1304 }
1293 1305
1306 void LayerTreeHost::QueueForcedRedrawSwapPromise(
1307 std::unique_ptr<SwapPromise> swap_promise) {
1308 forced_redraw_swap_promises_.push_back(std::move(swap_promise));
1309 }
1310
1294 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { 1311 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) {
1295 for (const auto& swap_promise : swap_promise_list_) 1312 for (const auto& swap_promise : swap_promise_list_)
1296 swap_promise->DidNotSwap(reason); 1313 swap_promise->DidNotSwap(reason);
1297 swap_promise_list_.clear(); 1314 swap_promise_list_.clear();
piman 2016/07/28 20:54:09 You also need to break the forced_redraw_swap_prom
1298 } 1315 }
1299 1316
1300 void LayerTreeHost::OnCommitForSwapPromises() { 1317 void LayerTreeHost::OnCommitForSwapPromises() {
1301 for (const auto& swap_promise : swap_promise_list_) 1318 for (const auto& swap_promise : swap_promise_list_)
1302 swap_promise->OnCommit(); 1319 swap_promise->OnCommit();
1303 } 1320 }
1304 1321
1305 void LayerTreeHost::set_surface_client_id(uint32_t client_id) { 1322 void LayerTreeHost::set_surface_client_id(uint32_t client_id) {
1306 surface_client_id_ = client_id; 1323 surface_client_id_ = client_id;
1307 } 1324 }
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1715 int seq_num = property_trees_.sequence_number; 1732 int seq_num = property_trees_.sequence_number;
1716 LayerTreeHostCommon::CallFunctionForEveryLayer(this, [seq_num](Layer* layer) { 1733 LayerTreeHostCommon::CallFunctionForEveryLayer(this, [seq_num](Layer* layer) {
1717 layer->set_property_tree_sequence_number(seq_num); 1734 layer->set_property_tree_sequence_number(seq_num);
1718 }); 1735 });
1719 1736
1720 surface_client_id_ = proto.surface_client_id(); 1737 surface_client_id_ = proto.surface_client_id();
1721 next_surface_sequence_ = proto.next_surface_sequence(); 1738 next_surface_sequence_ = proto.next_surface_sequence();
1722 } 1739 }
1723 1740
1724 } // namespace cc 1741 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698