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

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

Issue 54903014: [EnforceRange] doesn't enforce range of a short (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Extend layout test Created 7 years, 1 month 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 ################################################################################ 335 ################################################################################
336 336
337 V8_VALUE_TO_CPP_VALUE_BASIC = { 337 V8_VALUE_TO_CPP_VALUE_BASIC = {
338 'Date': 'toWebCoreDate({v8_value})', 338 'Date': 'toWebCoreDate({v8_value})',
339 'DOMString': '{v8_value}', 339 'DOMString': '{v8_value}',
340 'boolean': '{v8_value}->BooleanValue()', 340 'boolean': '{v8_value}->BooleanValue()',
341 'float': 'static_cast<float>({v8_value}->NumberValue())', 341 'float': 'static_cast<float>({v8_value}->NumberValue())',
342 'double': 'static_cast<double>({v8_value}->NumberValue())', 342 'double': 'static_cast<double>({v8_value}->NumberValue())',
343 'byte': 'toInt8({arguments})', 343 'byte': 'toInt8({arguments})',
344 'octet': 'toUInt8({arguments})', 344 'octet': 'toUInt8({arguments})',
345 'short': 'toInt32({arguments})', 345 'short': 'toInt16({arguments})',
346 'unsigned short': 'toUInt32({arguments})', 346 'unsigned short': 'toUInt16({arguments})',
347 'long': 'toInt32({arguments})', 347 'long': 'toInt32({arguments})',
348 'unsigned long': 'toUInt32({arguments})', 348 'unsigned long': 'toUInt32({arguments})',
349 'long long': 'toInt64({arguments})', 349 'long long': 'toInt64({arguments})',
350 'unsigned long long': 'toUInt64({arguments})', 350 'unsigned long long': 'toUInt64({arguments})',
351 } 351 }
352 V8_VALUE_TO_CPP_VALUE_AND_INCLUDES = { 352 V8_VALUE_TO_CPP_VALUE_AND_INCLUDES = {
353 # idl_type -> (cpp_expression_format, includes) 353 # idl_type -> (cpp_expression_format, includes)
354 'any': ('ScriptValue({v8_value}, info.GetIsolate())', 354 'any': ('ScriptValue({v8_value}, info.GetIsolate())',
355 set(['bindings/v8/ScriptValue.h'])), 355 set(['bindings/v8/ScriptValue.h'])),
356 'CompareHow': ('static_cast<Range::CompareHow>({v8_value}->Int32Value())', 356 'CompareHow': ('static_cast<Range::CompareHow>({v8_value}->Int32Value())',
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 579
580 580
581 def cpp_value_to_v8_value(idl_type, cpp_value, isolate='info.GetIsolate()', exte nded_attributes=None): 581 def cpp_value_to_v8_value(idl_type, cpp_value, isolate='info.GetIsolate()', exte nded_attributes=None):
582 """Returns an expression that converts a C++ value to a V8 value.""" 582 """Returns an expression that converts a C++ value to a V8 value."""
583 # the isolate parameter is needed for callback interfaces 583 # the isolate parameter is needed for callback interfaces
584 idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, ext ended_attributes) 584 idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, ext ended_attributes)
585 this_v8_conversion_type = v8_conversion_type(idl_type, extended_attributes) 585 this_v8_conversion_type = v8_conversion_type(idl_type, extended_attributes)
586 format_string = CPP_VALUE_TO_V8_VALUE[this_v8_conversion_type] 586 format_string = CPP_VALUE_TO_V8_VALUE[this_v8_conversion_type]
587 statement = format_string.format(cpp_value=cpp_value, isolate=isolate) 587 statement = format_string.format(cpp_value=cpp_value, isolate=isolate)
588 return statement 588 return statement
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698