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

Unified Diff: Source/build/scripts/make_private_script_source.py

Issue 457483002: Blink-in-JS: Support partial interfaces in private scripts Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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
« no previous file with comments | « Source/bindings/tests/results/V8TestInterface.cpp ('k') | Source/core/core.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/build/scripts/make_private_script_source.py
diff --git a/Source/build/scripts/make_private_script_source.py b/Source/build/scripts/make_private_script_source.py
index 2537f7a85e73cfd647d016754c2c381b17b1c383..559f494c7b1a922390d1633df712c253c1679186 100644
--- a/Source/build/scripts/make_private_script_source.py
+++ b/Source/build/scripts/make_private_script_source.py
@@ -10,9 +10,22 @@ python make_private_script_source.py DESTINATION_FILE SOURCE_FILES
"""
import os
+import re
import sys
+def extract_partial_interface_name(filename):
+ basename, ext = os.path.splitext(filename)
+ assert ext == '.js'
+ if os.path.basename(basename) == 'PrivateScriptRunner':
+ return None
+ idl_filename = basename + '.idl'
+ with open(idl_filename) as f:
+ contents = f.read()
+ match = re.search(r'partial\s+interface\s+(\w+)\s*{', contents)
+ return match and match.group(1)
+
+
def main():
output_filename = sys.argv[1]
input_filenames = sys.argv[2:]
@@ -24,11 +37,12 @@ def main():
with open(input_filename) as input_file:
input_text = input_file.read()
hex_values = ['0x{0:02x}'.format(ord(char)) for char in input_text]
- contents.append('const unsigned char kSourceOf%s[] = {\n %s\n};\n' % (
+ contents.append('const unsigned char kSourceOf%s[] = {\n %s\n};\n\n' % (
class_name, ', '.join(hex_values)))
contents.append('struct %s {' % source_name)
contents.append("""
- const char* name;
+ const char* className;
+ const char* dependencyClassName;
const unsigned char* source;
size_t size;
};
@@ -37,7 +51,8 @@ def main():
contents.append('struct %s k%s[] = {\n' % (source_name, source_name))
for input_filename in input_filenames:
class_name, ext = os.path.splitext(os.path.basename(input_filename))
- contents.append(' { "%s", kSourceOf%s, sizeof(kSourceOf%s) },\n' % (class_name, class_name, class_name))
+ dependency_class_name = extract_partial_interface_name(input_filename) or class_name
+ contents.append(' { "%s", "%s", kSourceOf%s, sizeof(kSourceOf%s) },\n' % (class_name, dependency_class_name, class_name, class_name))
contents.append('};\n')
with open(output_filename, 'w') as output_file:
« no previous file with comments | « Source/bindings/tests/results/V8TestInterface.cpp ('k') | Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698