blob: f2ab6e17f84c459151d4b441f3a6ed1ead09bf0f [file] [log] [blame]
# 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.
# Allows multiple duplicate interactions of the same type
REPEATABLE = 'repeatable'
def _AssertFlagsAreValid(flags):
assert isinstance(flags, list)
for f in flags:
if f not in FLAGS:
raise AssertionError(
'Unrecognized flag for a timeline interaction record: %s' % f)
def GetJavaScriptMarker(label, flags):
"""Computes the marker string of an interaction record.
This marker string can be used with JavaScript API console.time()
and console.timeEnd() to mark the beginning and end of the
interaction record..
label: The label used to identify the interaction record.
flags: the flags for the interaction record see FLAGS above.
The interaction record marker string (e.g., Interaction.Label/flag1,flag2).
AssertionError: If one or more of the flags is unrecognized.
marker = 'Interaction.%s' % label
if flags:
marker += '/%s' % (','.join(flags))
return marker