| 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 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "cc/animation/scrollbar_animation_controller.h" | 14 #include "cc/animation/scrollbar_animation_controller.h" |
| 15 #include "cc/animation/timing_function.h" | 15 #include "cc/animation/timing_function.h" |
| 16 #include "cc/base/math_util.h" | 16 #include "cc/base/math_util.h" |
| 17 #include "cc/base/thread.h" |
| 17 #include "cc/base/util.h" | 18 #include "cc/base/util.h" |
| 18 #include "cc/debug/debug_rect_history.h" | 19 #include "cc/debug/debug_rect_history.h" |
| 19 #include "cc/debug/frame_rate_counter.h" | 20 #include "cc/debug/frame_rate_counter.h" |
| 20 #include "cc/debug/overdraw_metrics.h" | 21 #include "cc/debug/overdraw_metrics.h" |
| 21 #include "cc/debug/paint_time_counter.h" | 22 #include "cc/debug/paint_time_counter.h" |
| 22 #include "cc/debug/rendering_stats_instrumentation.h" | 23 #include "cc/debug/rendering_stats_instrumentation.h" |
| 23 #include "cc/debug/traced_value.h" | 24 #include "cc/debug/traced_value.h" |
| 24 #include "cc/input/page_scale_animation.h" | 25 #include "cc/input/page_scale_animation.h" |
| 25 #include "cc/input/top_controls_manager.h" | 26 #include "cc/input/top_controls_manager.h" |
| 26 #include "cc/layers/append_quads_data.h" | 27 #include "cc/layers/append_quads_data.h" |
| (...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 bool should_background_tick) { | 769 bool should_background_tick) { |
| 769 bool enabled = should_background_tick && | 770 bool enabled = should_background_tick && |
| 770 !animation_registrar_->active_animation_controllers().empty(); | 771 !animation_registrar_->active_animation_controllers().empty(); |
| 771 | 772 |
| 772 // Lazily create the time_source adapter so that we can vary the interval for | 773 // Lazily create the time_source adapter so that we can vary the interval for |
| 773 // testing. | 774 // testing. |
| 774 if (!time_source_client_adapter_) { | 775 if (!time_source_client_adapter_) { |
| 775 time_source_client_adapter_ = LayerTreeHostImplTimeSourceAdapter::Create( | 776 time_source_client_adapter_ = LayerTreeHostImplTimeSourceAdapter::Create( |
| 776 this, | 777 this, |
| 777 DelayBasedTimeSource::Create(LowFrequencyAnimationInterval(), | 778 DelayBasedTimeSource::Create(LowFrequencyAnimationInterval(), |
| 778 proxy_->CurrentThread())); | 779 proxy_->CurrentThread()->TaskRunner())); |
| 779 } | 780 } |
| 780 | 781 |
| 781 time_source_client_adapter_->SetActive(enabled); | 782 time_source_client_adapter_->SetActive(enabled); |
| 782 } | 783 } |
| 783 | 784 |
| 784 void LayerTreeHostImpl::SetViewportDamage(gfx::Rect damage_rect) { | 785 void LayerTreeHostImpl::SetViewportDamage(gfx::Rect damage_rect) { |
| 785 viewport_damage_rect_.Union(damage_rect); | 786 viewport_damage_rect_.Union(damage_rect); |
| 786 } | 787 } |
| 787 | 788 |
| 788 static inline RenderPass* FindRenderPassById( | 789 static inline RenderPass* FindRenderPassById( |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1510 } | 1511 } |
| 1511 | 1512 |
| 1512 // Setup BeginFrameEmulation if it's not supported natively | 1513 // Setup BeginFrameEmulation if it's not supported natively |
| 1513 if (!settings_.begin_frame_scheduling_enabled) { | 1514 if (!settings_.begin_frame_scheduling_enabled) { |
| 1514 const base::TimeDelta display_refresh_interval = | 1515 const base::TimeDelta display_refresh_interval = |
| 1515 base::TimeDelta::FromMicroseconds( | 1516 base::TimeDelta::FromMicroseconds( |
| 1516 base::Time::kMicrosecondsPerSecond / | 1517 base::Time::kMicrosecondsPerSecond / |
| 1517 settings_.refresh_rate); | 1518 settings_.refresh_rate); |
| 1518 | 1519 |
| 1519 output_surface->InitializeBeginFrameEmulation( | 1520 output_surface->InitializeBeginFrameEmulation( |
| 1520 proxy_->ImplThread(), | 1521 proxy_->ImplThread() ? proxy_->ImplThread()->TaskRunner() : NULL, |
| 1521 settings_.throttle_frame_production, | 1522 settings_.throttle_frame_production, |
| 1522 display_refresh_interval); | 1523 display_refresh_interval); |
| 1523 } | 1524 } |
| 1524 | 1525 |
| 1525 int max_frames_pending = | 1526 int max_frames_pending = |
| 1526 output_surface->capabilities().max_frames_pending; | 1527 output_surface->capabilities().max_frames_pending; |
| 1527 if (max_frames_pending <= 0) | 1528 if (max_frames_pending <= 0) |
| 1528 max_frames_pending = FrameRateController::DEFAULT_MAX_FRAMES_PENDING; | 1529 max_frames_pending = FrameRateController::DEFAULT_MAX_FRAMES_PENDING; |
| 1529 output_surface->SetMaxFramesPending(max_frames_pending); | 1530 output_surface->SetMaxFramesPending(max_frames_pending); |
| 1530 | 1531 |
| (...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2336 } | 2337 } |
| 2337 | 2338 |
| 2338 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { | 2339 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { |
| 2339 if (debug_state_.continuous_painting != debug_state.continuous_painting) | 2340 if (debug_state_.continuous_painting != debug_state.continuous_painting) |
| 2340 paint_time_counter_->ClearHistory(); | 2341 paint_time_counter_->ClearHistory(); |
| 2341 | 2342 |
| 2342 debug_state_ = debug_state; | 2343 debug_state_ = debug_state; |
| 2343 } | 2344 } |
| 2344 | 2345 |
| 2345 } // namespace cc | 2346 } // namespace cc |
| OLD | NEW |