throughput_tracker_host.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef UI_COMPOSITOR_THROUGHPUT_TRACKER_HOST_H_
  5. #define UI_COMPOSITOR_THROUGHPUT_TRACKER_HOST_H_
  6. #include "base/callback_forward.h"
  7. #include "cc/metrics/frame_sequence_tracker.h"
  8. #include "ui/compositor/compositor_export.h"
  9. namespace ui {
  10. // An interface for ThroughputTracker to call its host.
  11. class COMPOSITOR_EXPORT ThroughputTrackerHost {
  12. public:
  13. using TrackerId = size_t;
  14. virtual ~ThroughputTrackerHost() = default;
  15. // Starts the tracking for the given tracker id. |callback| is invoked after
  16. // the tracker is stopped and the metrics data is collected.
  17. using ReportCallback = base::OnceCallback<void(
  18. const cc::FrameSequenceMetrics::CustomReportData& data)>;
  19. virtual void StartThroughputTracker(TrackerId tracker_id,
  20. ReportCallback callback) = 0;
  21. // Stops the tracking for the given tracker id. Returns true if tracking
  22. // is stopped successfully. Otherwise, returns false.
  23. virtual bool StopThroughtputTracker(TrackerId tracker_id) = 0;
  24. // Cancels the tracking for the given tracker id.
  25. virtual void CancelThroughtputTracker(TrackerId tracker_id) = 0;
  26. };
  27. } // namespace ui
  28. #endif // UI_COMPOSITOR_THROUGHPUT_TRACKER_HOST_H_