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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 DCHECK(proxy_->IsMainThread()); | 446 DCHECK(proxy_->IsMainThread()); |
448 | 447 |
449 if (output_surface_lost_) | 448 if (output_surface_lost_) |
450 return; | 449 return; |
451 | 450 |
452 num_failed_recreate_attempts_ = 0; | 451 num_failed_recreate_attempts_ = 0; |
453 output_surface_lost_ = true; | 452 output_surface_lost_ = true; |
454 SetNeedsCommit(); | 453 SetNeedsCommit(); |
455 } | 454 } |
456 | 455 |
457 bool LayerTreeHost::CompositeAndReadback( | |
458 void* pixels, | |
459 const gfx::Rect& rect_in_device_viewport) { | |
460 trigger_idle_updates_ = false; | |
461 bool ret = proxy_->CompositeAndReadback(pixels, rect_in_device_viewport); | |
462 trigger_idle_updates_ = true; | |
463 return ret; | |
464 } | |
465 | |
466 void LayerTreeHost::FinishAllRendering() { | 456 void LayerTreeHost::FinishAllRendering() { |
467 proxy_->FinishAllRendering(); | 457 proxy_->FinishAllRendering(); |
468 } | 458 } |
469 | 459 |
470 void LayerTreeHost::SetDeferCommits(bool defer_commits) { | 460 void LayerTreeHost::SetDeferCommits(bool defer_commits) { |
471 proxy_->SetDeferCommits(defer_commits); | 461 proxy_->SetDeferCommits(defer_commits); |
472 } | 462 } |
473 | 463 |
474 void LayerTreeHost::DidDeferCommit() {} | 464 void LayerTreeHost::DidDeferCommit() {} |
475 | 465 |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 } | 821 } |
832 } | 822 } |
833 | 823 |
834 // Reset partial texture update requests. | 824 // Reset partial texture update requests. |
835 partial_texture_update_requests_ = 0; | 825 partial_texture_update_requests_ = 0; |
836 | 826 |
837 bool did_paint_content = false; | 827 bool did_paint_content = false; |
838 bool need_more_updates = false; | 828 bool need_more_updates = false; |
839 PaintLayerContents( | 829 PaintLayerContents( |
840 update_list, queue, &did_paint_content, &need_more_updates); | 830 update_list, queue, &did_paint_content, &need_more_updates); |
841 if (trigger_idle_updates_ && need_more_updates) { | 831 if (need_more_updates) { |
842 TRACE_EVENT0("cc", "LayerTreeHost::UpdateLayers::posting prepaint task"); | 832 TRACE_EVENT0("cc", "LayerTreeHost::UpdateLayers::posting prepaint task"); |
843 prepaint_callback_.Reset(base::Bind(&LayerTreeHost::TriggerPrepaint, | 833 prepaint_callback_.Reset(base::Bind(&LayerTreeHost::TriggerPrepaint, |
844 base::Unretained(this))); | 834 base::Unretained(this))); |
845 static base::TimeDelta prepaint_delay = | 835 static base::TimeDelta prepaint_delay = |
846 base::TimeDelta::FromMilliseconds(100); | 836 base::TimeDelta::FromMilliseconds(100); |
847 base::MessageLoop::current()->PostDelayedTask( | 837 base::MessageLoop::current()->PostDelayedTask( |
848 FROM_HERE, prepaint_callback_.callback(), prepaint_delay); | 838 FROM_HERE, prepaint_callback_.callback(), prepaint_delay); |
849 } | 839 } |
850 | 840 |
851 return did_paint_content; | 841 return did_paint_content; |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 swap_promise_list_.push_back(swap_promise.Pass()); | 1252 swap_promise_list_.push_back(swap_promise.Pass()); |
1263 } | 1253 } |
1264 | 1254 |
1265 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | 1255 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
1266 for (size_t i = 0; i < swap_promise_list_.size(); i++) | 1256 for (size_t i = 0; i < swap_promise_list_.size(); i++) |
1267 swap_promise_list_[i]->DidNotSwap(reason); | 1257 swap_promise_list_[i]->DidNotSwap(reason); |
1268 swap_promise_list_.clear(); | 1258 swap_promise_list_.clear(); |
1269 } | 1259 } |
1270 | 1260 |
1271 } // namespace cc | 1261 } // namespace cc |
OLD | NEW |