tools/metrics/histograms/suffixes_to_variants.py
def MigrateToInlinePatterenedHistogram(doc, histogram, histogram_suffixes):
  """Migates a single histogram suffixes to an inline patterned histogram."""
  # Keep a deep copy in case when the |histogram| fails to be migrated.
  old_histogram = histogram.cloneNode(deep=True)
  # Update histogram's name with the histogram_suffixes' name.
  histogram_suffixes_name = histogram_suffixes.getAttribute('name')
  _UpdateHistogramName(histogram, histogram_suffixes)

  # Append |histogram_suffixes_name| placeholder string to the summary text.
  _UpdateSummary(histogram, histogram_suffixes_name)

  # Create an inline <token> node.
  token = doc.createElement('token')
  token.setAttribute('key', histogram_suffixes_name)
  token.appendChild(_GetBaseVariant(doc, histogram))

  # Populate <variant>s to the inline <token> node.
  if not _PopulateVariantsWithSuffixes(doc, token, histogram_suffixes):
    logging.warning('histogram_suffixes: %s needs manually effort',
                    histogram_suffixes_name)
    histograms = histogram.parentNode
    histograms.removeChild(histogram)
    # Restore old histogram when we the script fails to migrate it.
    histograms.appendChild(old_histogram)
  else:
    histogram.appendChild(token)
    histogram_suffixes.parentNode.removeChild(histogram_suffixes)
    # Remove obsolete comments from the histogram node.
    _RemoveSuffixesComment(histogram, histogram_suffixes_name)
Migates a single histogram suffixes to an inline patterned histogram.
Migates a single histogram suffixes to an inline patterned histogram.
Migates a single histogram suffixes to an inline patterned histogram .
def MigrateToInlinePatterenedHistogram(doc, histogram, histogram_suffixes):
  old_histogram = histogram.cloneNode(deep=True)
  histogram_suffixes_name = histogram_suffixes.getAttribute('name')
  _UpdateHistogramName(histogram, histogram_suffixes)
  _UpdateSummary(histogram, histogram_suffixes_name)
  token = doc.createElement('token')
  token.setAttribute('key', histogram_suffixes_name)
  token.appendChild(_GetBaseVariant(doc, histogram))
  if not _PopulateVariantsWithSuffixes(doc, token, histogram_suffixes):
    logging.warning('histogram_suffixes: %s needs manually effort',
                    histogram_suffixes_name)
    histograms = histogram.parentNode
    histograms.removeChild(histogram)
    histograms.appendChild(old_histogram)
  else:
    histogram.appendChild(token)
    histogram_suffixes.parentNode.removeChild(histogram_suffixes)
    _RemoveSuffixesComment(histogram, histogram_suffixes_name)
def MigrateToInlinePatterenedHistogram ( doc , histogram , histogram_suffixes ) : old_histogram = histogram . cloneNode ( deep = True ) histogram_suffixes_name = histogram_suffixes . getAttribute ( 'name' ) _UpdateHistogramName ( histogram , histogram_suffixes ) _UpdateSummary ( histogram , histogram_suffixes_name ) token = doc . createElement ( 'token' ) token . setAttribute ( 'key' , histogram_suffixes_name ) token . appendChild ( _GetBaseVariant ( doc , histogram ) ) if not _PopulateVariantsWithSuffixes ( doc , token , histogram_suffixes ) : logging . warning ( 'histogram_suffixes: %s needs manually effort' , histogram_suffixes_name ) histograms = histogram . parentNode histograms . removeChild ( histogram ) histograms . appendChild ( old_histogram ) else : histogram . appendChild ( token ) histogram_suffixes . parentNode . removeChild ( histogram_suffixes ) _RemoveSuffixesComment ( histogram , histogram_suffixes_name )
Migates a single histogram suffixes to an inline patterned histogram.
Migates a single histogram suffixes to an inline patterned histogram .
"""Migates a single histogram suffixes to an inline patterned histogram.""" # Keep a deep copy in case when the |histogram| fails to be migrated. # Update histogram's name with the histogram_suffixes' name. # Append |histogram_suffixes_name| placeholder string to the summary text. # Create an inline <token> node. # Populate <variant>s to the inline <token> node. # Restore old histogram when we the script fails to migrate it. # Remove obsolete comments from the histogram node.
doc
histogram
histogram_suffixes