| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 layer_tree_host->InitializeSingleThreaded(single_thread_client, | 90 layer_tree_host->InitializeSingleThreaded(single_thread_client, |
| 91 main_task_runner); | 91 main_task_runner); |
| 92 return layer_tree_host.Pass(); | 92 return layer_tree_host.Pass(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, | 95 LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, |
| 96 SharedBitmapManager* manager, | 96 SharedBitmapManager* manager, |
| 97 const LayerTreeSettings& settings) | 97 const LayerTreeSettings& settings) |
| 98 : micro_benchmark_controller_(this), | 98 : micro_benchmark_controller_(this), |
| 99 next_ui_resource_id_(1), | 99 next_ui_resource_id_(1), |
| 100 animating_(false), | 100 inside_begin_main_frame_(false), |
| 101 needs_full_tree_sync_(true), | 101 needs_full_tree_sync_(true), |
| 102 client_(client), | 102 client_(client), |
| 103 source_frame_number_(0), | 103 source_frame_number_(0), |
| 104 rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()), | 104 rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()), |
| 105 output_surface_lost_(true), | 105 output_surface_lost_(true), |
| 106 num_failed_recreate_attempts_(0), | 106 num_failed_recreate_attempts_(0), |
| 107 settings_(settings), | 107 settings_(settings), |
| 108 debug_state_(settings.initial_debug_state), | 108 debug_state_(settings.initial_debug_state), |
| 109 overdraw_bottom_height_(0.f), | 109 overdraw_bottom_height_(0.f), |
| 110 device_scale_factor_(1.f), | 110 device_scale_factor_(1.f), |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 ResourceProvider* resource_provider) { | 232 ResourceProvider* resource_provider) { |
| 233 DCHECK(proxy_->IsImplThread()); | 233 DCHECK(proxy_->IsImplThread()); |
| 234 if (contents_texture_manager_) | 234 if (contents_texture_manager_) |
| 235 contents_texture_manager_->ClearAllMemory(resource_provider); | 235 contents_texture_manager_->ClearAllMemory(resource_provider); |
| 236 } | 236 } |
| 237 | 237 |
| 238 void LayerTreeHost::DidBeginMainFrame() { | 238 void LayerTreeHost::DidBeginMainFrame() { |
| 239 client_->DidBeginMainFrame(); | 239 client_->DidBeginMainFrame(); |
| 240 } | 240 } |
| 241 | 241 |
| 242 void LayerTreeHost::UpdateClientAnimations(base::TimeTicks frame_begin_time) { | 242 void LayerTreeHost::BeginMainFrame(const BeginFrameArgs& args) { |
| 243 animating_ = true; | 243 inside_begin_main_frame_ = true; |
| 244 client_->Animate(frame_begin_time); | 244 client_->BeginMainFrame(args); |
| 245 animating_ = false; | 245 inside_begin_main_frame_ = false; |
| 246 } | 246 } |
| 247 | 247 |
| 248 void LayerTreeHost::DidStopFlinging() { | 248 void LayerTreeHost::DidStopFlinging() { |
| 249 proxy_->MainThreadHasStoppedFlinging(); | 249 proxy_->MainThreadHasStoppedFlinging(); |
| 250 } | 250 } |
| 251 | 251 |
| 252 void LayerTreeHost::Layout() { | 252 void LayerTreeHost::Layout() { |
| 253 client_->Layout(); | 253 client_->Layout(); |
| 254 } | 254 } |
| 255 | 255 |
| (...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1086 } | 1086 } |
| 1087 ApplyPageScaleDeltaFromImplSide(info->page_scale_delta); | 1087 ApplyPageScaleDeltaFromImplSide(info->page_scale_delta); |
| 1088 | 1088 |
| 1089 client_->ApplyScrollAndScale( | 1089 client_->ApplyScrollAndScale( |
| 1090 inner_viewport_scroll_delta + outer_viewport_scroll_delta, | 1090 inner_viewport_scroll_delta + outer_viewport_scroll_delta, |
| 1091 info->page_scale_delta); | 1091 info->page_scale_delta); |
| 1092 } | 1092 } |
| 1093 } | 1093 } |
| 1094 | 1094 |
| 1095 void LayerTreeHost::StartRateLimiter() { | 1095 void LayerTreeHost::StartRateLimiter() { |
| 1096 if (animating_) | 1096 if (inside_begin_main_frame_) |
| 1097 return; | 1097 return; |
| 1098 | 1098 |
| 1099 if (!rate_limit_timer_.IsRunning()) { | 1099 if (!rate_limit_timer_.IsRunning()) { |
| 1100 rate_limit_timer_.Start(FROM_HERE, | 1100 rate_limit_timer_.Start(FROM_HERE, |
| 1101 base::TimeDelta(), | 1101 base::TimeDelta(), |
| 1102 this, | 1102 this, |
| 1103 &LayerTreeHost::RateLimit); | 1103 &LayerTreeHost::RateLimit); |
| 1104 } | 1104 } |
| 1105 } | 1105 } |
| 1106 | 1106 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1296 swap_promise_list_.push_back(swap_promise.Pass()); | 1296 swap_promise_list_.push_back(swap_promise.Pass()); |
| 1297 } | 1297 } |
| 1298 | 1298 |
| 1299 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | 1299 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
| 1300 for (size_t i = 0; i < swap_promise_list_.size(); i++) | 1300 for (size_t i = 0; i < swap_promise_list_.size(); i++) |
| 1301 swap_promise_list_[i]->DidNotSwap(reason); | 1301 swap_promise_list_[i]->DidNotSwap(reason); |
| 1302 swap_promise_list_.clear(); | 1302 swap_promise_list_.clear(); |
| 1303 } | 1303 } |
| 1304 | 1304 |
| 1305 } // namespace cc | 1305 } // namespace cc |
| OLD | NEW |