diff --git a/cc/metrics/frame_sequence_tracker.cc b/cc/metrics/frame_sequence_tracker.cc index 31dce1de19c1a0..230045402cd3f2 100644 --- a/cc/metrics/frame_sequence_tracker.cc +++ b/cc/metrics/frame_sequence_tracker.cc @@ -67,8 +67,10 @@ std::string GetFrameSequenceLengthHistogramName(FrameSequenceTrackerType type) { // FrameSequenceTrackerCollection FrameSequenceTrackerCollection::FrameSequenceTrackerCollection( + bool is_single_threaded, CompositorFrameReportingController* compositor_frame_reporting_controller) - : compositor_frame_reporting_controller_( + : is_single_threaded_(is_single_threaded), + compositor_frame_reporting_controller_( compositor_frame_reporting_controller) { StartSequence(FrameSequenceTrackerType::kUniversal); } @@ -80,6 +82,8 @@ FrameSequenceTrackerCollection::~FrameSequenceTrackerCollection() { void FrameSequenceTrackerCollection::StartSequence( FrameSequenceTrackerType type) { + if (is_single_threaded_) + return; if (frame_trackers_.contains(type)) return; auto tracker = base::WrapUnique(new FrameSequenceTracker(type)); diff --git a/cc/metrics/frame_sequence_tracker.h b/cc/metrics/frame_sequence_tracker.h index 685018ec21c9d8..2adac7ee64119b 100644 --- a/cc/metrics/frame_sequence_tracker.h +++ b/cc/metrics/frame_sequence_tracker.h @@ -48,8 +48,9 @@ enum FrameSequenceTrackerType { // submitted frames. class CC_EXPORT FrameSequenceTrackerCollection { public: - explicit FrameSequenceTrackerCollection( - CompositorFrameReportingController* = nullptr); + FrameSequenceTrackerCollection( + bool is_single_threaded, + CompositorFrameReportingController* frame_reporting_controller); ~FrameSequenceTrackerCollection(); FrameSequenceTrackerCollection(const FrameSequenceTrackerCollection&) = @@ -95,6 +96,7 @@ class CC_EXPORT FrameSequenceTrackerCollection { private: friend class FrameSequenceTrackerTest; + const bool is_single_threaded_; // The callsite can use the type to manipulate the tracker. base::flat_map> diff --git a/cc/metrics/frame_sequence_tracker_unittest.cc b/cc/metrics/frame_sequence_tracker_unittest.cc index a597e4823927db..1c492dbbabfb58 100644 --- a/cc/metrics/frame_sequence_tracker_unittest.cc +++ b/cc/metrics/frame_sequence_tracker_unittest.cc @@ -22,7 +22,8 @@ class FrameSequenceTrackerTest : public testing::Test { FrameSequenceTrackerTest() : compositor_frame_reporting_controller_( std::make_unique()), - collection_(compositor_frame_reporting_controller_.get()) { + collection_(/* is_single_threaded=*/false, + compositor_frame_reporting_controller_.get()) { collection_.StartSequence(FrameSequenceTrackerType::kTouchScroll); tracker_ = collection_.GetTrackerForTesting( FrameSequenceTrackerType::kTouchScroll); diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 25ea491c5373d1..03b29b21e65e76 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -319,7 +319,8 @@ LayerTreeHostImpl::LayerTreeHostImpl( is_animating_for_snap_(false), paint_image_generator_client_id_(PaintImage::GetNextGeneratorClientId()), scrollbar_controller_(std::make_unique(this)), - frame_trackers_(compositor_frame_reporting_controller_.get()), + frame_trackers_(settings.single_thread_proxy_scheduler, + compositor_frame_reporting_controller_.get()), scroll_gesture_did_end_(false) { DCHECK(mutator_host_); mutator_host_->SetMutatorHostClient(this);