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

Side by Side Diff: Source/bindings/scripts/v8_types.py

Issue 1051753003: bindings: Add toBoolean() to V8Binding.h (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 ################################################################################ 465 ################################################################################
466 # V8 -> C++ 466 # V8 -> C++
467 ################################################################################ 467 ################################################################################
468 468
469 V8_VALUE_TO_CPP_VALUE = { 469 V8_VALUE_TO_CPP_VALUE = {
470 # Basic 470 # Basic
471 'Date': 'toCoreDate({isolate}, {v8_value})', 471 'Date': 'toCoreDate({isolate}, {v8_value})',
472 'DOMString': '{v8_value}', 472 'DOMString': '{v8_value}',
473 'ByteString': 'toByteString({isolate}, {arguments})', 473 'ByteString': 'toByteString({isolate}, {arguments})',
474 'USVString': 'toUSVString({isolate}, {arguments})', 474 'USVString': 'toUSVString({isolate}, {arguments})',
475 'boolean': '{v8_value}->BooleanValue()', 475 'boolean': 'toBoolean({isolate}, {arguments})',
476 'float': 'toRestrictedFloat({isolate}, {arguments})', 476 'float': 'toRestrictedFloat({isolate}, {arguments})',
477 'unrestricted float': 'toFloat({isolate}, {arguments})', 477 'unrestricted float': 'toFloat({isolate}, {arguments})',
478 'double': 'toRestrictedDouble({isolate}, {arguments})', 478 'double': 'toRestrictedDouble({isolate}, {arguments})',
479 'unrestricted double': 'toDouble({isolate}, {arguments})', 479 'unrestricted double': 'toDouble({isolate}, {arguments})',
480 'byte': 'toInt8({isolate}, {arguments})', 480 'byte': 'toInt8({isolate}, {arguments})',
481 'octet': 'toUInt8({isolate}, {arguments})', 481 'octet': 'toUInt8({isolate}, {arguments})',
482 'short': 'toInt16({isolate}, {arguments})', 482 'short': 'toInt16({isolate}, {arguments})',
483 'unsigned short': 'toUInt16({isolate}, {arguments})', 483 'unsigned short': 'toUInt16({isolate}, {arguments})',
484 'long': 'toInt32({isolate}, {arguments})', 484 'long': 'toInt32({isolate}, {arguments})',
485 'unsigned long': 'toUInt32({isolate}, {arguments})', 485 'unsigned long': 'toUInt32({isolate}, {arguments})',
486 'long long': 'toInt64({isolate}, {arguments})', 486 'long long': 'toInt64({isolate}, {arguments})',
487 'unsigned long long': 'toUInt64({isolate}, {arguments})', 487 'unsigned long long': 'toUInt64({isolate}, {arguments})',
488 # Interface types 488 # Interface types
489 'Dictionary': 'Dictionary({v8_value}, {isolate}, exceptionState)', 489 'Dictionary': 'Dictionary({v8_value}, {isolate}, exceptionState)',
490 'EventTarget': 'toEventTarget({isolate}, {v8_value})', 490 'EventTarget': 'toEventTarget({isolate}, {v8_value})',
491 'NodeFilter': 'toNodeFilter({v8_value}, info.Holder(), ScriptState::current( {isolate}))', 491 'NodeFilter': 'toNodeFilter({v8_value}, info.Holder(), ScriptState::current( {isolate}))',
492 'Promise': 'ScriptPromise::cast(ScriptState::current({isolate}), {v8_value}) ', 492 'Promise': 'ScriptPromise::cast(ScriptState::current({isolate}), {v8_value}) ',
493 'SerializedScriptValue': 'SerializedScriptValueFactory::instance().create({v 8_value}, 0, 0, exceptionState, {isolate})', 493 'SerializedScriptValue': 'SerializedScriptValueFactory::instance().create({v 8_value}, 0, 0, exceptionState, {isolate})',
494 'ScriptValue': 'ScriptValue(ScriptState::current({isolate}), {v8_value})', 494 'ScriptValue': 'ScriptValue(ScriptState::current({isolate}), {v8_value})',
495 'Window': 'toDOMWindow({isolate}, {v8_value})', 495 'Window': 'toDOMWindow({isolate}, {v8_value})',
496 'XPathNSResolver': 'toXPathNSResolver({isolate}, {v8_value})', 496 'XPathNSResolver': 'toXPathNSResolver({isolate}, {v8_value})',
497 } 497 }
498 498
499 499
500 def v8_conversion_needs_exception_state(idl_type): 500 def v8_conversion_needs_exception_state(idl_type):
501 return (idl_type.is_numeric_type or 501 return (idl_type.is_numeric_type or
502 idl_type.is_enum or 502 idl_type.is_enum or
503 idl_type.is_dictionary or 503 idl_type.is_dictionary or
504 idl_type.name in ('ByteString', 'Dictionary', 'USVString', 'Serializ edScriptValue')) 504 idl_type.name in ('Boolean', 'ByteString', 'Dictionary', 'USVString' , 'SerializedScriptValue'))
505 505
506 IdlType.v8_conversion_needs_exception_state = property(v8_conversion_needs_excep tion_state) 506 IdlType.v8_conversion_needs_exception_state = property(v8_conversion_needs_excep tion_state)
507 IdlArrayOrSequenceType.v8_conversion_needs_exception_state = True 507 IdlArrayOrSequenceType.v8_conversion_needs_exception_state = True
508 IdlUnionType.v8_conversion_needs_exception_state = True 508 IdlUnionType.v8_conversion_needs_exception_state = True
509 509
510 510
511 TRIVIAL_CONVERSIONS = frozenset([ 511 TRIVIAL_CONVERSIONS = frozenset([
512 'any', 512 'any',
513 'boolean', 513 'boolean',
514 'Date', 514 'Date',
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 number_of_nullable_member_types_union) 970 number_of_nullable_member_types_union)
971 971
972 972
973 def includes_nullable_type_union(idl_type): 973 def includes_nullable_type_union(idl_type):
974 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type 974 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type
975 return idl_type.number_of_nullable_member_types == 1 975 return idl_type.number_of_nullable_member_types == 1
976 976
977 IdlTypeBase.includes_nullable_type = False 977 IdlTypeBase.includes_nullable_type = False
978 IdlNullableType.includes_nullable_type = True 978 IdlNullableType.includes_nullable_type = True
979 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) 979 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union)
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8Binding.cpp ('k') | Source/bindings/tests/results/core/V8TestDictionary.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698