Commit dd424d1a authored by Brandon Maslen's avatar Brandon Maslen Committed by Commit Bot

Fixup WebSchedulerTrackedFeature Enum

Recently updating the WebSchedulerTrackedFeature histogram enum it was
noticed that the current labels are out of sync. This change adds a new
presubmit check to help warn committers to keep the value up to date.
In addition the current labels have been updated to reflect the current
in-code values being reported.

Change-Id: I8e3fb6dd452454f4efa0aecf65348bcce4517c6a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2063359Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Reviewed-by: default avatarAlexander Timin <altimin@chromium.org>
Commit-Queue: Brandon Maslen <brandm@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#742822}
parent f8d4b271
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Blink feature-policy presubmit script.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmit API built into gcl.
"""
def _RunUmaHistogramChecks(input_api, output_api): # pylint: disable=C0103
import sys
original_sys_path = sys.path
try:
sys.path = sys.path + [input_api.os_path.join(
input_api.PresubmitLocalPath(), '..', '..', '..', '..', '..',
'tools', 'metrics', 'histograms')]
import update_histogram_enum # pylint: disable=F0401
finally:
sys.path = original_sys_path
source_path = ''
for f in input_api.AffectedFiles():
if f.LocalPath().endswith('web_scheduler_tracked_feature.h'):
source_path = f.LocalPath()
break
else:
return []
start_marker = '^enum class WebSchedulerTrackedFeature {'
end_marker = '^kMaxValue'
presubmit_error = update_histogram_enum.CheckPresubmitErrors(
histogram_enum_name='WebSchedulerTrackedFeature',
update_script_name='update_scheduler_enums.py',
source_enum_path=source_path,
start_marker=start_marker,
end_marker=end_marker,
strip_k_prefix=True)
if presubmit_error:
return [output_api.PresubmitPromptWarning(presubmit_error,
items=[source_path])]
return []
def CheckChangeOnUpload(input_api, output_api): # pylint: disable=C0103
results = []
results.extend(_RunUmaHistogramChecks(input_api, output_api))
return results
def CheckChangeOnCommit(input_api, output_api): # pylint: disable=C0103
results = []
results.extend(_RunUmaHistogramChecks(input_api, output_api))
return results
...@@ -67812,6 +67812,8 @@ Full version information for the fingerprint enum values: ...@@ -67812,6 +67812,8 @@ Full version information for the fingerprint enum values:
</enum> </enum>
<enum name="WebSchedulerTrackedFeature"> <enum name="WebSchedulerTrackedFeature">
<!-- Generated from third_party/blink/public/common/scheduler/web_scheduler_tracked_feature.h.-->
<int value="0" label="WebSocket"/> <int value="0" label="WebSocket"/>
<int value="1" label="WebRTC"/> <int value="1" label="WebRTC"/>
<int value="2" label="MainResourceHasCacheControlNoCache"/> <int value="2" label="MainResourceHasCacheControlNoCache"/>
...@@ -67836,15 +67838,19 @@ Full version information for the fingerprint enum values: ...@@ -67836,15 +67838,19 @@ Full version information for the fingerprint enum values:
<int value="21" label="RequestedMIDIPermission"/> <int value="21" label="RequestedMIDIPermission"/>
<int value="22" label="RequestedAudioCapturePermission"/> <int value="22" label="RequestedAudioCapturePermission"/>
<int value="23" label="RequestedVideoCapturePermission"/> <int value="23" label="RequestedVideoCapturePermission"/>
<int value="24" label="RequestedSensorsPermission"/> <int value="24" label="RequestedBackForwardCacheBlockedSensors"/>
<int value="25" label="RequestedBackgroundWorkPermission"/> <int value="25" label="Unused"/>
<int value="26" label="BroadcastChannel"/> <int value="26" label="RequestedBackgroundWorkPermission"/>
<int value="27" label="IndexedDBConnection"/> <int value="27" label="BroadcastChannel"/>
<int value="28" label="WebGL"/> <int value="28" label="IndexedDBConnection"/>
<int value="29" label="WebVR"/> <int value="29" label="WebGL"/>
<int value="30" label="WebXR"/> <int value="30" label="WebVR"/>
<int value="31" label="SharedWorker"/> <int value="31" label="WebXR"/>
<int value="32" label="WebLocks"/> <int value="32" label="SharedWorker"/>
<int value="33" label="WebLocks"/>
<int value="34" label="WebHID"/>
<int value="35" label="WakeLock"/>
<int value="36" label="WebShare"/>
<int value="37" label="RequestedStorageAccessGrant"/> <int value="37" label="RequestedStorageAccessGrant"/>
</enum> </enum>
#!/usr/bin/env python
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Updates the WebSchedulerTrackedFeature enum in enums.xml file with
values read from web_scheduler_tracked_feature.h.
If the file was pretty-printed, the updated version is pretty-printed too.
"""
from __future__ import print_function
import os
import sys
from update_histogram_enum import UpdateHistogramEnum
if __name__ == '__main__':
if len(sys.argv) > 1:
print('No arguments expected!', file=sys.stderr)
sys.stderr.write(__doc__)
sys.exit(1)
source_file = 'third_party/blink/public/common/scheduler/' \
'web_scheduler_tracked_feature.h'
UpdateHistogramEnum(
histogram_enum_name='WebSchedulerTrackedFeature',
source_enum_path=source_file,
start_marker='^enum class WebSchedulerTrackedFeature {',
end_marker='^kMaxValue',
strip_k_prefix=True)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment