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

Side by Side Diff: Source/bindings/scripts/CodeGeneratorV8.pm

Issue 16951005: Add support for byte and octet Web IDL types to the bindings generator (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Take Joshua's feedback into consideration Created 7 years, 6 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) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> 1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> 2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com>
3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> 4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org>
5 # Copyright (C) 2006 Apple Computer, Inc. 5 # Copyright (C) 2006 Apple Computer, Inc.
6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc. 6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc.
7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> 7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
8 # Copyright (C) Research In Motion Limited 2010. All rights reserved. 8 # Copyright (C) Research In Motion Limited 2010. All rights reserved.
9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 # Copyright (C) 2012 Ericsson AB. All rights reserved. 10 # Copyright (C) 2012 Ericsson AB. All rights reserved.
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 # Root ... Copyright 145 # Root ... Copyright
146 # Conditional ... #if FEATURE ... #endif (to be removed soon) 146 # Conditional ... #if FEATURE ... #endif (to be removed soon)
147 # Includes 147 # Includes
148 # NameSpaceWebCore 148 # NameSpaceWebCore
149 # NameSpaceInternal ... namespace ${implClassName}V8Internal in case of no n-callback 149 # NameSpaceInternal ... namespace ${implClassName}V8Internal in case of no n-callback
150 my %implementation; 150 my %implementation;
151 151
152 my %primitiveTypeHash = ("boolean" => 1, 152 my %primitiveTypeHash = ("boolean" => 1,
153 "void" => 1, 153 "void" => 1,
154 "Date" => 1, 154 "Date" => 1,
155 "byte" => 1,
156 "octet" => 1,
155 "short" => 1, 157 "short" => 1,
156 "long" => 1, 158 "long" => 1,
157 "long long" => 1, 159 "long long" => 1,
158 "unsigned short" => 1, 160 "unsigned short" => 1,
159 "unsigned long" => 1, 161 "unsigned long" => 1,
160 "unsigned long long" => 1, 162 "unsigned long long" => 1,
161 "float" => 1, 163 "float" => 1,
162 "double" => 1, 164 "double" => 1,
163 ); 165 );
164 166
(...skipping 4655 matching lines...) Expand 10 before | Expand all | Expand 10 after
4820 if ($svgNativeType) { 4822 if ($svgNativeType) {
4821 if ($svgNativeType =~ /List$/) { 4823 if ($svgNativeType =~ /List$/) {
4822 return "${svgNativeType}*"; 4824 return "${svgNativeType}*";
4823 } else { 4825 } else {
4824 return "RefPtr<${svgNativeType} >"; 4826 return "RefPtr<${svgNativeType} >";
4825 } 4827 }
4826 } 4828 }
4827 4829
4828 return "float" if $type eq "float"; 4830 return "float" if $type eq "float";
4829 return "double" if $type eq "double"; 4831 return "double" if $type eq "double";
4830 return "int" if $type eq "long" or $type eq "int" or $type eq "short" or $ty pe eq "unsigned short"; 4832 return "int" if $type eq "long" or $type eq "int" or $type eq "short" or $ty pe eq "byte";
4831 return "unsigned" if $type eq "unsigned long" or $type eq "unsigned int"; 4833 return "unsigned" if $type eq "unsigned long" or $type eq "unsigned int" or $type eq "unsigned short" or $type eq "octet";
4832 return "long long" if $type eq "long long"; 4834 return "long long" if $type eq "long long";
4833 return "unsigned long long" if $type eq "unsigned long long"; 4835 return "unsigned long long" if $type eq "unsigned long long";
4834 return "bool" if $type eq "boolean"; 4836 return "bool" if $type eq "boolean";
4835 4837
4836 return "V8StringResource" if ($type eq "DOMString" or IsEnumType($type)) and $isParameter; 4838 return "V8StringResource" if ($type eq "DOMString" or IsEnumType($type)) and $isParameter;
4837 return "String" if $type eq "DOMString" or IsEnumType($type); 4839 return "String" if $type eq "DOMString" or IsEnumType($type);
4838 4840
4839 return "Range::CompareHow" if $type eq "CompareHow"; 4841 return "Range::CompareHow" if $type eq "CompareHow";
4840 return "DOMTimeStamp" if $type eq "DOMTimeStamp"; 4842 return "DOMTimeStamp" if $type eq "DOMTimeStamp";
4841 return "double" if $type eq "Date"; 4843 return "double" if $type eq "Date";
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
4886 my $extendedAttributes = shift; 4888 my $extendedAttributes = shift;
4887 my $value = shift; 4889 my $value = shift;
4888 my $getIsolate = shift; 4890 my $getIsolate = shift;
4889 4891
4890 my $intConversion = $extendedAttributes->{"EnforceRange"} ? "EnforceRange" : "NormalConversion"; 4892 my $intConversion = $extendedAttributes->{"EnforceRange"} ? "EnforceRange" : "NormalConversion";
4891 4893
4892 return "$value->BooleanValue()" if $type eq "boolean"; 4894 return "$value->BooleanValue()" if $type eq "boolean";
4893 return "static_cast<$type>($value->NumberValue())" if $type eq "float" or $t ype eq "double"; 4895 return "static_cast<$type>($value->NumberValue())" if $type eq "float" or $t ype eq "double";
4894 4896
4895 if ($intConversion ne "NormalConversion") { 4897 if ($intConversion ne "NormalConversion") {
4898 return "toInt8($value, $intConversion, ok)" if $type eq "byte";
4899 return "toUInt8($value, $intConversion, ok)" if $type eq "octet";
4896 return "toInt32($value, $intConversion, ok)" if $type eq "long" or $type eq "short"; 4900 return "toInt32($value, $intConversion, ok)" if $type eq "long" or $type eq "short";
4897 return "toUInt32($value, $intConversion, ok)" if $type eq "unsigned long " or $type eq "unsigned short"; 4901 return "toUInt32($value, $intConversion, ok)" if $type eq "unsigned long " or $type eq "unsigned short";
4898 return "toInt64($value, $intConversion, ok)" if $type eq "long long"; 4902 return "toInt64($value, $intConversion, ok)" if $type eq "long long";
4899 return "toUInt64($value, $intConversion, ok)" if $type eq "unsigned long long"; 4903 return "toUInt64($value, $intConversion, ok)" if $type eq "unsigned long long";
4900 } else { 4904 } else {
4905 return "toInt8($value)" if $type eq "byte";
4906 return "toUInt8($value)" if $type eq "octet";
4901 return "toInt32($value)" if $type eq "long" or $type eq "short"; 4907 return "toInt32($value)" if $type eq "long" or $type eq "short";
4902 return "toUInt32($value)" if $type eq "unsigned long" or $type eq "unsig ned short"; 4908 return "toUInt32($value)" if $type eq "unsigned long" or $type eq "unsig ned short";
4903 return "toInt64($value)" if $type eq "long long"; 4909 return "toInt64($value)" if $type eq "long long";
4904 return "toUInt64($value)" if $type eq "unsigned long long"; 4910 return "toUInt64($value)" if $type eq "unsigned long long";
4905 } 4911 }
4906 return "static_cast<Range::CompareHow>($value->Int32Value())" if $type eq "C ompareHow"; 4912 return "static_cast<Range::CompareHow>($value->Int32Value())" if $type eq "C ompareHow";
4907 return "toWebCoreDate($value)" if $type eq "Date"; 4913 return "toWebCoreDate($value)" if $type eq "Date";
4908 return "toDOMStringList($value, $getIsolate)" if $type eq "DOMStringList"; 4914 return "toDOMStringList($value, $getIsolate)" if $type eq "DOMStringList";
4909 4915
4910 if ($type eq "DOMString" or IsEnumType($type)) { 4916 if ($type eq "DOMString" or IsEnumType($type)) {
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
5856 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { 5862 if ($currentInterface->extendedAttributes->{$extendedAttribute}) {
5857 $found = 1; 5863 $found = 1;
5858 } 5864 }
5859 return 1 if $found; 5865 return 1 if $found;
5860 }, 0); 5866 }, 0);
5861 5867
5862 return $found; 5868 return $found;
5863 } 5869 }
5864 5870
5865 1; 5871 1;
OLDNEW
« no previous file with comments | « LayoutTests/fast/js/webidl-type-mapping-expected.txt ('k') | Source/bindings/tests/idls/TestObject.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698