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

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

Issue 173363002: Move mediastream module to oilpan transition types (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 5422 matching lines...) Expand 10 before | Expand all | Expand 10 after
5433 $code .= $nativeValue . "\n" if $nativeValue; # Skip blank line for void re turn type 5433 $code .= $nativeValue . "\n" if $nativeValue; # Skip blank line for void re turn type
5434 5434
5435 return $code; 5435 return $code;
5436 } 5436 }
5437 5437
5438 sub GetNativeType 5438 sub GetNativeType
5439 { 5439 {
5440 my $type = shift; 5440 my $type = shift;
5441 my $extendedAttributes = shift; 5441 my $extendedAttributes = shift;
5442 my $isParameter = shift; 5442 my $isParameter = shift;
5443 my $isMember = shift;
haraken 2014/02/27 15:32:43 The Perl generator is already gone, so you can rem
5443 5444
5444 my $svgNativeType = GetSVGTypeNeedingTearOff($type); 5445 my $svgNativeType = GetSVGTypeNeedingTearOff($type);
5445 if ($svgNativeType) { 5446 if ($svgNativeType) {
5446 if ($svgNativeType =~ /List$/) { 5447 if ($svgNativeType =~ /List$/) {
5447 return "${svgNativeType}*"; 5448 return "${svgNativeType}*";
5448 } else { 5449 } else {
5449 return "RefPtr<${svgNativeType} >"; 5450 return "RefPtr<${svgNativeType} >";
5450 } 5451 }
5451 } 5452 }
5452 5453
(...skipping 30 matching lines...) Expand all
5483 } 5484 }
5484 5485
5485 # We need to check [ImplementedAs] extended attribute for wrapper types. 5486 # We need to check [ImplementedAs] extended attribute for wrapper types.
5486 return "RefPtrWillBeRawPtr<$type>" if $type eq "XPathNSResolver"; # FIXME: Remove custom bindings for XPathNSResolver. 5487 return "RefPtrWillBeRawPtr<$type>" if $type eq "XPathNSResolver"; # FIXME: Remove custom bindings for XPathNSResolver.
5487 if (IsWrapperType($type)) { 5488 if (IsWrapperType($type)) {
5488 my $interface = ParseInterface($type); 5489 my $interface = ParseInterface($type);
5489 my $implClassName = GetImplName($interface); 5490 my $implClassName = GetImplName($interface);
5490 if ($isParameter) { 5491 if ($isParameter) {
5491 return "$implClassName*"; 5492 return "$implClassName*";
5492 } elsif (IsWillBeGarbageCollectedType($interface->name)) { 5493 } elsif (IsWillBeGarbageCollectedType($interface->name)) {
5493 return "RefPtrWillBeRawPtr<$implClassName>"; 5494 if ($isMember) {
5495 return "RefPtrWillBeMember<$implClassName>";
5496 } else {
5497 return "RefPtrWillBeRawPtr<$implClassName>";
5498 }
5494 } else { 5499 } else {
5495 return "RefPtr<$implClassName>"; 5500 return "RefPtr<$implClassName>";
5496 } 5501 }
5497 } 5502 }
5498 return "RefPtr<$type>" if IsRefPtrType($type) and (not $isParameter or $nonW rapperTypes{$type}); 5503 return "RefPtr<$type>" if IsRefPtrType($type) and (not $isParameter or $nonW rapperTypes{$type});
5499 5504
5500 my $arrayOrSequenceType = GetArrayOrSequenceType($type); 5505 my $arrayOrSequenceType = GetArrayOrSequenceType($type);
5501 5506
5502 if ($arrayOrSequenceType) { 5507 if ($arrayOrSequenceType) {
5503 my $nativeType = GetNativeType($arrayOrSequenceType); 5508 if (IsWillBeGarbageCollectedType($arrayOrSequenceType)) {
5504 $nativeType .= " " if ($nativeType =~ />$/); 5509 my $nativeType = GetNativeType($arrayOrSequenceType, {}, "", "member ");
5505 return "Vector<${nativeType}>"; 5510 $nativeType .= " " if ($nativeType =~ />$/);
5511 return "WillBeHeapVector<${nativeType}>";
5512 } else {
5513 my $nativeType = GetNativeType($arrayOrSequenceType);
5514 $nativeType .= " " if ($nativeType =~ />$/);
5515 return "Vector<${nativeType}>";
5516 }
5506 } 5517 }
5507 5518
5508 # Default, assume native type is a pointer with same type name as idl type 5519 # Default, assume native type is a pointer with same type name as idl type
5509 return "${type}*"; 5520 return "${type}*";
5510 } 5521 }
5511 5522
5512 sub GetNativeTypeForCallbacks 5523 sub GetNativeTypeForCallbacks
5513 { 5524 {
5514 my $type = shift; 5525 my $type = shift;
5515 return "const String&" if $type eq "DOMString"; 5526 return "const String&" if $type eq "DOMString";
5516 return "PassRefPtr<SerializedScriptValue>" if $type eq "SerializedScriptValu e"; 5527 return "PassRefPtr<SerializedScriptValue>" if $type eq "SerializedScriptValu e";
5517 return "void" if $type eq "void"; 5528 return "void" if $type eq "void";
5518 5529
5519 # Callbacks use raw pointers, so pass isParameter = 1 5530 # Callbacks use raw pointers, so pass isParameter = 1
5520 my $nativeType = GetNativeType($type, {}, "parameter"); 5531 my $nativeType = GetNativeType($type, {}, "parameter");
5521 return "const $nativeType&" if $nativeType =~ /^Vector/; 5532 return "const $nativeType&" if $nativeType =~ /^Vector/;
5533 return "const $nativeType&" if $nativeType =~ /^WillBeHeapVector/;
5522 return $nativeType; 5534 return $nativeType;
5523 } 5535 }
5524 5536
5525 sub JSValueToNativeStatement 5537 sub JSValueToNativeStatement
5526 { 5538 {
5527 my $type = shift; 5539 my $type = shift;
5528 my $extendedAttributes = shift; 5540 my $extendedAttributes = shift;
5529 my $argIndexOrZero = shift; 5541 my $argIndexOrZero = shift;
5530 my $jsValue = shift; 5542 my $jsValue = shift;
5531 my $variableName = shift; 5543 my $variableName = shift;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
5620 return "$value->Is${type}() ? V8${type}::toNative(v8::Handle<v8::${type} >::Cast($value)) : 0" 5632 return "$value->Is${type}() ? V8${type}::toNative(v8::Handle<v8::${type} >::Cast($value)) : 0"
5621 } 5633 }
5622 5634
5623 if ($type eq "XPathNSResolver") { 5635 if ($type eq "XPathNSResolver") {
5624 return "toXPathNSResolver($value, $getIsolate)"; 5636 return "toXPathNSResolver($value, $getIsolate)";
5625 } 5637 }
5626 5638
5627 my $arrayOrSequenceType = GetArrayOrSequenceType($type); 5639 my $arrayOrSequenceType = GetArrayOrSequenceType($type);
5628 5640
5629 if ($arrayOrSequenceType) { 5641 if ($arrayOrSequenceType) {
5642 if (IsWillBeGarbageCollectedType($arrayOrSequenceType)) {
5643 AddToImplIncludes("V8${arrayOrSequenceType}.h");
5644 return "(toMemberNativeArray<${arrayOrSequenceType}, V8${arrayOrSequ enceType}>($value, $argIndexOrZero, $getIsolate))";
5645 }
5630 if (IsRefPtrType($arrayOrSequenceType)) { 5646 if (IsRefPtrType($arrayOrSequenceType)) {
5631 AddToImplIncludes("V8${arrayOrSequenceType}.h"); 5647 AddToImplIncludes("V8${arrayOrSequenceType}.h");
5632 return "(toRefPtrNativeArray<${arrayOrSequenceType}, V8${arrayOrSequ enceType}>($value, $argIndexOrZero, $getIsolate))"; 5648 return "(toRefPtrNativeArray<${arrayOrSequenceType}, V8${arrayOrSequ enceType}>($value, $argIndexOrZero, $getIsolate))";
5633 } 5649 }
5634 return "toNativeArray<" . GetNativeType($arrayOrSequenceType) . ">($valu e, $argIndexOrZero, $getIsolate)"; 5650 return "toNativeArray<" . GetNativeType($arrayOrSequenceType) . ">($valu e, $argIndexOrZero, $getIsolate)";
5635 } 5651 }
5636 5652
5637 AddIncludesForType($type); 5653 AddIncludesForType($type);
5638 5654
5639 AddToImplIncludes("V8${type}.h"); 5655 AddToImplIncludes("V8${type}.h");
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
6468 if ($parameter->type eq "SerializedScriptValue") { 6484 if ($parameter->type eq "SerializedScriptValue") {
6469 return 1; 6485 return 1;
6470 } elsif (IsIntegerType($parameter->type)) { 6486 } elsif (IsIntegerType($parameter->type)) {
6471 return 1; 6487 return 1;
6472 } 6488 }
6473 } 6489 }
6474 return 0; 6490 return 0;
6475 } 6491 }
6476 6492
6477 1; 6493 1;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698