[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / tools / metrics / histograms / update_bad_message_reasons.py
blob01db78f100ae63706e85b3332544db76cd50ddba
1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 """Updates the various BadMessage enums in histograms.xml file with values read
6 from the corresponding bad_message.h files.
8 If the file was pretty-printed, the updated version is pretty-printed too.
9 """
11 import sys
13 from update_histogram_enum import UpdateHistogramEnum
15 if __name__ == '__main__':
16 if len(sys.argv) > 1:
17 print >>sys.stderr, 'No arguments expected!'
18 sys.stderr.write(__doc__)
19 sys.exit(1)
21 histograms = {
22 'chrome/browser/bad_message.h': 'BadMessageReasonChrome',
23 'content/browser/bad_message.h': 'BadMessageReasonContent',
24 'components/nacl/browser/bad_message.h': 'BadMessageReasonNaCl',
25 'components/password_manager/content/browser/bad_message.h':
26 'BadMessageReasonPasswordManager',
27 'extensions/browser/bad_message.h': 'BadMessageReasonExtensions',
30 for header_file, histogram_name in histograms.items():
31 UpdateHistogramEnum(histogram_enum_name=histogram_name,
32 source_enum_path=header_file,
33 start_marker='^enum (class )?BadMessageReason {',
34 end_marker='^BAD_MESSAGE_MAX')