Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: content/browser/tracing/generate_trace_viewer_grd.py

Issue 2933483005: gzip chrome://tracing resources. (Closed)
Patch Set: add begin_recording to gzip excluded paths and alphabetize. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/tracing/tracing_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 The Chromium Authors. All rights reserved. 2 # Copyright 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Creates a grd file for packaging the trace-viewer files. 6 """Creates a grd file for packaging the trace-viewer files.
7 7
8 This file is modified from the devtools generate_devtools_grd.py file. 8 This file is modified from the devtools generate_devtools_grd.py file.
9 """ 9 """
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 52
53 def add_file_to_grd(grd_doc, filename): 53 def add_file_to_grd(grd_doc, filename):
54 includes_node = grd_doc.getElementsByTagName('if')[0] 54 includes_node = grd_doc.getElementsByTagName('if')[0]
55 includes_node.appendChild(grd_doc.createTextNode('\n ')) 55 includes_node.appendChild(grd_doc.createTextNode('\n '))
56 56
57 new_include_node = grd_doc.createElement('include') 57 new_include_node = grd_doc.createElement('include')
58 new_include_node.setAttribute('name', make_name_from_filename(filename)) 58 new_include_node.setAttribute('name', make_name_from_filename(filename))
59 new_include_node.setAttribute('file', filename) 59 new_include_node.setAttribute('file', filename)
60 new_include_node.setAttribute('type', 'BINDATA') 60 new_include_node.setAttribute('type', 'BINDATA')
61 new_include_node.setAttribute('compress', 'gzip')
61 new_include_node.setAttribute('flattenhtml', 'true') 62 new_include_node.setAttribute('flattenhtml', 'true')
62 if filename.endswith('.html'): 63 if filename.endswith('.html'):
63 new_include_node.setAttribute('allowexternalscript', 'true') 64 new_include_node.setAttribute('allowexternalscript', 'true')
64 includes_node.appendChild(new_include_node) 65 includes_node.appendChild(new_include_node)
65 66
66 67
67 def main(argv): 68 def main(argv):
68 parsed_args = parse_args(argv[1:]) 69 parsed_args = parse_args(argv[1:])
69 70
70 output_directory = os.path.dirname(parsed_args.output_filename) 71 output_directory = os.path.dirname(parsed_args.output_filename)
71 72
72 doc = minidom.parseString(kGrdTemplate) 73 doc = minidom.parseString(kGrdTemplate)
73 for filename in parsed_args.source_files: 74 for filename in parsed_args.source_files:
74 add_file_to_grd(doc, os.path.basename(filename)) 75 add_file_to_grd(doc, os.path.basename(filename))
75 76
76 with open(parsed_args.output_filename, 'w') as output_file: 77 with open(parsed_args.output_filename, 'w') as output_file:
77 output_file.write(doc.toxml(encoding='UTF-8')) 78 output_file.write(doc.toxml(encoding='UTF-8'))
78 79
79 80
80 if __name__ == '__main__': 81 if __name__ == '__main__':
81 sys.exit(main(sys.argv)) 82 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | content/browser/tracing/tracing_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698