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

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 Kentaro'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 4636 matching lines...) Expand 10 before | Expand all | Expand 10 after
4801 if ($svgNativeType) { 4803 if ($svgNativeType) {
4802 if ($svgNativeType =~ /List$/) { 4804 if ($svgNativeType =~ /List$/) {
4803 return "${svgNativeType}*"; 4805 return "${svgNativeType}*";
4804 } else { 4806 } else {
4805 return "RefPtr<${svgNativeType} >"; 4807 return "RefPtr<${svgNativeType} >";
4806 } 4808 }
4807 } 4809 }
4808 4810
4809 return "float" if $type eq "float"; 4811 return "float" if $type eq "float";
4810 return "double" if $type eq "double"; 4812 return "double" if $type eq "double";
4811 return "int" if $type eq "long" or $type eq "int" or $type eq "short" or $ty pe eq "unsigned short"; 4813 return "int" if $type eq "long" or $type eq "int" or $type eq "short" or $ty pe eq "byte";
4812 return "unsigned" if $type eq "unsigned long" or $type eq "unsigned int"; 4814 return "unsigned" if $type eq "unsigned long" or $type eq "unsigned int" or $type eq "unsigned short" or $type eq "octet";
4813 return "long long" if $type eq "long long"; 4815 return "long long" if $type eq "long long";
4814 return "unsigned long long" if $type eq "unsigned long long"; 4816 return "unsigned long long" if $type eq "unsigned long long";
4815 return "bool" if $type eq "boolean"; 4817 return "bool" if $type eq "boolean";
4816 4818
4817 return "V8StringResource" if ($type eq "DOMString" or IsEnumType($type)) and $isParameter; 4819 return "V8StringResource" if ($type eq "DOMString" or IsEnumType($type)) and $isParameter;
4818 return "String" if $type eq "DOMString" or IsEnumType($type); 4820 return "String" if $type eq "DOMString" or IsEnumType($type);
4819 4821
4820 return "Range::CompareHow" if $type eq "CompareHow"; 4822 return "Range::CompareHow" if $type eq "CompareHow";
4821 return "DOMTimeStamp" if $type eq "DOMTimeStamp"; 4823 return "DOMTimeStamp" if $type eq "DOMTimeStamp";
4822 return "double" if $type eq "Date"; 4824 return "double" if $type eq "Date";
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
4867 my $extendedAttributes = shift; 4869 my $extendedAttributes = shift;
4868 my $value = shift; 4870 my $value = shift;
4869 my $getIsolate = shift; 4871 my $getIsolate = shift;
4870 4872
4871 my $intConversion = $extendedAttributes->{"EnforceRange"} ? "EnforceRange" : "NormalConversion"; 4873 my $intConversion = $extendedAttributes->{"EnforceRange"} ? "EnforceRange" : "NormalConversion";
4872 4874
4873 return "$value->BooleanValue()" if $type eq "boolean"; 4875 return "$value->BooleanValue()" if $type eq "boolean";
4874 return "static_cast<$type>($value->NumberValue())" if $type eq "float" or $t ype eq "double"; 4876 return "static_cast<$type>($value->NumberValue())" if $type eq "float" or $t ype eq "double";
4875 4877
4876 if ($intConversion ne "NormalConversion") { 4878 if ($intConversion ne "NormalConversion") {
4879 return "toInt8($value, $intConversion, ok)" if $type eq "byte";
4880 return "toUInt8($value, $intConversion, ok)" if $type eq "octet";
4877 return "toInt32($value, $intConversion, ok)" if $type eq "long" or $type eq "short"; 4881 return "toInt32($value, $intConversion, ok)" if $type eq "long" or $type eq "short";
4878 return "toUInt32($value, $intConversion, ok)" if $type eq "unsigned long " or $type eq "unsigned short"; 4882 return "toUInt32($value, $intConversion, ok)" if $type eq "unsigned long " or $type eq "unsigned short";
4879 return "toInt64($value, $intConversion, ok)" if $type eq "long long"; 4883 return "toInt64($value, $intConversion, ok)" if $type eq "long long";
4880 return "toUInt64($value, $intConversion, ok)" if $type eq "unsigned long long"; 4884 return "toUInt64($value, $intConversion, ok)" if $type eq "unsigned long long";
4881 } else { 4885 } else {
4886 return "toInt8($value)" if $type eq "byte";
4887 return "toUInt8($value)" if $type eq "octet";
4882 return "toInt32($value)" if $type eq "long" or $type eq "short"; 4888 return "toInt32($value)" if $type eq "long" or $type eq "short";
4883 return "toUInt32($value)" if $type eq "unsigned long" or $type eq "unsig ned short"; 4889 return "toUInt32($value)" if $type eq "unsigned long" or $type eq "unsig ned short";
4884 return "toInt64($value)" if $type eq "long long"; 4890 return "toInt64($value)" if $type eq "long long";
4885 return "toUInt64($value)" if $type eq "unsigned long long"; 4891 return "toUInt64($value)" if $type eq "unsigned long long";
4886 } 4892 }
4887 return "static_cast<Range::CompareHow>($value->Int32Value())" if $type eq "C ompareHow"; 4893 return "static_cast<Range::CompareHow>($value->Int32Value())" if $type eq "C ompareHow";
4888 return "toWebCoreDate($value)" if $type eq "Date"; 4894 return "toWebCoreDate($value)" if $type eq "Date";
4889 return "toDOMStringList($value, $getIsolate)" if $type eq "DOMStringList"; 4895 return "toDOMStringList($value, $getIsolate)" if $type eq "DOMStringList";
4890 4896
4891 if ($type eq "DOMString" or IsEnumType($type)) { 4897 if ($type eq "DOMString" or IsEnumType($type)) {
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
5837 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { 5843 if ($currentInterface->extendedAttributes->{$extendedAttribute}) {
5838 $found = 1; 5844 $found = 1;
5839 } 5845 }
5840 return 1 if $found; 5846 return 1 if $found;
5841 }, 0); 5847 }, 0);
5842 5848
5843 return $found; 5849 return $found;
5844 } 5850 }
5845 5851
5846 1; 5852 1;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698