| Index: cc/trees/layer_tree_host_impl.cc
|
| diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
|
| index abec01ea496df05eecf176593b53c3a7772ff7ff..57f5084bf9263ccfa9d6dda1cdcae23de26925a5 100644
|
| --- a/cc/trees/layer_tree_host_impl.cc
|
| +++ b/cc/trees/layer_tree_host_impl.cc
|
| @@ -71,7 +71,6 @@
|
| #include "cc/trees/tree_synchronizer.h"
|
| #include "gpu/command_buffer/client/gles2_interface.h"
|
| #include "gpu/GLES2/gl2extchromium.h"
|
| -#include "ui/gfx/frame_time.h"
|
| #include "ui/gfx/geometry/rect_conversions.h"
|
| #include "ui/gfx/geometry/size_conversions.h"
|
| #include "ui/gfx/geometry/vector2d_conversions.h"
|
| @@ -190,6 +189,7 @@ LayerTreeHostImpl::LayerTreeHostImpl(
|
| int id)
|
| : client_(client),
|
| proxy_(proxy),
|
| + current_begin_frame_tracker_(BEGINFRAMETRACKER_FROM_HERE),
|
| use_gpu_rasterization_(false),
|
| gpu_rasterization_status_(GpuRasterizationStatus::OFF_DEVICE),
|
| input_handler_client_(NULL),
|
| @@ -220,7 +220,6 @@ LayerTreeHostImpl::LayerTreeHostImpl(
|
| device_scale_factor_(1.f),
|
| overhang_ui_resource_id_(0),
|
| resourceless_software_draw_(false),
|
| - begin_impl_frame_interval_(BeginFrameArgs::DefaultInterval()),
|
| animation_registrar_(AnimationRegistrar::Create()),
|
| rendering_stats_instrumentation_(rendering_stats_instrumentation),
|
| micro_benchmark_controller_(this),
|
| @@ -374,6 +373,9 @@ bool LayerTreeHostImpl::CanDraw() const {
|
| }
|
|
|
| void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time) {
|
| + // DCHECK(!current_begin_frame_tracker_.HasFinished());
|
| + // DCHECK(monotonic_time == current_begin_frame_tracker_.Get().frame_time)
|
| + // << "Called animate with unknown frame time!?";
|
| if (input_handler_client_)
|
| input_handler_client_->Animate(monotonic_time);
|
| AnimatePageScale(monotonic_time);
|
| @@ -1633,11 +1635,7 @@ bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) {
|
| }
|
|
|
| void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) {
|
| - // Sample the frame time now. This time will be used for updating animations
|
| - // when we draw.
|
| - UpdateCurrentBeginFrameArgs(args);
|
| - // Cache the begin impl frame interval
|
| - begin_impl_frame_interval_ = args.interval;
|
| + current_begin_frame_tracker_.Start(args);
|
|
|
| if (required_for_draw_tile_is_top_of_raster_queue_) {
|
| // Optimistically schedule a draw, as a tile required for draw is at the top
|
| @@ -2410,7 +2408,8 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
|
|
|
| curve->UpdateTarget(
|
| animation->TrimTimeToCurrentIteration(
|
| - CurrentBeginFrameArgs().frame_time).InSecondsF(),
|
| + current_begin_frame_tracker_.Get().frame_time)
|
| + .InSecondsF(),
|
| new_target);
|
|
|
| return ScrollStarted;
|
| @@ -3219,28 +3218,21 @@ TreePriority LayerTreeHostImpl::GetTreePriority() const {
|
| return global_tile_state_.tree_priority;
|
| }
|
|
|
| -void LayerTreeHostImpl::UpdateCurrentBeginFrameArgs(
|
| - const BeginFrameArgs& args) {
|
| - DCHECK(!current_begin_frame_args_.IsValid());
|
| - current_begin_frame_args_ = args;
|
| - // TODO(skyostil): Stop overriding the frame time once the usage of frame
|
| - // timing is unified.
|
| - current_begin_frame_args_.frame_time = gfx::FrameTime::Now();
|
| -}
|
| -
|
| void LayerTreeHostImpl::ResetCurrentBeginFrameArgsForNextFrame() {
|
| - current_begin_frame_args_ = BeginFrameArgs();
|
| + current_begin_frame_tracker_.Finish();
|
| }
|
|
|
| BeginFrameArgs LayerTreeHostImpl::CurrentBeginFrameArgs() const {
|
| - // Try to use the current frame time to keep animations non-jittery. But if
|
| - // we're not in a frame (because this is during an input event or a delayed
|
| - // task), fall back to physical time. This should still be monotonic.
|
| - if (current_begin_frame_args_.IsValid())
|
| - return current_begin_frame_args_;
|
| - return BeginFrameArgs::Create(
|
| - BEGINFRAME_FROM_HERE, gfx::FrameTime::Now(), base::TimeTicks(),
|
| - BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL);
|
| + // TODO(mithro): Remove this section once all calls to CurrentBeginFrameArgs
|
| + // which happens outside frame rendering are fixed.
|
| + if (current_begin_frame_tracker_.HasFinished()) {
|
| + return current_begin_frame_tracker_.Last();
|
| + }
|
| + return current_begin_frame_tracker_.Get();
|
| +}
|
| +
|
| +base::TimeDelta LayerTreeHostImpl::CurrentBeginFrameInterval() const {
|
| + return current_begin_frame_tracker_.Interval();
|
| }
|
|
|
| scoped_refptr<base::debug::ConvertableToTraceFormat>
|
|
|