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

Unified Diff: third_party/WebKit/Source/core/inspector/v8/build/xxd.py

Issue 1670813003: DevTools: do not use platform/ to load injected scripts into inspector/v8. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated the chromevox script Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/inspector/v8/build/xxd.py
diff --git a/third_party/WebKit/Source/core/inspector/v8/build/xxd.py b/third_party/WebKit/Source/core/inspector/v8/build/xxd.py
new file mode 100644
index 0000000000000000000000000000000000000000..635d80c7d475099576c857152e22d82b1b5fceb4
--- /dev/null
+++ b/third_party/WebKit/Source/core/inspector/v8/build/xxd.py
@@ -0,0 +1,28 @@
+# Copyright 2016 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.
+
+"""Represent a file as a C++ constant string.
+
+Usage:
+python xxd.py VAR SOURCE DEST
+"""
+
+
+import sys
+import rjsmin
+
+
+def main():
+ variable_name, input_filename, output_filename = sys.argv[1:]
+ with open(input_filename) as input_file:
+ input_text = input_file.read()
+ input_text = rjsmin.jsmin(input_text)
+ hex_values = ['0x{0:02x}'.format(ord(char)) for char in input_text]
+ const_declaration = 'const char %s[] = {\n%s\n};\n' % (
+ variable_name, ', '.join(hex_values))
+ with open(output_filename, 'w') as output_file:
+ output_file.write(const_declaration)
+
+if __name__ == '__main__':
+ sys.exit(main())

Powered by Google App Engine
This is Rietveld 408576698