Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 240 self._class_name = self._ImplClassName(self._interface.id) | 240 self._class_name = self._ImplClassName(self._interface.id) |
| 241 self._interface_type_info = GetIDLTypeInfo(self._interface.id) | 241 self._interface_type_info = GetIDLTypeInfo(self._interface.id) |
| 242 self._members_emitter = emitter.Emitter() | 242 self._members_emitter = emitter.Emitter() |
| 243 self._cpp_declarations_emitter = emitter.Emitter() | 243 self._cpp_declarations_emitter = emitter.Emitter() |
| 244 self._cpp_impl_includes = set() | 244 self._cpp_impl_includes = set() |
| 245 self._cpp_definitions_emitter = emitter.Emitter() | 245 self._cpp_definitions_emitter = emitter.Emitter() |
| 246 self._cpp_resolver_emitter = emitter.Emitter() | 246 self._cpp_resolver_emitter = emitter.Emitter() |
| 247 | 247 |
| 248 self._GenerateConstructors() | 248 self._GenerateConstructors() |
| 249 | 249 |
| 250 # Ugly corner case: in WebKit Uint8ClampedArray inherits from Uint8Array, | |
|
podivilov
2012/05/11 12:34:44
Please use AddIndexer. Looks like we need to fork
podivilov
2012/05/11 14:18:17
Done.
| |
| 251 # but Uint8Array::{g,s}et is not virtual, so one needs to have an override | |
| 252 # for operator[] and operator[]= for Uint8ClampedArray. | |
| 253 if self._interface.id == 'Uint8ClampedArray': | |
| 254 self._EmitNativeIndexGetter(self._interface, 'int') | |
| 255 self._EmitNativeIndexSetter(self._interface, 'int') | |
| 256 | |
| 250 def _GenerateConstructors(self): | 257 def _GenerateConstructors(self): |
| 251 if not self._IsConstructable(): | 258 if not self._IsConstructable(): |
| 252 return | 259 return |
| 253 | 260 |
| 254 # TODO(antonm): currently we don't have information about number of argument s expected by | 261 # TODO(antonm): currently we don't have information about number of argument s expected by |
| 255 # the constructor, so name only dispatch. | 262 # the constructor, so name only dispatch. |
| 256 self._cpp_resolver_emitter.Emit( | 263 self._cpp_resolver_emitter.Emit( |
| 257 ' if (name == "$(INTERFACE_NAME)_constructor_Callback")\n' | 264 ' if (name == "$(INTERFACE_NAME)_constructor_Callback")\n' |
| 258 ' return Dart$(INTERFACE_NAME)Internal::constructorCallback;\n', | 265 ' return Dart$(INTERFACE_NAME)Internal::constructorCallback;\n', |
| 259 INTERFACE_NAME=self._interface.id) | 266 INTERFACE_NAME=self._interface.id) |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 842 def _InstanceOfNode(database, interface): | 849 def _InstanceOfNode(database, interface): |
| 843 if interface.id == 'Node': | 850 if interface.id == 'Node': |
| 844 return True | 851 return True |
| 845 for parent in interface.parents: | 852 for parent in interface.parents: |
| 846 if not database.HasInterface(parent.type.id): | 853 if not database.HasInterface(parent.type.id): |
| 847 continue | 854 continue |
| 848 parent_interface = database.GetInterface(parent.type.id) | 855 parent_interface = database.GetInterface(parent.type.id) |
| 849 if _InstanceOfNode(database, parent_interface): | 856 if _InstanceOfNode(database, parent_interface): |
| 850 return True | 857 return True |
| 851 return False | 858 return False |
| OLD | NEW |