| 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 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 #include "cc/scheduler/delay_based_time_source.h" | 69 #include "cc/scheduler/delay_based_time_source.h" |
| 70 #include "cc/trees/damage_tracker.h" | 70 #include "cc/trees/damage_tracker.h" |
| 71 #include "cc/trees/latency_info_swap_promise_monitor.h" | 71 #include "cc/trees/latency_info_swap_promise_monitor.h" |
| 72 #include "cc/trees/layer_tree_host.h" | 72 #include "cc/trees/layer_tree_host.h" |
| 73 #include "cc/trees/layer_tree_host_common.h" | 73 #include "cc/trees/layer_tree_host_common.h" |
| 74 #include "cc/trees/layer_tree_impl.h" | 74 #include "cc/trees/layer_tree_impl.h" |
| 75 #include "cc/trees/single_thread_proxy.h" | 75 #include "cc/trees/single_thread_proxy.h" |
| 76 #include "cc/trees/tree_synchronizer.h" | 76 #include "cc/trees/tree_synchronizer.h" |
| 77 #include "gpu/GLES2/gl2extchromium.h" | 77 #include "gpu/GLES2/gl2extchromium.h" |
| 78 #include "gpu/command_buffer/client/gles2_interface.h" | 78 #include "gpu/command_buffer/client/gles2_interface.h" |
| 79 #include "ui/gfx/frame_time.h" | 79 |
| 80 #include "ui/gfx/geometry/rect_conversions.h" | 80 #include "ui/gfx/geometry/rect_conversions.h" |
| 81 #include "ui/gfx/geometry/scroll_offset.h" | 81 #include "ui/gfx/geometry/scroll_offset.h" |
| 82 #include "ui/gfx/geometry/size_conversions.h" | 82 #include "ui/gfx/geometry/size_conversions.h" |
| 83 #include "ui/gfx/geometry/vector2d_conversions.h" | 83 #include "ui/gfx/geometry/vector2d_conversions.h" |
| 84 | 84 |
| 85 namespace cc { | 85 namespace cc { |
| 86 namespace { | 86 namespace { |
| 87 | 87 |
| 88 // Small helper class that saves the current viewport location as the user sees | 88 // Small helper class that saves the current viewport location as the user sees |
| 89 // it and resets to the same location. | 89 // it and resets to the same location. |
| (...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1668 return true; | 1668 return true; |
| 1669 } | 1669 } |
| 1670 | 1670 |
| 1671 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { | 1671 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { |
| 1672 // Sample the frame time now. This time will be used for updating animations | 1672 // Sample the frame time now. This time will be used for updating animations |
| 1673 // when we draw. | 1673 // when we draw. |
| 1674 DCHECK(!current_begin_frame_args_.IsValid()); | 1674 DCHECK(!current_begin_frame_args_.IsValid()); |
| 1675 current_begin_frame_args_ = args; | 1675 current_begin_frame_args_ = args; |
| 1676 // TODO(mithro): Stop overriding the frame time once the usage of frame | 1676 // TODO(mithro): Stop overriding the frame time once the usage of frame |
| 1677 // timing is unified. | 1677 // timing is unified. |
| 1678 current_begin_frame_args_.frame_time = gfx::FrameTime::Now(); | 1678 current_begin_frame_args_.frame_time = base::TimeTicks::Now(); |
| 1679 | 1679 |
| 1680 // Cache the begin impl frame interval | 1680 // Cache the begin impl frame interval |
| 1681 begin_impl_frame_interval_ = args.interval; | 1681 begin_impl_frame_interval_ = args.interval; |
| 1682 | 1682 |
| 1683 if (is_likely_to_require_a_draw_) { | 1683 if (is_likely_to_require_a_draw_) { |
| 1684 // Optimistically schedule a draw. This will let us expect the tile manager | 1684 // Optimistically schedule a draw. This will let us expect the tile manager |
| 1685 // to complete its work so that we can draw new tiles within the impl frame | 1685 // to complete its work so that we can draw new tiles within the impl frame |
| 1686 // we are beginning now. | 1686 // we are beginning now. |
| 1687 SetNeedsRedraw(); | 1687 SetNeedsRedraw(); |
| 1688 } | 1688 } |
| (...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3147 return global_tile_state_.tree_priority; | 3147 return global_tile_state_.tree_priority; |
| 3148 } | 3148 } |
| 3149 | 3149 |
| 3150 BeginFrameArgs LayerTreeHostImpl::CurrentBeginFrameArgs() const { | 3150 BeginFrameArgs LayerTreeHostImpl::CurrentBeginFrameArgs() const { |
| 3151 // Try to use the current frame time to keep animations non-jittery. But if | 3151 // Try to use the current frame time to keep animations non-jittery. But if |
| 3152 // we're not in a frame (because this is during an input event or a delayed | 3152 // we're not in a frame (because this is during an input event or a delayed |
| 3153 // task), fall back to physical time. This should still be monotonic. | 3153 // task), fall back to physical time. This should still be monotonic. |
| 3154 if (current_begin_frame_args_.IsValid()) | 3154 if (current_begin_frame_args_.IsValid()) |
| 3155 return current_begin_frame_args_; | 3155 return current_begin_frame_args_; |
| 3156 return BeginFrameArgs::Create( | 3156 return BeginFrameArgs::Create( |
| 3157 BEGINFRAME_FROM_HERE, gfx::FrameTime::Now(), base::TimeTicks(), | 3157 BEGINFRAME_FROM_HERE, base::TimeTicks::Now(), base::TimeTicks(), |
| 3158 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL); | 3158 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL); |
| 3159 } | 3159 } |
| 3160 | 3160 |
| 3161 scoped_refptr<base::trace_event::ConvertableToTraceFormat> | 3161 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
| 3162 LayerTreeHostImpl::AsValueWithFrame(FrameData* frame) const { | 3162 LayerTreeHostImpl::AsValueWithFrame(FrameData* frame) const { |
| 3163 scoped_refptr<base::trace_event::TracedValue> state = | 3163 scoped_refptr<base::trace_event::TracedValue> state = |
| 3164 new base::trace_event::TracedValue(); | 3164 new base::trace_event::TracedValue(); |
| 3165 AsValueWithFrameInto(frame, state.get()); | 3165 AsValueWithFrameInto(frame, state.get()); |
| 3166 return state; | 3166 return state; |
| 3167 } | 3167 } |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3396 new_target.SetToMin(layer_impl->MaxScrollOffset()); | 3396 new_target.SetToMin(layer_impl->MaxScrollOffset()); |
| 3397 | 3397 |
| 3398 curve->UpdateTarget( | 3398 curve->UpdateTarget( |
| 3399 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) | 3399 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) |
| 3400 .InSecondsF(), | 3400 .InSecondsF(), |
| 3401 new_target); | 3401 new_target); |
| 3402 | 3402 |
| 3403 return true; | 3403 return true; |
| 3404 } | 3404 } |
| 3405 } // namespace cc | 3405 } // namespace cc |
| OLD | NEW |