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 6cb1baa192c8cc3efd8ecc7b06a96918a6cf37b7..c4361f44da1728bbc0d9fad0423cc539229677fd 100644 |
--- a/cc/trees/layer_tree_host_impl.cc |
+++ b/cc/trees/layer_tree_host_impl.cc |
@@ -76,7 +76,6 @@ |
#include "cc/trees/tree_synchronizer.h" |
#include "gpu/GLES2/gl2extchromium.h" |
#include "gpu/command_buffer/client/gles2_interface.h" |
-#include "ui/gfx/frame_time.h" |
#include "ui/gfx/geometry/rect_conversions.h" |
#include "ui/gfx/geometry/scroll_offset.h" |
#include "ui/gfx/geometry/size_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), |
@@ -218,7 +218,6 @@ LayerTreeHostImpl::LayerTreeHostImpl( |
max_memory_needed_bytes_(0), |
device_scale_factor_(1.f), |
resourceless_software_draw_(false), |
- begin_impl_frame_interval_(BeginFrameArgs::DefaultInterval()), |
animation_registrar_(AnimationRegistrar::Create()), |
rendering_stats_instrumentation_(rendering_stats_instrumentation), |
micro_benchmark_controller_(this), |
@@ -390,6 +389,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_.Current().frame_time) |
+ // << "Called animate with unknown frame time!?"; |
brianderson
2015/05/01 02:05:21
Delete?
mithro-old
2015/05/01 03:27:56
Added a TODO to enable these checks when I track d
|
if (input_handler_client_) |
input_handler_client_->Animate(monotonic_time); |
AnimatePageScale(monotonic_time); |
@@ -1643,14 +1645,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. |
- DCHECK(!current_begin_frame_args_.IsValid()); |
- current_begin_frame_args_ = args; |
- // TODO(mithro): Stop overriding the frame time once the usage of frame |
- // timing is unified. |
- current_begin_frame_args_.frame_time = gfx::FrameTime::Now(); |
- |
- // Cache the begin impl frame interval |
- begin_impl_frame_interval_ = args.interval; |
+ current_begin_frame_tracker_.Start(args); |
if (is_likely_to_require_a_draw_) { |
// Optimistically schedule a draw. This will let us expect the tile manager |
@@ -1664,8 +1659,7 @@ void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { |
} |
void LayerTreeHostImpl::DidBeginImplFrameDeadline() { |
- DCHECK(current_begin_frame_args_.IsValid()); |
- current_begin_frame_args_ = BeginFrameArgs(); |
+ current_begin_frame_tracker_.Finish(); |
} |
void LayerTreeHostImpl::UpdateViewportContainerSizes() { |
@@ -3113,14 +3107,13 @@ TreePriority LayerTreeHostImpl::GetTreePriority() const { |
} |
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): Replace call with current_begin_frame_tracker_.Current() |
brianderson
2015/05/01 02:05:21
For my education, what are the places that call th
mithro-old
2015/05/01 03:27:56
There are a number of places mostly around cc/laye
|
+ // once all calls which happens outside impl frames are fixed. |
+ return current_begin_frame_tracker_.DangerousMethodCurrentOrLast(); |
+} |
+ |
+base::TimeDelta LayerTreeHostImpl::CurrentBeginFrameInterval() const { |
+ return current_begin_frame_tracker_.Interval(); |
} |
scoped_refptr<base::trace_event::ConvertableToTraceFormat> |