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

Unified Diff: sdk/lib/html/scripts/systemnative.py

Issue 11316020: Dart generation changes for splitting apart resolvers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Dart generation changes for splitting apart resolvers. Created 8 years, 1 month 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 | « no previous file | sdk/lib/html/templates/html/dartium/cpp_resolver.template » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/scripts/systemnative.py
diff --git a/sdk/lib/html/scripts/systemnative.py b/sdk/lib/html/scripts/systemnative.py
index 667150046484fb598c97a0ed7058d824b14c46d5..a5b815a1c596fcbd66113cca1c372d6adcbf8ede 100644
--- a/sdk/lib/html/scripts/systemnative.py
+++ b/sdk/lib/html/scripts/systemnative.py
@@ -80,7 +80,10 @@ class DartiumBackend(HtmlDartGenerator):
ARGUMENTS_DECLARATION=arguments_declaration,
ARGUMENT_COUNT=len(arguments))
- cpp_header_emitter = self._cpp_library_emitter.CreateHeaderEmitter(self._interface.id, True)
+ cpp_header_emitter = self._cpp_library_emitter.CreateHeaderEmitter(
+ self._interface.id,
+ self._renamer.GetLibraryName(self._interface),
+ True)
cpp_header_emitter.Emit(
self._template_loader.Load('cpp_callback_header.template'),
INTERFACE=self._interface.id,
@@ -112,7 +115,9 @@ class DartiumBackend(HtmlDartGenerator):
def StartInterface(self, memebers_emitter):
# Create emitters for c++ implementation.
if not IsPureInterface(self._interface.id):
- self._cpp_header_emitter = self._cpp_library_emitter.CreateHeaderEmitter(self._interface.id)
+ self._cpp_header_emitter = self._cpp_library_emitter.CreateHeaderEmitter(
+ self._interface.id,
+ self._renamer.GetLibraryName(self._interface))
self._cpp_impl_emitter = self._cpp_library_emitter.CreateSourceEmitter(self._interface.id)
else:
self._cpp_header_emitter = emitter.Emitter()
@@ -862,13 +867,15 @@ class CPPLibraryEmitter():
def __init__(self, emitters, cpp_sources_dir):
self._emitters = emitters
self._cpp_sources_dir = cpp_sources_dir
- self._headers_list = []
+ self._library_headers = {}
self._sources_list = []
- def CreateHeaderEmitter(self, interface_name, is_callback=False):
+ def CreateHeaderEmitter(self, interface_name, library_name, is_callback=False):
path = os.path.join(self._cpp_sources_dir, 'Dart%s.h' % interface_name)
if not is_callback:
- self._headers_list.append(path)
+ if not library_name in self._library_headers:
+ self._library_headers[library_name] = []
+ self._library_headers[library_name].append(path)
return self._emitters.FileEmitter(path)
def CreateSourceEmitter(self, interface_name):
@@ -887,12 +894,17 @@ class CPPLibraryEmitter():
includes_emitter.Emit('#include "$PATH"\n', PATH=path)
def EmitResolver(self, template, output_dir):
- file_path = os.path.join(output_dir, 'DartResolver.cpp')
- includes_emitter, body_emitter = self._emitters.FileEmitter(file_path).Emit(template)
- for header_file in self._headers_list:
- path = os.path.relpath(header_file, output_dir)
- includes_emitter.Emit('#include "$PATH"\n', PATH=path)
- body_emitter.Emit(
- ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argumentCount))\n'
- ' return func;\n',
- CLASS_NAME=os.path.splitext(os.path.basename(path))[0])
+ for library_name in self._library_headers.keys():
+ file_path = os.path.join(output_dir, '%s_DartResolver.cpp' % library_name)
+ includes_emitter, body_emitter = self._emitters.FileEmitter(file_path).Emit(
+ template,
+ LIBRARY_NAME=library_name)
+
+ headers = self._library_headers[library_name]
+ for header_file in headers:
+ path = os.path.relpath(header_file, output_dir)
+ includes_emitter.Emit('#include "$PATH"\n', PATH=path)
+ body_emitter.Emit(
+ ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argumentCount))\n'
+ ' return func;\n',
+ CLASS_NAME=os.path.splitext(os.path.basename(path))[0])
« no previous file with comments | « no previous file | sdk/lib/html/templates/html/dartium/cpp_resolver.template » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698