| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 ResourceProvider* resource_provider) { | 230 ResourceProvider* resource_provider) { |
| 231 DCHECK(proxy_->IsImplThread()); | 231 DCHECK(proxy_->IsImplThread()); |
| 232 if (contents_texture_manager_) | 232 if (contents_texture_manager_) |
| 233 contents_texture_manager_->ClearAllMemory(resource_provider); | 233 contents_texture_manager_->ClearAllMemory(resource_provider); |
| 234 } | 234 } |
| 235 | 235 |
| 236 void LayerTreeHost::DidBeginMainFrame() { | 236 void LayerTreeHost::DidBeginMainFrame() { |
| 237 client_->DidBeginMainFrame(); | 237 client_->DidBeginMainFrame(); |
| 238 } | 238 } |
| 239 | 239 |
| 240 void LayerTreeHost::UpdateClientAnimations(base::TimeTicks frame_begin_time) { | 240 void LayerTreeHost::BeginMainFrame(const BeginFrameArgs& args) { |
| 241 animating_ = true; | 241 inside_begin_main_frame_ = true; |
| 242 client_->Animate(frame_begin_time); | 242 client_->BeginMainFrame(args); |
| 243 animating_ = false; | 243 inside_begin_main_frame_ = false; |
| 244 } | 244 } |
| 245 | 245 |
| 246 void LayerTreeHost::DidStopFlinging() { | 246 void LayerTreeHost::DidStopFlinging() { |
| 247 proxy_->MainThreadHasStoppedFlinging(); | 247 proxy_->MainThreadHasStoppedFlinging(); |
| 248 } | 248 } |
| 249 | 249 |
| 250 void LayerTreeHost::Layout() { | 250 void LayerTreeHost::Layout() { |
| 251 client_->Layout(); | 251 client_->Layout(); |
| 252 } | 252 } |
| 253 | 253 |
| (...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 } | 1075 } |
| 1076 ApplyPageScaleDeltaFromImplSide(info.page_scale_delta); | 1076 ApplyPageScaleDeltaFromImplSide(info.page_scale_delta); |
| 1077 | 1077 |
| 1078 client_->ApplyScrollAndScale( | 1078 client_->ApplyScrollAndScale( |
| 1079 inner_viewport_scroll_delta + outer_viewport_scroll_delta, | 1079 inner_viewport_scroll_delta + outer_viewport_scroll_delta, |
| 1080 info.page_scale_delta); | 1080 info.page_scale_delta); |
| 1081 } | 1081 } |
| 1082 } | 1082 } |
| 1083 | 1083 |
| 1084 void LayerTreeHost::StartRateLimiter() { | 1084 void LayerTreeHost::StartRateLimiter() { |
| 1085 if (animating_) | 1085 if (inside_begin_main_frame_) |
| 1086 return; | 1086 return; |
| 1087 | 1087 |
| 1088 if (!rate_limit_timer_.IsRunning()) { | 1088 if (!rate_limit_timer_.IsRunning()) { |
| 1089 rate_limit_timer_.Start(FROM_HERE, | 1089 rate_limit_timer_.Start(FROM_HERE, |
| 1090 base::TimeDelta(), | 1090 base::TimeDelta(), |
| 1091 this, | 1091 this, |
| 1092 &LayerTreeHost::RateLimit); | 1092 &LayerTreeHost::RateLimit); |
| 1093 } | 1093 } |
| 1094 } | 1094 } |
| 1095 | 1095 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1285 swap_promise_list_.push_back(swap_promise.Pass()); | 1285 swap_promise_list_.push_back(swap_promise.Pass()); |
| 1286 } | 1286 } |
| 1287 | 1287 |
| 1288 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | 1288 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
| 1289 for (size_t i = 0; i < swap_promise_list_.size(); i++) | 1289 for (size_t i = 0; i < swap_promise_list_.size(); i++) |
| 1290 swap_promise_list_[i]->DidNotSwap(reason); | 1290 swap_promise_list_[i]->DidNotSwap(reason); |
| 1291 swap_promise_list_.clear(); | 1291 swap_promise_list_.clear(); |
| 1292 } | 1292 } |
| 1293 | 1293 |
| 1294 } // namespace cc | 1294 } // namespace cc |
| OLD | NEW |