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

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

Issue 203143002: Simplify EventTarget bindings generation (2) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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
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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 'octet': 'toUInt8({arguments})', 329 'octet': 'toUInt8({arguments})',
330 'short': 'toInt16({arguments})', 330 'short': 'toInt16({arguments})',
331 'unsigned short': 'toUInt16({arguments})', 331 'unsigned short': 'toUInt16({arguments})',
332 'long': 'toInt32({arguments})', 332 'long': 'toInt32({arguments})',
333 'unsigned long': 'toUInt32({arguments})', 333 'unsigned long': 'toUInt32({arguments})',
334 'long long': 'toInt64({arguments})', 334 'long long': 'toInt64({arguments})',
335 'unsigned long long': 'toUInt64({arguments})', 335 'unsigned long long': 'toUInt64({arguments})',
336 # Interface types 336 # Interface types
337 'CompareHow': 'static_cast<Range::CompareHow>({v8_value}->Int32Value())', 337 'CompareHow': 'static_cast<Range::CompareHow>({v8_value}->Int32Value())',
338 'Dictionary': 'Dictionary({v8_value}, info.GetIsolate())', 338 'Dictionary': 'Dictionary({v8_value}, info.GetIsolate())',
339 # FIXME: EventListener is special-cased in templates instead, because
340 # removeEventListener uses ListenerFindOnly (only use) instead of
341 # ListenerFindOrCreate.
342 # 'EventListener': 'V8EventListenerList::getEventListener({v8_value}, false, ListenerFindOrCreate/ListenerFindOnly)'
339 'EventTarget': 'V8DOMWrapper::isDOMWrapper({v8_value}) ? toWrapperTypeInfo(v 8::Handle<v8::Object>::Cast({v8_value}))->toEventTarget(v8::Handle<v8::Object>:: Cast({v8_value})) : 0', 343 'EventTarget': 'V8DOMWrapper::isDOMWrapper({v8_value}) ? toWrapperTypeInfo(v 8::Handle<v8::Object>::Cast({v8_value}))->toEventTarget(v8::Handle<v8::Object>:: Cast({v8_value})) : 0',
340 'MediaQueryListListener': 'MediaQueryListListener::create(ScriptValue({v8_va lue}, info.GetIsolate()))', 344 'MediaQueryListListener': 'MediaQueryListListener::create(ScriptValue({v8_va lue}, info.GetIsolate()))',
341 'NodeFilter': 'toNodeFilter({v8_value}, info.GetIsolate())', 345 'NodeFilter': 'toNodeFilter({v8_value}, info.GetIsolate())',
342 'Promise': 'ScriptPromise({v8_value}, info.GetIsolate())', 346 'Promise': 'ScriptPromise({v8_value}, info.GetIsolate())',
343 'SerializedScriptValue': 'SerializedScriptValue::create({v8_value}, info.Get Isolate())', 347 'SerializedScriptValue': 'SerializedScriptValue::create({v8_value}, info.Get Isolate())',
344 'ScriptValue': 'ScriptValue({v8_value}, info.GetIsolate())', 348 'ScriptValue': 'ScriptValue({v8_value}, info.GetIsolate())',
345 'Window': 'toDOMWindow({v8_value}, info.GetIsolate())', 349 'Window': 'toDOMWindow({v8_value}, info.GetIsolate())',
346 'XPathNSResolver': 'toXPathNSResolver({v8_value}, info.GetIsolate())', 350 'XPathNSResolver': 'toXPathNSResolver({v8_value}, info.GetIsolate())',
347 } 351 }
348 352
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 def cpp_value_to_v8_value(idl_type, cpp_value, isolate='info.GetIsolate()', crea tion_context='', extended_attributes=None): 606 def cpp_value_to_v8_value(idl_type, cpp_value, isolate='info.GetIsolate()', crea tion_context='', extended_attributes=None):
603 """Returns an expression that converts a C++ value to a V8 value.""" 607 """Returns an expression that converts a C++ value to a V8 value."""
604 # the isolate parameter is needed for callback interfaces 608 # the isolate parameter is needed for callback interfaces
605 idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, ext ended_attributes) 609 idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, ext ended_attributes)
606 this_v8_conversion_type = idl_type.v8_conversion_type(extended_attributes) 610 this_v8_conversion_type = idl_type.v8_conversion_type(extended_attributes)
607 format_string = CPP_VALUE_TO_V8_VALUE[this_v8_conversion_type] 611 format_string = CPP_VALUE_TO_V8_VALUE[this_v8_conversion_type]
608 statement = format_string.format(cpp_value=cpp_value, isolate=isolate, creat ion_context=creation_context) 612 statement = format_string.format(cpp_value=cpp_value, isolate=isolate, creat ion_context=creation_context)
609 return statement 613 return statement
610 614
611 IdlType.cpp_value_to_v8_value = cpp_value_to_v8_value 615 IdlType.cpp_value_to_v8_value = cpp_value_to_v8_value
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698