| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, | 89 LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, |
| 90 SharedBitmapManager* manager, | 90 SharedBitmapManager* manager, |
| 91 const LayerTreeSettings& settings) | 91 const LayerTreeSettings& settings) |
| 92 : micro_benchmark_controller_(this), | 92 : micro_benchmark_controller_(this), |
| 93 next_ui_resource_id_(1), | 93 next_ui_resource_id_(1), |
| 94 animating_(false), | 94 animating_(false), |
| 95 needs_full_tree_sync_(true), | 95 needs_full_tree_sync_(true), |
| 96 client_(client), | 96 client_(client), |
| 97 source_frame_number_(0), | 97 source_frame_number_(0), |
| 98 rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()), | 98 rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()), |
| 99 output_surface_can_be_initialized_(true), | |
| 100 output_surface_lost_(true), | 99 output_surface_lost_(true), |
| 101 num_failed_recreate_attempts_(0), | 100 num_failed_recreate_attempts_(0), |
| 102 settings_(settings), | 101 settings_(settings), |
| 103 debug_state_(settings.initial_debug_state), | 102 debug_state_(settings.initial_debug_state), |
| 104 overdraw_bottom_height_(0.f), | 103 overdraw_bottom_height_(0.f), |
| 105 device_scale_factor_(1.f), | 104 device_scale_factor_(1.f), |
| 106 visible_(true), | 105 visible_(true), |
| 107 page_scale_factor_(1.f), | 106 page_scale_factor_(1.f), |
| 108 min_page_scale_factor_(1.f), | 107 min_page_scale_factor_(1.f), |
| 109 max_page_scale_factor_(1.f), | 108 max_page_scale_factor_(1.f), |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 SetNeedsCommit(); | 690 SetNeedsCommit(); |
| 692 } | 691 } |
| 693 | 692 |
| 694 void LayerTreeHost::NotifyInputThrottledUntilCommit() { | 693 void LayerTreeHost::NotifyInputThrottledUntilCommit() { |
| 695 proxy_->NotifyInputThrottledUntilCommit(); | 694 proxy_->NotifyInputThrottledUntilCommit(); |
| 696 } | 695 } |
| 697 | 696 |
| 698 void LayerTreeHost::Composite(base::TimeTicks frame_begin_time) { | 697 void LayerTreeHost::Composite(base::TimeTicks frame_begin_time) { |
| 699 DCHECK(!proxy_->HasImplThread()); | 698 DCHECK(!proxy_->HasImplThread()); |
| 700 SingleThreadProxy* proxy = static_cast<SingleThreadProxy*>(proxy_.get()); | 699 SingleThreadProxy* proxy = static_cast<SingleThreadProxy*>(proxy_.get()); |
| 700 |
| 701 if (output_surface_lost_) |
| 702 proxy->CreateAndInitializeOutputSurface(); |
| 703 if (output_surface_lost_) |
| 704 return; |
| 705 |
| 701 proxy->CompositeImmediately(frame_begin_time); | 706 proxy->CompositeImmediately(frame_begin_time); |
| 702 } | 707 } |
| 703 | 708 |
| 704 bool LayerTreeHost::InitializeOutputSurfaceIfNeeded() { | |
| 705 if (!output_surface_can_be_initialized_) | |
| 706 return false; | |
| 707 | |
| 708 if (output_surface_lost_) | |
| 709 proxy_->CreateAndInitializeOutputSurface(); | |
| 710 return !output_surface_lost_; | |
| 711 } | |
| 712 | |
| 713 bool LayerTreeHost::UpdateLayers(ResourceUpdateQueue* queue) { | 709 bool LayerTreeHost::UpdateLayers(ResourceUpdateQueue* queue) { |
| 714 DCHECK(!output_surface_lost_); | 710 DCHECK(!output_surface_lost_); |
| 715 | 711 |
| 716 if (!root_layer()) | 712 if (!root_layer()) |
| 717 return false; | 713 return false; |
| 718 | 714 |
| 719 DCHECK(!root_layer()->parent()); | 715 DCHECK(!root_layer()->parent()); |
| 720 | 716 |
| 721 bool result = UpdateLayers(root_layer(), queue); | 717 bool result = UpdateLayers(root_layer(), queue); |
| 722 | 718 |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1250 swap_promise_list_.push_back(swap_promise.Pass()); | 1246 swap_promise_list_.push_back(swap_promise.Pass()); |
| 1251 } | 1247 } |
| 1252 | 1248 |
| 1253 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | 1249 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
| 1254 for (size_t i = 0; i < swap_promise_list_.size(); i++) | 1250 for (size_t i = 0; i < swap_promise_list_.size(); i++) |
| 1255 swap_promise_list_[i]->DidNotSwap(reason); | 1251 swap_promise_list_[i]->DidNotSwap(reason); |
| 1256 swap_promise_list_.clear(); | 1252 swap_promise_list_.clear(); |
| 1257 } | 1253 } |
| 1258 | 1254 |
| 1259 } // namespace cc | 1255 } // namespace cc |
| OLD | NEW |