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

Side by Side Diff: lib/html/scripts/systemnative.py

Issue 11091046: Move interface merging info to type registry. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « lib/html/scripts/systemhtml.py ('k') | no next file » | 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/python 1 #!/usr/bin/python
2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 """This module provides shared functionality for the systems to generate 6 """This module provides shared functionality for the systems to generate
7 native binding from the IDL database.""" 7 native binding from the IDL database."""
8 8
9 import emitter 9 import emitter
10 import os 10 import os
11 from generator import * 11 from generator import *
12 from systemhtml import SecureOutputType 12 from systemhtml import SecureOutputType
13 13
14 class DartiumBackend(object): 14 class DartiumBackend(object):
15 """Generates Dart implementation for one DOM IDL interface.""" 15 """Generates Dart implementation for one DOM IDL interface."""
16 16
17 def __init__(self, interface, cpp_library_emitter, options): 17 def __init__(self, interface, cpp_library_emitter, options):
18 self._interface = interface 18 self._interface = interface
19 self._cpp_library_emitter = cpp_library_emitter 19 self._cpp_library_emitter = cpp_library_emitter
20 self._database = options.database 20 self._database = options.database
21 self._template_loader = options.templates 21 self._template_loader = options.templates
22 self._type_registry = options.type_registry 22 self._type_registry = options.type_registry
23 self._html_interface_name = options.renamer.RenameInterface(self._interface) 23 self._html_interface_name = options.renamer.RenameInterface(self._interface)
24 24
25 def HasImplementation(self):
26 return not IsPureInterface(self._interface.id)
27
28 def ImplementationClassName(self): 25 def ImplementationClassName(self):
29 return self._ImplClassName(self._interface.id) 26 return self._ImplClassName(self._interface.id)
30 27
31 def ImplementsMergedMembers(self): 28 def ImplementsMergedMembers(self):
32 # We could not add merged functions to implementation class because 29 # We could not add merged functions to implementation class because
33 # underlying c++ object doesn't implement them. Merged functions are 30 # underlying c++ object doesn't implement them. Merged functions are
34 # generated on merged interface implementation instead. 31 # generated on merged interface implementation instead.
35 return False 32 return False
36 33
37 def CustomJSMembers(self): 34 def CustomJSMembers(self):
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 return template 104 return template
108 105
109 def AdditionalImplementedInterfaces(self): 106 def AdditionalImplementedInterfaces(self):
110 return [] 107 return []
111 108
112 def NativeSpec(self): 109 def NativeSpec(self):
113 return '' 110 return ''
114 111
115 def StartInterface(self, memebers_emitter): 112 def StartInterface(self, memebers_emitter):
116 # Create emitters for c++ implementation. 113 # Create emitters for c++ implementation.
117 if self.HasImplementation(): 114 if not IsPureInterface(self._interface.id):
118 self._cpp_header_emitter = self._cpp_library_emitter.CreateHeaderEmitter(s elf._interface.id) 115 self._cpp_header_emitter = self._cpp_library_emitter.CreateHeaderEmitter(s elf._interface.id)
119 self._cpp_impl_emitter = self._cpp_library_emitter.CreateSourceEmitter(sel f._interface.id) 116 self._cpp_impl_emitter = self._cpp_library_emitter.CreateSourceEmitter(sel f._interface.id)
120 else: 117 else:
121 self._cpp_header_emitter = emitter.Emitter() 118 self._cpp_header_emitter = emitter.Emitter()
122 self._cpp_impl_emitter = emitter.Emitter() 119 self._cpp_impl_emitter = emitter.Emitter()
123 120
124 self._interface_type_info = self._TypeInfo(self._interface.id) 121 self._interface_type_info = self._TypeInfo(self._interface.id)
125 self._members_emitter = memebers_emitter 122 self._members_emitter = memebers_emitter
126 self._cpp_declarations_emitter = emitter.Emitter() 123 self._cpp_declarations_emitter = emitter.Emitter()
127 self._cpp_impl_includes = set() 124 self._cpp_impl_includes = set()
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 def EmitResolver(self, template, output_dir): 883 def EmitResolver(self, template, output_dir):
887 file_path = os.path.join(output_dir, 'DartResolver.cpp') 884 file_path = os.path.join(output_dir, 'DartResolver.cpp')
888 includes_emitter, body_emitter = self._emitters.FileEmitter(file_path).Emit( template) 885 includes_emitter, body_emitter = self._emitters.FileEmitter(file_path).Emit( template)
889 for header_file in self._headers_list: 886 for header_file in self._headers_list:
890 path = os.path.relpath(header_file, output_dir) 887 path = os.path.relpath(header_file, output_dir)
891 includes_emitter.Emit('#include "$PATH"\n', PATH=path) 888 includes_emitter.Emit('#include "$PATH"\n', PATH=path)
892 body_emitter.Emit( 889 body_emitter.Emit(
893 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argume ntCount))\n' 890 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argume ntCount))\n'
894 ' return func;\n', 891 ' return func;\n',
895 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) 892 CLASS_NAME=os.path.splitext(os.path.basename(path))[0])
OLDNEW
« no previous file with comments | « lib/html/scripts/systemhtml.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698