| OLD | NEW |
| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <stack> | 8 #include <stack> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 output_surface_lost_(true), | 100 output_surface_lost_(true), |
| 101 num_failed_recreate_attempts_(0), | 101 num_failed_recreate_attempts_(0), |
| 102 settings_(settings), | 102 settings_(settings), |
| 103 debug_state_(settings.initial_debug_state), | 103 debug_state_(settings.initial_debug_state), |
| 104 overdraw_bottom_height_(0.f), | 104 overdraw_bottom_height_(0.f), |
| 105 device_scale_factor_(1.f), | 105 device_scale_factor_(1.f), |
| 106 visible_(true), | 106 visible_(true), |
| 107 page_scale_factor_(1.f), | 107 page_scale_factor_(1.f), |
| 108 min_page_scale_factor_(1.f), | 108 min_page_scale_factor_(1.f), |
| 109 max_page_scale_factor_(1.f), | 109 max_page_scale_factor_(1.f), |
| 110 trigger_idle_updates_(true), | |
| 111 has_gpu_rasterization_trigger_(false), | 110 has_gpu_rasterization_trigger_(false), |
| 112 content_is_suitable_for_gpu_rasterization_(true), | 111 content_is_suitable_for_gpu_rasterization_(true), |
| 113 background_color_(SK_ColorWHITE), | 112 background_color_(SK_ColorWHITE), |
| 114 has_transparent_background_(false), | 113 has_transparent_background_(false), |
| 115 partial_texture_update_requests_(0), | 114 partial_texture_update_requests_(0), |
| 116 in_paint_layer_contents_(false), | 115 in_paint_layer_contents_(false), |
| 117 total_frames_used_for_lcd_text_metrics_(0), | 116 total_frames_used_for_lcd_text_metrics_(0), |
| 118 id_(s_layer_tree_host_sequence_number.GetNext() + 1), | 117 id_(s_layer_tree_host_sequence_number.GetNext() + 1), |
| 119 next_commit_forces_redraw_(false), | 118 next_commit_forces_redraw_(false), |
| 120 shared_bitmap_manager_(manager) { | 119 shared_bitmap_manager_(manager) { |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 DCHECK(proxy_->IsMainThread()); | 448 DCHECK(proxy_->IsMainThread()); |
| 450 | 449 |
| 451 if (output_surface_lost_) | 450 if (output_surface_lost_) |
| 452 return; | 451 return; |
| 453 | 452 |
| 454 num_failed_recreate_attempts_ = 0; | 453 num_failed_recreate_attempts_ = 0; |
| 455 output_surface_lost_ = true; | 454 output_surface_lost_ = true; |
| 456 SetNeedsCommit(); | 455 SetNeedsCommit(); |
| 457 } | 456 } |
| 458 | 457 |
| 459 bool LayerTreeHost::CompositeAndReadback( | |
| 460 void* pixels, | |
| 461 const gfx::Rect& rect_in_device_viewport) { | |
| 462 trigger_idle_updates_ = false; | |
| 463 bool ret = proxy_->CompositeAndReadback(pixels, rect_in_device_viewport); | |
| 464 trigger_idle_updates_ = true; | |
| 465 return ret; | |
| 466 } | |
| 467 | |
| 468 void LayerTreeHost::FinishAllRendering() { | 458 void LayerTreeHost::FinishAllRendering() { |
| 469 proxy_->FinishAllRendering(); | 459 proxy_->FinishAllRendering(); |
| 470 } | 460 } |
| 471 | 461 |
| 472 void LayerTreeHost::SetDeferCommits(bool defer_commits) { | 462 void LayerTreeHost::SetDeferCommits(bool defer_commits) { |
| 473 proxy_->SetDeferCommits(defer_commits); | 463 proxy_->SetDeferCommits(defer_commits); |
| 474 } | 464 } |
| 475 | 465 |
| 476 void LayerTreeHost::DidDeferCommit() {} | 466 void LayerTreeHost::DidDeferCommit() {} |
| 477 | 467 |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 } | 823 } |
| 834 } | 824 } |
| 835 | 825 |
| 836 // Reset partial texture update requests. | 826 // Reset partial texture update requests. |
| 837 partial_texture_update_requests_ = 0; | 827 partial_texture_update_requests_ = 0; |
| 838 | 828 |
| 839 bool did_paint_content = false; | 829 bool did_paint_content = false; |
| 840 bool need_more_updates = false; | 830 bool need_more_updates = false; |
| 841 PaintLayerContents( | 831 PaintLayerContents( |
| 842 update_list, queue, &did_paint_content, &need_more_updates); | 832 update_list, queue, &did_paint_content, &need_more_updates); |
| 843 if (trigger_idle_updates_ && need_more_updates) { | 833 if (need_more_updates) { |
| 844 TRACE_EVENT0("cc", "LayerTreeHost::UpdateLayers::posting prepaint task"); | 834 TRACE_EVENT0("cc", "LayerTreeHost::UpdateLayers::posting prepaint task"); |
| 845 prepaint_callback_.Reset(base::Bind(&LayerTreeHost::TriggerPrepaint, | 835 prepaint_callback_.Reset(base::Bind(&LayerTreeHost::TriggerPrepaint, |
| 846 base::Unretained(this))); | 836 base::Unretained(this))); |
| 847 static base::TimeDelta prepaint_delay = | 837 static base::TimeDelta prepaint_delay = |
| 848 base::TimeDelta::FromMilliseconds(100); | 838 base::TimeDelta::FromMilliseconds(100); |
| 849 base::MessageLoop::current()->PostDelayedTask( | 839 base::MessageLoop::current()->PostDelayedTask( |
| 850 FROM_HERE, prepaint_callback_.callback(), prepaint_delay); | 840 FROM_HERE, prepaint_callback_.callback(), prepaint_delay); |
| 851 } | 841 } |
| 852 | 842 |
| 853 return did_paint_content; | 843 return did_paint_content; |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1264 swap_promise_list_.push_back(swap_promise.Pass()); | 1254 swap_promise_list_.push_back(swap_promise.Pass()); |
| 1265 } | 1255 } |
| 1266 | 1256 |
| 1267 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | 1257 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
| 1268 for (size_t i = 0; i < swap_promise_list_.size(); i++) | 1258 for (size_t i = 0; i < swap_promise_list_.size(); i++) |
| 1269 swap_promise_list_[i]->DidNotSwap(reason); | 1259 swap_promise_list_[i]->DidNotSwap(reason); |
| 1270 swap_promise_list_.clear(); | 1260 swap_promise_list_.clear(); |
| 1271 } | 1261 } |
| 1272 | 1262 |
| 1273 } // namespace cc | 1263 } // namespace cc |
| OLD | NEW |