| 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/tiles/raster_tile_priority_queue.h" | 69 #include "cc/tiles/raster_tile_priority_queue.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" |  | 
| 80 #include "ui/gfx/geometry/rect_conversions.h" | 79 #include "ui/gfx/geometry/rect_conversions.h" | 
| 81 #include "ui/gfx/geometry/scroll_offset.h" | 80 #include "ui/gfx/geometry/scroll_offset.h" | 
| 82 #include "ui/gfx/geometry/size_conversions.h" | 81 #include "ui/gfx/geometry/size_conversions.h" | 
| 83 #include "ui/gfx/geometry/vector2d_conversions.h" | 82 #include "ui/gfx/geometry/vector2d_conversions.h" | 
| 84 | 83 | 
| 85 namespace cc { | 84 namespace cc { | 
| 86 namespace { | 85 namespace { | 
| 87 | 86 | 
| 88 // Small helper class that saves the current viewport location as the user sees | 87 // Small helper class that saves the current viewport location as the user sees | 
| 89 // it and resets to the same location. | 88 // it and resets to the same location. | 
| (...skipping 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1708   return true; | 1707   return true; | 
| 1709 } | 1708 } | 
| 1710 | 1709 | 
| 1711 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { | 1710 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { | 
| 1712   // Sample the frame time now. This time will be used for updating animations | 1711   // Sample the frame time now. This time will be used for updating animations | 
| 1713   // when we draw. | 1712   // when we draw. | 
| 1714   DCHECK(!current_begin_frame_args_.IsValid()); | 1713   DCHECK(!current_begin_frame_args_.IsValid()); | 
| 1715   current_begin_frame_args_ = args; | 1714   current_begin_frame_args_ = args; | 
| 1716   // TODO(mithro): Stop overriding the frame time once the usage of frame | 1715   // TODO(mithro): Stop overriding the frame time once the usage of frame | 
| 1717   // timing is unified. | 1716   // timing is unified. | 
| 1718   current_begin_frame_args_.frame_time = gfx::FrameTime::Now(); | 1717   current_begin_frame_args_.frame_time = base::TimeTicks::Now(); | 
| 1719 | 1718 | 
| 1720   // Cache the begin impl frame interval | 1719   // Cache the begin impl frame interval | 
| 1721   begin_impl_frame_interval_ = args.interval; | 1720   begin_impl_frame_interval_ = args.interval; | 
| 1722 | 1721 | 
| 1723   if (is_likely_to_require_a_draw_) { | 1722   if (is_likely_to_require_a_draw_) { | 
| 1724     // Optimistically schedule a draw. This will let us expect the tile manager | 1723     // Optimistically schedule a draw. This will let us expect the tile manager | 
| 1725     // to complete its work so that we can draw new tiles within the impl frame | 1724     // to complete its work so that we can draw new tiles within the impl frame | 
| 1726     // we are beginning now. | 1725     // we are beginning now. | 
| 1727     SetNeedsRedraw(); | 1726     SetNeedsRedraw(); | 
| 1728   } | 1727   } | 
| (...skipping 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3194   return global_tile_state_.tree_priority; | 3193   return global_tile_state_.tree_priority; | 
| 3195 } | 3194 } | 
| 3196 | 3195 | 
| 3197 BeginFrameArgs LayerTreeHostImpl::CurrentBeginFrameArgs() const { | 3196 BeginFrameArgs LayerTreeHostImpl::CurrentBeginFrameArgs() const { | 
| 3198   // Try to use the current frame time to keep animations non-jittery.  But if | 3197   // Try to use the current frame time to keep animations non-jittery.  But if | 
| 3199   // we're not in a frame (because this is during an input event or a delayed | 3198   // we're not in a frame (because this is during an input event or a delayed | 
| 3200   // task), fall back to physical time.  This should still be monotonic. | 3199   // task), fall back to physical time.  This should still be monotonic. | 
| 3201   if (current_begin_frame_args_.IsValid()) | 3200   if (current_begin_frame_args_.IsValid()) | 
| 3202     return current_begin_frame_args_; | 3201     return current_begin_frame_args_; | 
| 3203   return BeginFrameArgs::Create( | 3202   return BeginFrameArgs::Create( | 
| 3204       BEGINFRAME_FROM_HERE, gfx::FrameTime::Now(), base::TimeTicks(), | 3203       BEGINFRAME_FROM_HERE, base::TimeTicks::Now(), base::TimeTicks(), | 
| 3205       BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL); | 3204       BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL); | 
| 3206 } | 3205 } | 
| 3207 | 3206 | 
| 3208 scoped_refptr<base::trace_event::ConvertableToTraceFormat> | 3207 scoped_refptr<base::trace_event::ConvertableToTraceFormat> | 
| 3209 LayerTreeHostImpl::AsValueWithFrame(FrameData* frame) const { | 3208 LayerTreeHostImpl::AsValueWithFrame(FrameData* frame) const { | 
| 3210   scoped_refptr<base::trace_event::TracedValue> state = | 3209   scoped_refptr<base::trace_event::TracedValue> state = | 
| 3211       new base::trace_event::TracedValue(); | 3210       new base::trace_event::TracedValue(); | 
| 3212   AsValueWithFrameInto(frame, state.get()); | 3211   AsValueWithFrameInto(frame, state.get()); | 
| 3213   return state; | 3212   return state; | 
| 3214 } | 3213 } | 
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3442   new_target.SetToMin(layer_impl->MaxScrollOffset()); | 3441   new_target.SetToMin(layer_impl->MaxScrollOffset()); | 
| 3443 | 3442 | 
| 3444   curve->UpdateTarget( | 3443   curve->UpdateTarget( | 
| 3445       animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) | 3444       animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) | 
| 3446           .InSecondsF(), | 3445           .InSecondsF(), | 
| 3447       new_target); | 3446       new_target); | 
| 3448 | 3447 | 
| 3449   return true; | 3448   return true; | 
| 3450 } | 3449 } | 
| 3451 }  // namespace cc | 3450 }  // namespace cc | 
| OLD | NEW | 
|---|