cpu_performance: Add prototype implementation #55309
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This CL adds a prototype implementation for a new Web API that exposes
some information about how powerful the user device is, targeting
applications that will use this information to provide an improved
user experience. It is currently implemented behind the runtime flag
--enable-features=CpuPerformance.
The API exposes navigator.cpuPerformance, which is a small integer
number corresponding to the user device's "performance tier" (similarly
to navigator.deviceMemory). The prototype implementation simply
classifies user devices in five tiers (1-4, denoting increasing
performance; 0 for unknown), based on the number of CPU cores.
The plan is to allow embedders to override this default with more
complicated, implementation-specific behaviour (to be implemented
in a subsequent CL).
Chrome Status entry: https://chromestatus.com/feature/5189864286978048
Explainer: https://github.com/explainers-by-googlers/cpu-performance
Change-Id: Ie711d0de89c44ee621c72271f5a98a0a32d64365
Bug: 449760252
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6780564
Commit-Queue: Nikolaos Papaspyrou <[email protected]>
Reviewed-by: Dominic Farolino <[email protected]>
Reviewed-by: Michael Lippautz <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1527714}