0

Clarify browser-side use counter logging for //content code

The existing code only works for code that can depend on
components/page_load_metrics, which excludes all //content code.

This code sample should work everywhere even within //content.

Change-Id: Icb8c2df25097174d50f95163333b13784e8cd1e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4335937
Reviewed-by: Nan Lin <linnan@chromium.org>
Commit-Queue: Charlie Harrison <csharrison@chromium.org>
Reviewed-by: Yoav Weiss <yoavweiss@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1116951}
This commit is contained in:
Charlie Harrison
2023-03-14 14:10:51 +00:00
committed by Chromium LUCI CQ
parent 943d9fd9f5
commit 642ada1e86

@ -25,8 +25,7 @@ feature to UseCounter, simply:
+ Usage can be measured via:
* MeasureAs=\<enum value\> in the feature's IDL definition; Or
* blink::UseCounter::Count() for blink side features; Or
* page_load_metrics::MetricsWebContentsObserver::RecordFeatureUsage()
for browser side features.
* content::ContentBrowserClient::LogWebFeatureForCurrentPage() for browser side features.
Example:
```c++
@ -55,7 +54,7 @@ OR
```c++
MyBrowserSideFunction() {
...
page_load_metrics::MetricsWebContentsObserver::RecordFeatureUsage(
GetContentClient()->browser()->LogWebFeatureForCurrentPage(
render_frame_host, blink::mojom::WebFeature::kMyFeature);
...
}