Commit 4d221376 authored by Xida Chen's avatar Xida Chen Committed by Commit Bot

Create a kCanvas tracker

This CL creates a new canvas frame tracker to track canvas
invalidations in the current frame.

Bug: 1111392
Change-Id: I7707720d4749ea4ceb8928a624ec86ef831610bf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2417249Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Reviewed-by: default avatarJesse Doherty <jwd@chromium.org>
Commit-Queue: Xida Chen <xidachen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808994}
parent 02667d01
...@@ -128,11 +128,13 @@ void AnimationHost::RemoveAnimationTimeline( ...@@ -128,11 +128,13 @@ void AnimationHost::RemoveAnimationTimeline(
} }
void AnimationHost::SetHasCanvasInvalidation(bool has_canvas_invalidation) { void AnimationHost::SetHasCanvasInvalidation(bool has_canvas_invalidation) {
// TODO(crbug.com/1111392): send this value to LayerTreeHostImpl for
// constructing a canvas frame sequence tracker.
has_canvas_invalidation_ = has_canvas_invalidation; has_canvas_invalidation_ = has_canvas_invalidation;
} }
bool AnimationHost::HasCanvasInvalidation() const {
return has_canvas_invalidation_;
}
void AnimationHost::SetHasInlineStyleMutation(bool has_inline_style_mutation) { void AnimationHost::SetHasInlineStyleMutation(bool has_inline_style_mutation) {
// TODO(crbug.com/1111392): send this value to LayerTreeHostImpl for // TODO(crbug.com/1111392): send this value to LayerTreeHostImpl for
// constructing a tracker. // constructing a tracker.
......
...@@ -212,6 +212,7 @@ class CC_ANIMATION_EXPORT AnimationHost : public MutatorHost, ...@@ -212,6 +212,7 @@ class CC_ANIMATION_EXPORT AnimationHost : public MutatorHost,
bool CurrentFrameHadRAF() const override; bool CurrentFrameHadRAF() const override;
bool NextFrameHasPendingRAF() const override; bool NextFrameHasPendingRAF() const override;
PendingThroughputTrackerInfos TakePendingThroughputTrackerInfos() override; PendingThroughputTrackerInfos TakePendingThroughputTrackerInfos() override;
bool HasCanvasInvalidation() const override;
// Starts/stops throughput tracking represented by |sequence_id|. // Starts/stops throughput tracking represented by |sequence_id|.
void StartThroughputTracking(TrackedAnimationSequenceId sequence_id); void StartThroughputTracking(TrackedAnimationSequenceId sequence_id);
......
...@@ -569,6 +569,10 @@ void CompositorFrameReporter::ReportCompositorLatencyHistograms() const { ...@@ -569,6 +569,10 @@ void CompositorFrameReporter::ReportCompositorLatencyHistograms() const {
UMA_HISTOGRAM_ENUMERATION("CompositorLatency.Type.ScrollbarScroll", UMA_HISTOGRAM_ENUMERATION("CompositorLatency.Type.ScrollbarScroll",
report_type); report_type);
break; break;
case FrameSequenceTrackerType::kCanvas:
UMA_HISTOGRAM_ENUMERATION("CompositorLatency.Type.Canvas",
report_type);
break;
case FrameSequenceTrackerType::kCustom: case FrameSequenceTrackerType::kCustom:
case FrameSequenceTrackerType::kMaxType: case FrameSequenceTrackerType::kMaxType:
NOTREACHED(); NOTREACHED();
......
...@@ -158,6 +158,7 @@ FrameSequenceMetrics::ThreadType FrameSequenceMetrics::GetEffectiveThread() ...@@ -158,6 +158,7 @@ FrameSequenceMetrics::ThreadType FrameSequenceMetrics::GetEffectiveThread()
return scrolling_thread_; return scrolling_thread_;
case FrameSequenceTrackerType::kCustom: case FrameSequenceTrackerType::kCustom:
case FrameSequenceTrackerType::kCanvas:
return ThreadType::kMain; return ThreadType::kMain;
case FrameSequenceTrackerType::kMaxType: case FrameSequenceTrackerType::kMaxType:
......
...@@ -29,6 +29,7 @@ enum class FrameSequenceTrackerType { ...@@ -29,6 +29,7 @@ enum class FrameSequenceTrackerType {
kScrollbarScroll = 8, kScrollbarScroll = 8,
kCustom = 9, // Note that the metrics for kCustom are not reported on UMA, kCustom = 9, // Note that the metrics for kCustom are not reported on UMA,
// and instead are dispatched back to the LayerTreeHostClient. // and instead are dispatched back to the LayerTreeHostClient.
kCanvas = 10,
kMaxType kMaxType
}; };
......
...@@ -60,6 +60,8 @@ const char* FrameSequenceTracker::GetFrameSequenceTrackerTypeName( ...@@ -60,6 +60,8 @@ const char* FrameSequenceTracker::GetFrameSequenceTrackerTypeName(
return "ScrollbarScroll"; return "ScrollbarScroll";
case FrameSequenceTrackerType::kCustom: case FrameSequenceTrackerType::kCustom:
return "Custom"; return "Custom";
case FrameSequenceTrackerType::kCanvas:
return "Canvas";
case FrameSequenceTrackerType::kMaxType: case FrameSequenceTrackerType::kMaxType:
return ""; return "";
} }
......
...@@ -103,6 +103,7 @@ class MockMutatorHost : public MutatorHost { ...@@ -103,6 +103,7 @@ class MockMutatorHost : public MutatorHost {
MOCK_CONST_METHOD0(NextFrameHasPendingRAF, bool()); MOCK_CONST_METHOD0(NextFrameHasPendingRAF, bool());
MOCK_METHOD0(TakePendingThroughputTrackerInfos, MOCK_METHOD0(TakePendingThroughputTrackerInfos,
PendingThroughputTrackerInfos()); PendingThroughputTrackerInfos());
MOCK_CONST_METHOD0(HasCanvasInvalidation, bool());
}; };
} // namespace cc } // namespace cc
......
...@@ -607,6 +607,8 @@ void LayerTreeHostImpl::CommitComplete() { ...@@ -607,6 +607,8 @@ void LayerTreeHostImpl::CommitComplete() {
if (mutator_host_->CurrentFrameHadRAF()) if (mutator_host_->CurrentFrameHadRAF())
frame_trackers_.StartSequence(FrameSequenceTrackerType::kRAF); frame_trackers_.StartSequence(FrameSequenceTrackerType::kRAF);
if (mutator_host_->HasCanvasInvalidation())
frame_trackers_.StartSequence(FrameSequenceTrackerType::kCanvas);
if (mutator_host_->MainThreadAnimationsCount() > 0) { if (mutator_host_->MainThreadAnimationsCount() > 0) {
frame_trackers_.StartSequence( frame_trackers_.StartSequence(
...@@ -2340,6 +2342,8 @@ bool LayerTreeHostImpl::DrawLayers(FrameData* frame) { ...@@ -2340,6 +2342,8 @@ bool LayerTreeHostImpl::DrawLayers(FrameData* frame) {
if (!mutator_host_->NextFrameHasPendingRAF()) if (!mutator_host_->NextFrameHasPendingRAF())
frame_trackers_.StopSequence(FrameSequenceTrackerType::kRAF); frame_trackers_.StopSequence(FrameSequenceTrackerType::kRAF);
if (!mutator_host_->HasCanvasInvalidation())
frame_trackers_.StopSequence(FrameSequenceTrackerType::kCanvas);
if (mutator_host_->MainThreadAnimationsCount() == 0) { if (mutator_host_->MainThreadAnimationsCount() == 0) {
frame_trackers_.StopSequence( frame_trackers_.StopSequence(
......
...@@ -164,6 +164,7 @@ class MutatorHost { ...@@ -164,6 +164,7 @@ class MutatorHost {
virtual bool HasCustomPropertyAnimations() const = 0; virtual bool HasCustomPropertyAnimations() const = 0;
virtual bool CurrentFrameHadRAF() const = 0; virtual bool CurrentFrameHadRAF() const = 0;
virtual bool NextFrameHasPendingRAF() const = 0; virtual bool NextFrameHasPendingRAF() const = 0;
virtual bool HasCanvasInvalidation() const = 0;
using TrackedAnimationSequenceId = size_t; using TrackedAnimationSequenceId = size_t;
struct PendingThroughputTrackerInfo { struct PendingThroughputTrackerInfo {
......
...@@ -200042,6 +200042,7 @@ regressions. --> ...@@ -200042,6 +200042,7 @@ regressions. -->
<affected-histogram name="CompositorLatency"/> <affected-histogram name="CompositorLatency"/>
<affected-histogram name="CompositorLatency.CompositorAnimation"/> <affected-histogram name="CompositorLatency.CompositorAnimation"/>
<affected-histogram name="CompositorLatency.DroppedFrame"/> <affected-histogram name="CompositorLatency.DroppedFrame"/>
<affected-histogram name="CompositorLatency.DroppedFrame.Canvas"/>
<affected-histogram <affected-histogram
name="CompositorLatency.DroppedFrame.CompositorAnimation"/> name="CompositorLatency.DroppedFrame.CompositorAnimation"/>
<affected-histogram <affected-histogram
...@@ -200053,6 +200054,7 @@ regressions. --> ...@@ -200053,6 +200054,7 @@ regressions. -->
<affected-histogram name="CompositorLatency.DroppedFrame.WheelScroll"/> <affected-histogram name="CompositorLatency.DroppedFrame.WheelScroll"/>
<affected-histogram name="CompositorLatency.MainThreadAnimation"/> <affected-histogram name="CompositorLatency.MainThreadAnimation"/>
<affected-histogram name="CompositorLatency.MissedDeadlineFrame"/> <affected-histogram name="CompositorLatency.MissedDeadlineFrame"/>
<affected-histogram name="CompositorLatency.MissedDeadlineFrame.Canvas"/>
<affected-histogram <affected-histogram
name="CompositorLatency.MissedDeadlineFrame.CompositorAnimation"/> name="CompositorLatency.MissedDeadlineFrame.CompositorAnimation"/>
<affected-histogram <affected-histogram
...@@ -200317,6 +200319,7 @@ regressions. --> ...@@ -200317,6 +200319,7 @@ regressions. -->
label="The total time starting from BeginImplFrame to when label="The total time starting from BeginImplFrame to when
CompositorFramePresentation is done."/> CompositorFramePresentation is done."/>
<affected-histogram name="CompositorLatency.CompositorOnlyFrame"/> <affected-histogram name="CompositorLatency.CompositorOnlyFrame"/>
<affected-histogram name="CompositorLatency.CompositorOnlyFrame.Canvas"/>
<affected-histogram <affected-histogram
name="CompositorLatency.CompositorOnlyFrame.CompositorAnimation"/> name="CompositorLatency.CompositorOnlyFrame.CompositorAnimation"/>
<affected-histogram <affected-histogram
...@@ -214620,6 +214623,7 @@ regressions. --> ...@@ -214620,6 +214623,7 @@ regressions. -->
</histogram_suffixes> </histogram_suffixes>
<histogram_suffixes name="SmoothnessSequenceTypes" separator="."> <histogram_suffixes name="SmoothnessSequenceTypes" separator=".">
<suffix name="Canvas" label="Main-thread canvas"/>
<suffix name="CompositorAnimation" label="Compositor-driven animation"/> <suffix name="CompositorAnimation" label="Compositor-driven animation"/>
<suffix name="MainThreadAnimation" label="Main-thread driven animation"/> <suffix name="MainThreadAnimation" label="Main-thread driven animation"/>
<suffix name="PinchZoom" label="Pinch-to-zoom interaction"/> <suffix name="PinchZoom" label="Pinch-to-zoom interaction"/>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment