[go: nahoru, domu]

PowerMode: Track main thread animations separately

Adds a separate PowerModeVoter to cc::Scheduler to identify when the
main thread is producing frames.

This helps us better identify no-op animations that involve the main
thread (e.g. rAF), while still distinguishing (valid) main-thread frame
production that takes a long time and eventually produces updates.

The prior mechanism that would look at the FrameSkippedReason to
identify whether the main thread was active could not detect no-op
main thread animations where the BeginMainFrame exceeded the BeginFrame
deadline.

Bug: b:187392644
Bug: 1166695
Change-Id: Ia3feb109f0ae498dd378cc7c063790433f21e04d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2877048
Commit-Queue: Eric Seckler <eseckler@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Reviewed-by: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Sami Kyöstilä <skyostil@chromium.org>
Cr-Commit-Position: refs/heads/master@{#881990}
diff --git a/cc/BUILD.gn b/cc/BUILD.gn
index a0848a9..eaa675b 100644
--- a/cc/BUILD.gn
+++ b/cc/BUILD.gn
@@ -436,6 +436,7 @@
     "//base",
     "//base/third_party/dynamic_annotations",
     "//build:chromeos_buildflags",
+    "//components/power_scheduler",
     "//components/viz/client",
     "//device/base/synchronization",
     "//gpu",
@@ -829,6 +830,7 @@
     "//build:chromeos_buildflags",
     "//cc/mojo_embedder",
     "//cc/paint",
+    "//components/power_scheduler",
     "//components/ukm:test_support",
     "//components/viz/client",
     "//components/viz/common",