Skip to content

Commit

Permalink
Keep track on the layer tree construction time in the animator. (flut…
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmaygarde authored Aug 24, 2016
1 parent d35e080 commit dcd3874
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions flow/layers/layer_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace flow {
class LayerTree {
public:
LayerTree();

~LayerTree();

void Raster(CompositorContext::ScopedFrame& frame);
Expand All @@ -41,6 +42,7 @@ class LayerTree {
void set_frame_size(const SkISize& frame_size) { frame_size_ = frame_size; }

uint32_t scene_version() const { return scene_version_; }

void set_scene_version(uint32_t scene_version) {
scene_version_ = scene_version;
}
Expand Down
9 changes: 8 additions & 1 deletion sky/shell/ui/animator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,17 @@ void Animator::BeginFrame(int64_t time_stamp) {
// to service potential frame.
DCHECK(producer_continuation_);

engine_->BeginFrame(ftl::TimePoint::Now());
last_begin_frame_time_ = ftl::TimePoint::Now();
engine_->BeginFrame(last_begin_frame_time_);
}

void Animator::Render(std::unique_ptr<flow::LayerTree> layer_tree) {
if (layer_tree) {
// Note the frame time for instrumentation.
layer_tree->set_construction_time(ftl::TimePoint::Now() -
last_begin_frame_time_);
}

// Commit the pending continuation.
producer_continuation_.Complete(std::move(layer_tree));

Expand Down
1 change: 1 addition & 0 deletions sky/shell/ui/animator.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class Animator {
Engine* engine_;
vsync::VSyncProviderPtr vsync_provider_;
vsync::VSyncProviderPtr fallback_vsync_provider_;
ftl::TimePoint last_begin_frame_time_;
ftl::RefPtr<LayerTreePipeline> layer_tree_pipeline_;
flutter::Semaphore pending_frame_semaphore_;
LayerTreePipeline::ProducerContinuation producer_continuation_;
Expand Down

0 comments on commit dcd3874

Please sign in to comment.