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_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 last_sent_memory_visible_and_nearby_bytes_(0), | 228 last_sent_memory_visible_and_nearby_bytes_(0), |
229 last_sent_memory_use_bytes_(0), | 229 last_sent_memory_use_bytes_(0), |
230 zero_budget_(false), | 230 zero_budget_(false), |
231 device_scale_factor_(1.f), | 231 device_scale_factor_(1.f), |
232 overhang_ui_resource_id_(0), | 232 overhang_ui_resource_id_(0), |
233 overdraw_bottom_height_(0.f), | 233 overdraw_bottom_height_(0.f), |
234 device_viewport_valid_for_tile_management_(true), | 234 device_viewport_valid_for_tile_management_(true), |
235 external_stencil_test_enabled_(false), | 235 external_stencil_test_enabled_(false), |
236 animation_registrar_(AnimationRegistrar::Create()), | 236 animation_registrar_(AnimationRegistrar::Create()), |
237 rendering_stats_instrumentation_(rendering_stats_instrumentation), | 237 rendering_stats_instrumentation_(rendering_stats_instrumentation), |
| 238 micro_benchmark_controller_(this), |
238 need_to_update_visible_tiles_before_draw_(false), | 239 need_to_update_visible_tiles_before_draw_(false), |
239 shared_bitmap_manager_(manager) { | 240 shared_bitmap_manager_(manager) { |
240 DCHECK(proxy_->IsImplThread()); | 241 DCHECK(proxy_->IsImplThread()); |
241 DidVisibilityChange(this, visible_); | 242 DidVisibilityChange(this, visible_); |
242 | 243 |
243 SetDebugState(settings.initial_debug_state); | 244 SetDebugState(settings.initial_debug_state); |
244 | 245 |
245 if (settings.calculate_top_controls_position) { | 246 if (settings.calculate_top_controls_position) { |
246 top_controls_manager_ = | 247 top_controls_manager_ = |
247 TopControlsManager::Create(this, | 248 TopControlsManager::Create(this, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 NotifyReadyToActivate(); | 295 NotifyReadyToActivate(); |
295 else | 296 else |
296 ManageTiles(); | 297 ManageTiles(); |
297 } else { | 298 } else { |
298 active_tree_->set_needs_update_draw_properties(); | 299 active_tree_->set_needs_update_draw_properties(); |
299 if (time_source_client_adapter_ && time_source_client_adapter_->Active()) | 300 if (time_source_client_adapter_ && time_source_client_adapter_->Active()) |
300 DCHECK(active_tree_->root_layer()); | 301 DCHECK(active_tree_->root_layer()); |
301 } | 302 } |
302 | 303 |
303 client_->SendManagedMemoryStats(); | 304 client_->SendManagedMemoryStats(); |
| 305 |
| 306 micro_benchmark_controller_.DidCompleteCommit(); |
304 } | 307 } |
305 | 308 |
306 bool LayerTreeHostImpl::CanDraw() const { | 309 bool LayerTreeHostImpl::CanDraw() const { |
307 // Note: If you are changing this function or any other function that might | 310 // Note: If you are changing this function or any other function that might |
308 // affect the result of CanDraw, make sure to call | 311 // affect the result of CanDraw, make sure to call |
309 // client_->OnCanDrawStateChanged in the proper places and update the | 312 // client_->OnCanDrawStateChanged in the proper places and update the |
310 // NotifyIfCanDrawChanged test. | 313 // NotifyIfCanDrawChanged test. |
311 | 314 |
312 if (!renderer_) { | 315 if (!renderer_) { |
313 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw no renderer", | 316 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw no renderer", |
(...skipping 2521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2835 void LayerTreeHostImpl::MarkUIResourceNotEvicted(UIResourceId uid) { | 2838 void LayerTreeHostImpl::MarkUIResourceNotEvicted(UIResourceId uid) { |
2836 std::set<UIResourceId>::iterator found_in_evicted = | 2839 std::set<UIResourceId>::iterator found_in_evicted = |
2837 evicted_ui_resources_.find(uid); | 2840 evicted_ui_resources_.find(uid); |
2838 if (found_in_evicted == evicted_ui_resources_.end()) | 2841 if (found_in_evicted == evicted_ui_resources_.end()) |
2839 return; | 2842 return; |
2840 evicted_ui_resources_.erase(found_in_evicted); | 2843 evicted_ui_resources_.erase(found_in_evicted); |
2841 if (evicted_ui_resources_.empty()) | 2844 if (evicted_ui_resources_.empty()) |
2842 client_->OnCanDrawStateChanged(CanDraw()); | 2845 client_->OnCanDrawStateChanged(CanDraw()); |
2843 } | 2846 } |
2844 | 2847 |
| 2848 void LayerTreeHostImpl::ScheduleMicroBenchmark( |
| 2849 scoped_ptr<MicroBenchmarkImpl> benchmark) { |
| 2850 micro_benchmark_controller_.ScheduleRun(benchmark.Pass()); |
| 2851 } |
| 2852 |
2845 } // namespace cc | 2853 } // namespace cc |
OLD | NEW |