import tvcm
from trace_viewer import trace_viewer_project
-html_warning_message = """
-
-
-<!------------------------------------------------------------------------------
-WARNING: This file is generated by generate_about_tracing_contents.py
-
- Do not edit directly.
-
-
-------------------------------------------------------------------------------->
-
-
-"""
-
-js_warning_message = """/**
-// Copyright (c) 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.
-
-* WARNING: This file is generated by generate_about_tracing_contents.py
-*
-* Do not edit directly.
-*/
-"""
-
-def generate_html(outdir, load_sequence):
- return tvcm.GenerateStandaloneHTMLAsString(
- load_sequence,
- title='chrome://tracing',
- flattened_js_url='tracing.js')
-
-def GenerateJS(outdir, load_sequence):
- script_contents = js_warning_message
- script_contents += "window.FLATTENED = {};\n"
- script_contents += "window.FLATTENED_RAW_SCRIPTS = {};\n"
- for module in load_sequence:
- for dependent_raw_script in module.dependent_raw_scripts:
- script_contents += (
- "window.FLATTENED_RAW_SCRIPTS['%s'] = true;\n" %
- dependent_raw_script.resource.unix_style_relative_path)
- script_contents += "window.FLATTENED['%s'] = true;\n" % module.name
-
- for module in load_sequence:
- for dependent_raw_script in module.dependent_raw_scripts:
- rel_filename = os.path.relpath(dependent_raw_script.filename, outdir)
- script_contents += """<include src="%s">\n""" % rel_filename
-
- rel_filename = os.path.relpath(module.filename, outdir)
- script_contents += """<include src="%s">\n""" % rel_filename
-
- return script_contents
-
def main(args):
parser = optparse.OptionParser(usage="%prog --outdir=<directory>")
parser.add_option("--outdir", dest="out_dir",
parser.print_help()
return 1
- filenames = ["tvcm/__init__.js", "about_tracing/__init__.js"]
+ filenames = ["about_tracing.html"]
project = trace_viewer_project.TraceViewerProject()
load_sequence = project.CalcLoadSequenceForModuleFilenames(filenames)
olddir = os.getcwd()
try:
+ o = open(os.path.join(options.out_dir, "about_tracing.html"), 'w')
try:
- result_html = generate_html(options.out_dir, load_sequence)
+ tvcm.GenerateStandaloneHTMLToFile(
+ o,
+ load_sequence,
+ title='chrome://tracing',
+ flattened_js_url='tracing.js')
except tvcm.module.DepsException, ex:
sys.stderr.write("Error: %s\n\n" % str(ex))
return 255
-
- o = open(os.path.join(options.out_dir, "about_tracing.html"), 'w')
- o.write(result_html)
o.close()
- result_js = GenerateJS(options.out_dir, load_sequence)
+
o = open(os.path.join(options.out_dir, "about_tracing.js"), 'w')
- o.write(result_js)
+ tvcm.GenerateJSToFile(
+ o,
+ load_sequence,
+ use_include_tags_for_scripts=True,
+ dir_for_include_tag_root=options.out_dir)
o.close()
finally: