| 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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 | 416 |
| 417 ext_attrs = self._interface.ext_attrs | 417 ext_attrs = self._interface.ext_attrs |
| 418 | 418 |
| 419 to_dart_emitter.Emit( | 419 to_dart_emitter.Emit( |
| 420 ' static Dart_Handle toDart(NativeType* value)\n' | 420 ' static Dart_Handle toDart(NativeType* value)\n' |
| 421 ' {\n' | 421 ' {\n' |
| 422 ' if (!value)\n' | 422 ' if (!value)\n' |
| 423 ' return Dart_Null();\n' | 423 ' return Dart_Null();\n' |
| 424 ' DartDOMData* domData = DartDOMData::current();\n' | 424 ' DartDOMData* domData = DartDOMData::current();\n' |
| 425 ' Dart_WeakPersistentHandle result =\n' | 425 ' Dart_WeakPersistentHandle result =\n' |
| 426 ' DartDOMWrapper::lookupWrapper(domData, isNode, value);\n' | 426 ' DartDOMWrapper::lookupWrapper<Dart$(INTERFACE)>(domData, va
lue);\n' |
| 427 ' if (result)\n' | 427 ' if (result)\n' |
| 428 ' return Dart_HandleFromWeakPersistent(result);\n' | 428 ' return Dart_HandleFromWeakPersistent(result);\n' |
| 429 ' return createWrapper(domData, value);\n' | 429 ' return createWrapper(domData, value);\n' |
| 430 ' }\n' | 430 ' }\n' |
| 431 ' static void returnToDart(Dart_NativeArguments args,\n' | 431 ' static void returnToDart(Dart_NativeArguments args,\n' |
| 432 ' NativeType* value)\n' | 432 ' NativeType* value)\n' |
| 433 ' {\n' | 433 ' {\n' |
| 434 ' if (value) {\n' | 434 ' if (value) {\n' |
| 435 ' DartDOMData* domData = static_cast<DartDOMData*>(\n' | 435 ' DartDOMData* domData = static_cast<DartDOMData*>(\n' |
| 436 ' Dart_GetNativeIsolateData(args));\n' | 436 ' Dart_GetNativeIsolateData(args));\n' |
| 437 ' Dart_WeakPersistentHandle result =\n' | 437 ' Dart_WeakPersistentHandle result =\n' |
| 438 ' DartDOMWrapper::lookupWrapper(domData, isNode, value);\
n' | 438 ' DartDOMWrapper::lookupWrapper<Dart$(INTERFACE)>(domData
, value);\n' |
| 439 ' if (result)\n' | 439 ' if (result)\n' |
| 440 ' Dart_SetWeakHandleReturnValue(args, result);\n' | 440 ' Dart_SetWeakHandleReturnValue(args, result);\n' |
| 441 ' else\n' | 441 ' else\n' |
| 442 ' Dart_SetReturnValue(args, createWrapper(domData, value)
);\n' | 442 ' Dart_SetReturnValue(args, createWrapper(domData, value)
);\n' |
| 443 ' }\n' | 443 ' }\n' |
| 444 ' }\n', | 444 ' }\n', |
| 445 ) | 445 INTERFACE=self._interface.id) |
| 446 | 446 |
| 447 if ('CustomToV8' in ext_attrs or | 447 if ('CustomToV8' in ext_attrs or |
| 448 'PureInterface' in ext_attrs or | 448 'PureInterface' in ext_attrs or |
| 449 'CPPPureInterface' in ext_attrs or | 449 'CPPPureInterface' in ext_attrs or |
| 450 self._interface_type_info.custom_to_dart()): | 450 self._interface_type_info.custom_to_dart()): |
| 451 to_dart_emitter.Emit( | 451 to_dart_emitter.Emit( |
| 452 ' static Dart_Handle createWrapper(DartDOMData* domData, NativeType
* value);\n') | 452 ' static Dart_Handle createWrapper(DartDOMData* domData, NativeType
* value);\n') |
| 453 else: | 453 else: |
| 454 to_dart_emitter.Emit( | 454 to_dart_emitter.Emit( |
| 455 ' static Dart_Handle createWrapper(DartDOMData* domData, NativeType
* value)\n' | 455 ' static Dart_Handle createWrapper(DartDOMData* domData, NativeType
* value)\n' |
| (...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1279 e.Emit("};\n"); | 1279 e.Emit("};\n"); |
| 1280 e.Emit('\n'); | 1280 e.Emit('\n'); |
| 1281 e.Emit('} // namespace WebCore\n'); | 1281 e.Emit('} // namespace WebCore\n'); |
| 1282 | 1282 |
| 1283 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): | 1283 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): |
| 1284 return ( | 1284 return ( |
| 1285 interface.id.endswith('Event') and | 1285 interface.id.endswith('Event') and |
| 1286 operation.id.startswith('init') and | 1286 operation.id.startswith('init') and |
| 1287 argument.ext_attrs.get('Default') == 'Undefined' and | 1287 argument.ext_attrs.get('Default') == 'Undefined' and |
| 1288 argument.type.id == 'DOMString') | 1288 argument.type.id == 'DOMString') |
| OLD | NEW |