# Copyright 2014 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 ExtensionPermission3 enum in the histograms.xml file with values read from api_permission.h. If the file was pretty-printed, the updated version is pretty-printed too. """ import os import sys from update_histogram_enum import UpdateHistogramEnum if __name__ == '__main__': if len(sys.argv) > 1: print >> sys.stderr, 'No arguments expected!' sys.stderr.write(__doc__) sys.exit(1) header_file = 'extensions/common/permissions/api_permission.h' UpdateHistogramEnum(histogram_enum_name='ExtensionPermission3', source_enum_path=header_file, start_marker='^enum ID {', end_marker='^kEnumBoundary')
# Copyright 2014 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 ExtensionPermission3 enum in the histograms.xml file with values read from api_permission_id.mojom. 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 = 'extensions/common/mojom/api_permission_id.mojom' UpdateHistogramEnum(histogram_enum_name='ExtensionPermission3', source_enum_path=source_file, start_marker='^enum APIPermissionID {', end_marker='^};', calling_script=os.path.basename(__file__))
If the file was pretty-printed, the updated version is pretty-printed too. """ from __future__ import print_function 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) histograms = { 'chrome/browser/bad_message.h': 'BadMessageReasonChrome', 'content/browser/bad_message.h': 'BadMessageReasonContent', 'components/guest_view/browser/bad_message.h': 'BadMessageReasonGuestView', 'components/nacl/browser/bad_message.h': 'BadMessageReasonNaCl', 'components/password_manager/content/browser/bad_message.h': 'BadMessageReasonPasswordManager', 'extensions/browser/bad_message.h': 'BadMessageReasonExtensions', } for header_file, histogram_name in histograms.items(): UpdateHistogramEnum(histogram_enum_name=histogram_name, source_enum_path=header_file, start_marker='^enum (class )?BadMessageReason {', end_marker='^BAD_MESSAGE_MAX')
# 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 DocumentPolicyFeature enum in enums.xml file with values read from document_policy_feature.mojom. 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/mojom/feature_policy/' \ 'document_policy_feature.mojom' UpdateHistogramEnum(histogram_enum_name='DocumentPolicyFeature', source_enum_path=source_file, start_marker='^enum DocumentPolicyFeature {', end_marker='^};', strip_k_prefix=True, calling_script=os.path.basename(__file__))
# Copyright 2021 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 DebugScenario enums in histograms with values read from the corresponding header file. 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) UpdateHistogramEnum(histogram_enum_name='DebugScenario', source_enum_path='content/common/debug_utils.h', start_marker='^enum class ?DebugScenario {', end_marker='^kMaxValue', calling_script=os.path.basename(__file__))
If the file was pretty-printed, the updated version is pretty-printed too. """ import os import sys from update_histogram_enum import UpdateHistogramEnum if __name__ == '__main__': if len(sys.argv) > 1: print >> sys.stderr, 'No arguments expected!' sys.stderr.write(__doc__) sys.exit(1) UpdateHistogramEnum(histogram_enum_name='ExtensionPermission2', source_enum_path=os.path.join('..', '..', '..', 'extensions', 'common', 'permissions', 'permission_message.h'), start_marker='^enum ID {', end_marker='^kEnumBoundary') UpdateHistogramEnum(histogram_enum_name='ExtensionPermission3', source_enum_path=os.path.join('..', '..', '..', 'extensions', 'common', 'permissions', 'api_permission.h'), start_marker='^enum ID {', end_marker='^kEnumBoundary')
if __name__ == '__main__': parser = optparse.OptionParser() parser.add_option('--for-dashboard', action='store_true', dest='dashboard', default=False, help='Print enum definition formatted for use in uma.py of ' 'Chromium dashboard developed at ' 'https://github.com/GoogleChrome/chromium-dashboard') options, args = parser.parse_args() source_path = 'third_party/blink/public/mojom/web_feature/web_feature.mojom' START_MARKER = '^enum WebFeature {' END_MARKER = '^kNumberOfFeatures' if options.dashboard: enum_dict = ReadHistogramValues(source_path, START_MARKER, END_MARKER, strip_k_prefix=True) PrintEnumForDashboard(enum_dict) else: UpdateHistogramEnum( histogram_enum_name='FeatureObserver', source_enum_path=source_path, start_marker=START_MARKER, end_marker=END_MARKER, strip_k_prefix=True, calling_script=os.path.basename(__file__))
# found in the LICENSE file. """Updates the ExtensionEvents and ExtensionFunctions enums in histograms.xml with values read from extension_event_histogram_value.h and extension_function_histogram_value.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) histograms = (('ExtensionEvents', 'extensions/browser/extension_event_histogram_value.h'), ('ExtensionFunctions', 'extensions/browser/extension_function_histogram_value.h')) for enum_name, source_header in histograms: UpdateHistogramEnum(histogram_enum_name=enum_name, source_enum_path=source_header, start_marker='^enum HistogramValue {', end_marker='^ENUM_BOUNDARY')
'name': 'BadMessageReasonContent' }, 'components/autofill/content/browser/bad_message.h': { 'name': 'BadMessageReasonAutofill', 'end_marker': '^kMaxValue .*', 'strip_k_prefix': True }, 'components/guest_view/browser/bad_message.h': { 'name': 'BadMessageReasonGuestView' }, 'components/nacl/browser/bad_message.h': { 'name': 'BadMessageReasonNaCl' }, 'components/password_manager/content/browser/bad_message.h': { 'name': 'BadMessageReasonPasswordManager' }, 'extensions/browser/bad_message.h': { 'name': 'BadMessageReasonExtensions' }, } for header_file, details in histograms.items(): end_marker = details.get('end_marker', '^BAD_MESSAGE_MAX') strip_k_prefix = details.get('strip_k_prefix', False) UpdateHistogramEnum(histogram_enum_name=details['name'], source_enum_path=header_file, start_marker='^enum (class )?BadMessageReason {', end_marker=end_marker, strip_k_prefix=strip_k_prefix, calling_script=os.path.basename(__file__))
def print_enum_for_dashboard(enum_dict): """Prints enum_items formatted for use in uma.py of Chromium dashboard.""" for key in sorted(enum_dict.iterkeys()): print ' %d: \'%s\',' % (key, enum_dict[key]) if __name__ == '__main__': parser = optparse.OptionParser() parser.add_option('--for-dashboard', action='store_true', dest='dashboard', default=False, help='Print enum definition formatted for use in uma.py of ' 'Chromium dashboard developed at ' 'https://github.com/GoogleChrome/chromium-dashboard') options, args = parser.parse_args() START_MARKER = '^enum Feature {' END_MARKER = '^NumberOfFeatures' if options.dashboard: enum_dict = ReadHistogramValues( USE_COUNTER_HEADER_PATH, START_MARKER, END_MARKER) print_enum_for_dashboard(enum_dict) else: UpdateHistogramEnum( histogram_enum_name='FeatureObserver', source_enum_path=USE_COUNTER_HEADER_PATH, start_marker=START_MARKER, end_marker=END_MARKER)
# Copyright 2013 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 ExtensionFunctions enum in histograms.xml file with values read from extension_function_histogram_value.h. If the file was pretty-printed, the updated version is pretty-printed too. """ import os import sys from update_histogram_enum import UpdateHistogramEnum if __name__ == '__main__': if len(sys.argv) > 1: print >> sys.stderr, 'No arguments expected!' sys.stderr.write(__doc__) sys.exit(1) UpdateHistogramEnum(histogram_enum_name='ExtensionFunctions', source_enum_path=os.path.join( '..', '..', '..', 'extensions', 'browser', 'extension_function_histogram_value.h'), start_marker='^enum HistogramValue {', end_marker='^ENUM_BOUNDARY')
extension_function_histogram_value.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) histograms = ( ('ExtensionEvents', 'extensions/browser/extension_event_histogram_value.h'), ('ExtensionFunctions', 'extensions/browser/extension_function_histogram_value.h')) for enum_name, source_header in histograms: UpdateHistogramEnum( histogram_enum_name=enum_name, source_enum_path=source_header, start_marker='^enum HistogramValue {', end_marker='^ENUM_BOUNDARY', calling_script=os.path.basename(__file__))
# Copyright 2014 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 ExtensionPermission3 enum in the histograms.xml file with values read from api_permission.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) header_file = 'extensions/common/permissions/api_permission.h' UpdateHistogramEnum( histogram_enum_name='ExtensionPermission3', source_enum_path=header_file, start_marker='^enum ID {', end_marker='^kEnumBoundary', calling_script=os.path.basename(__file__))
# Copyright 2017 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 ShouldAllowOpenURLFailureScheme enum in histograms.xml file with values read from chrome_content_browser_client_extensions_part.cc. If the file was pretty-printed, the updated version is pretty-printed too. """ import os import sys from update_histogram_enum import UpdateHistogramEnum if __name__ == '__main__': if len(sys.argv) > 1: print >> sys.stderr, 'No arguments expected!' sys.stderr.write(__doc__) sys.exit(1) source_file = 'chrome/browser/extensions/' \ 'chrome_content_browser_client_extensions_part.cc' UpdateHistogramEnum(histogram_enum_name='ShouldAllowOpenURLFailureScheme', source_enum_path=source_file, start_marker='^enum ShouldAllowOpenURLFailureScheme {', end_marker='^SCHEME_LAST')
#!/usr/bin/env python # Copyright 2018 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 FeaturePolicyFeature enum in enums.xml file with values read from feature_policy.mojom. If the file was pretty-printed, the updated version is pretty-printed too. """ import os import sys from update_histogram_enum import UpdateHistogramEnum if __name__ == '__main__': if len(sys.argv) > 1: print >>sys.stderr, 'No arguments expected!' sys.stderr.write(__doc__) sys.exit(1) source_file = 'third_party/blink/public/mojom/feature_policy/' \ 'feature_policy.mojom' UpdateHistogramEnum(histogram_enum_name='FeaturePolicyFeature', source_enum_path=source_file, start_marker='^enum FeaturePolicyFeature {', end_marker='^};', strip_k_prefix=True)
from __future__ import print_function 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) histograms = { 'chrome/browser/bad_message.h': 'BadMessageReasonChrome', 'content/browser/bad_message.h': 'BadMessageReasonContent', 'components/guest_view/browser/bad_message.h': 'BadMessageReasonGuestView', 'components/nacl/browser/bad_message.h': 'BadMessageReasonNaCl', 'components/password_manager/content/browser/bad_message.h': 'BadMessageReasonPasswordManager', 'extensions/browser/bad_message.h': 'BadMessageReasonExtensions', } for header_file, histogram_name in histograms.items(): UpdateHistogramEnum( histogram_enum_name=histogram_name, source_enum_path=header_file, start_marker='^enum (class )?BadMessageReason {', end_marker='^BAD_MESSAGE_MAX', calling_script=os.path.basename(__file__))
# Copyright 2013 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 ExtensionFunctions enum in histograms.xml file with values read from extension_function_histogram_value.h. If the file was pretty-printed, the updated version is pretty-printed too. """ import os import sys from update_histogram_enum import UpdateHistogramEnum if __name__ == '__main__': if len(sys.argv) > 1: print >> sys.stderr, 'No arguments expected!' sys.stderr.write(__doc__) sys.exit(1) source_header = 'extensions/browser/extension_function_histogram_value.h' UpdateHistogramEnum(histogram_enum_name='ExtensionFunctions', source_enum_path=source_header, start_marker='^enum HistogramValue {', end_marker='^ENUM_BOUNDARY')
def PrintEnumForDashboard(enum_dict): """Prints enum_items formatted for use in uma.py of Chromium dashboard.""" for key in sorted(enum_dict.iterkeys()): print ' %d: \'%s\',' % (key, enum_dict[key]) if __name__ == '__main__': parser = optparse.OptionParser() parser.add_option('--for-dashboard', action='store_true', dest='dashboard', default=False, help='Print enum definition formatted for use in uma.py of ' 'Chromium dashboard developed at ' 'https://github.com/GoogleChrome/chromium-dashboard') options, args = parser.parse_args() source_path = \ '../../../third_party/WebKit/Source/core/frame/UseCounter.h' START_MARKER = '^enum Feature {' END_MARKER = '^NumberOfFeatures' if options.dashboard: enum_dict = ReadHistogramValues(source_path, START_MARKER, END_MARKER) PrintEnumForDashboard(enum_dict) else: UpdateHistogramEnum( histogram_enum_name='FeatureObserver', source_enum_path=source_path, start_marker=START_MARKER, end_marker=END_MARKER)
# 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)