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

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: WIP 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 5411 matching lines...) Expand 10 before | Expand all | Expand 10 after
5422 $code .= $nativeValue . "\n" if $nativeValue; # Skip blank line for void re turn type 5422 $code .= $nativeValue . "\n" if $nativeValue; # Skip blank line for void re turn type
5423 5423
5424 return $code; 5424 return $code;
5425 } 5425 }
5426 5426
5427 sub GetNativeType 5427 sub GetNativeType
5428 { 5428 {
5429 my $type = shift; 5429 my $type = shift;
5430 my $extendedAttributes = shift; 5430 my $extendedAttributes = shift;
5431 my $isParameter = shift; 5431 my $isParameter = shift;
5432 my $isMember = shift;
5432 5433
5433 my $svgNativeType = GetSVGTypeNeedingTearOff($type); 5434 my $svgNativeType = GetSVGTypeNeedingTearOff($type);
5434 if ($svgNativeType) { 5435 if ($svgNativeType) {
5435 if ($svgNativeType =~ /List$/) { 5436 if ($svgNativeType =~ /List$/) {
5436 return "${svgNativeType}*"; 5437 return "${svgNativeType}*";
5437 } else { 5438 } else {
5438 return "RefPtr<${svgNativeType} >"; 5439 return "RefPtr<${svgNativeType} >";
5439 } 5440 }
5440 } 5441 }
5441 5442
(...skipping 30 matching lines...) Expand all
5472 } 5473 }
5473 5474
5474 # We need to check [ImplementedAs] extended attribute for wrapper types. 5475 # We need to check [ImplementedAs] extended attribute for wrapper types.
5475 return "RefPtrWillBeRawPtr<$type>" if $type eq "XPathNSResolver"; # FIXME: Remove custom bindings for XPathNSResolver. 5476 return "RefPtrWillBeRawPtr<$type>" if $type eq "XPathNSResolver"; # FIXME: Remove custom bindings for XPathNSResolver.
5476 if (IsWrapperType($type)) { 5477 if (IsWrapperType($type)) {
5477 my $interface = ParseInterface($type); 5478 my $interface = ParseInterface($type);
5478 my $implClassName = GetImplName($interface); 5479 my $implClassName = GetImplName($interface);
5479 if ($isParameter) { 5480 if ($isParameter) {
5480 return "$implClassName*"; 5481 return "$implClassName*";
5481 } elsif (IsWillBeGarbageCollectedType($interface->name)) { 5482 } elsif (IsWillBeGarbageCollectedType($interface->name)) {
5482 return "RefPtrWillBeRawPtr<$implClassName>"; 5483 if ($isMember) {
5484 return "RefPtrWillBeMember<$implClassName>";
Nils Barth (inactive) 2014/02/26 07:17:54 Keishi, could you please add a test case? Since t
keishi 2014/02/27 07:33:34 I'm not sure if it is right but I've added a test.
Nils Barth (inactive) 2014/02/27 11:20:53 Thanks, looks generally ok; I'll take a closer loo
Nils Barth (inactive) 2014/03/03 02:47:53 Current test case looks ok, but you need one more
5485 } else {
5486 return "RefPtrWillBeRawPtr<$implClassName>";
5487 }
5483 } else { 5488 } else {
5484 return "RefPtr<$implClassName>"; 5489 return "RefPtr<$implClassName>";
5485 } 5490 }
5486 } 5491 }
5487 return "RefPtr<$type>" if IsRefPtrType($type) and (not $isParameter or $nonW rapperTypes{$type}); 5492 return "RefPtr<$type>" if IsRefPtrType($type) and (not $isParameter or $nonW rapperTypes{$type});
5488 5493
5489 my $arrayOrSequenceType = GetArrayOrSequenceType($type); 5494 my $arrayOrSequenceType = GetArrayOrSequenceType($type);
5490 5495
5491 if ($arrayOrSequenceType) { 5496 if ($arrayOrSequenceType) {
5492 my $nativeType = GetNativeType($arrayOrSequenceType); 5497 if (IsWillBeGarbageCollectedType($arrayOrSequenceType)) {
5493 $nativeType .= " " if ($nativeType =~ />$/); 5498 my $nativeType = GetNativeType($arrayOrSequenceType, {}, "", "member ");
5494 return "Vector<${nativeType}>"; 5499 $nativeType .= " " if ($nativeType =~ />$/);
5500 return "WillBeHeapVector<${nativeType}>";
5501 } else {
5502 my $nativeType = GetNativeType($arrayOrSequenceType);
5503 $nativeType .= " " if ($nativeType =~ />$/);
5504 return "Vector<${nativeType}>";
5505 }
5495 } 5506 }
5496 5507
5497 # Default, assume native type is a pointer with same type name as idl type 5508 # Default, assume native type is a pointer with same type name as idl type
5498 return "${type}*"; 5509 return "${type}*";
5499 } 5510 }
5500 5511
5501 sub GetNativeTypeForCallbacks 5512 sub GetNativeTypeForCallbacks
5502 { 5513 {
5503 my $type = shift; 5514 my $type = shift;
5504 return "const String&" if $type eq "DOMString"; 5515 return "const String&" if $type eq "DOMString";
5505 return "PassRefPtr<SerializedScriptValue>" if $type eq "SerializedScriptValu e"; 5516 return "PassRefPtr<SerializedScriptValue>" if $type eq "SerializedScriptValu e";
5506 return "void" if $type eq "void"; 5517 return "void" if $type eq "void";
5507 5518
5508 # Callbacks use raw pointers, so pass isParameter = 1 5519 # Callbacks use raw pointers, so pass isParameter = 1
5509 my $nativeType = GetNativeType($type, {}, "parameter"); 5520 my $nativeType = GetNativeType($type, {}, "parameter");
5510 return "const $nativeType&" if $nativeType =~ /^Vector/; 5521 return "const $nativeType&" if $nativeType =~ /^Vector/;
5522 return "const $nativeType&" if $nativeType =~ /^WillBeHeapVector/;
5511 return $nativeType; 5523 return $nativeType;
5512 } 5524 }
5513 5525
5514 sub JSValueToNativeStatement 5526 sub JSValueToNativeStatement
5515 { 5527 {
5516 my $type = shift; 5528 my $type = shift;
5517 my $extendedAttributes = shift; 5529 my $extendedAttributes = shift;
5518 my $argIndexOrZero = shift; 5530 my $argIndexOrZero = shift;
5519 my $jsValue = shift; 5531 my $jsValue = shift;
5520 my $variableName = shift; 5532 my $variableName = shift;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
5609 return "$value->Is${type}() ? V8${type}::toNative(v8::Handle<v8::${type} >::Cast($value)) : 0" 5621 return "$value->Is${type}() ? V8${type}::toNative(v8::Handle<v8::${type} >::Cast($value)) : 0"
5610 } 5622 }
5611 5623
5612 if ($type eq "XPathNSResolver") { 5624 if ($type eq "XPathNSResolver") {
5613 return "toXPathNSResolver($value, $getIsolate)"; 5625 return "toXPathNSResolver($value, $getIsolate)";
5614 } 5626 }
5615 5627
5616 my $arrayOrSequenceType = GetArrayOrSequenceType($type); 5628 my $arrayOrSequenceType = GetArrayOrSequenceType($type);
5617 5629
5618 if ($arrayOrSequenceType) { 5630 if ($arrayOrSequenceType) {
5631 if (IsWillBeGarbageCollectedType($arrayOrSequenceType)) {
5632 AddToImplIncludes("V8${arrayOrSequenceType}.h");
5633 return "(toRefPtrWillBeMemberNativeArray<${arrayOrSequenceType}, V8$ {arrayOrSequenceType}>($value, $argIndexOrZero, $getIsolate))";
haraken 2014/02/26 13:58:37 Still I don't fully understand why we need toRefPt
keishi 2014/02/27 07:33:34 I misunderstood. Done.
5634 }
5619 if (IsRefPtrType($arrayOrSequenceType)) { 5635 if (IsRefPtrType($arrayOrSequenceType)) {
5620 AddToImplIncludes("V8${arrayOrSequenceType}.h"); 5636 AddToImplIncludes("V8${arrayOrSequenceType}.h");
5621 return "(toRefPtrNativeArray<${arrayOrSequenceType}, V8${arrayOrSequ enceType}>($value, $argIndexOrZero, $getIsolate))"; 5637 return "(toRefPtrNativeArray<${arrayOrSequenceType}, V8${arrayOrSequ enceType}>($value, $argIndexOrZero, $getIsolate))";
5622 } 5638 }
5623 return "toNativeArray<" . GetNativeType($arrayOrSequenceType) . ">($valu e, $argIndexOrZero, $getIsolate)"; 5639 return "toNativeArray<" . GetNativeType($arrayOrSequenceType) . ">($valu e, $argIndexOrZero, $getIsolate)";
5624 } 5640 }
5625 5641
5626 AddIncludesForType($type); 5642 AddIncludesForType($type);
5627 5643
5628 AddToImplIncludes("V8${type}.h"); 5644 AddToImplIncludes("V8${type}.h");
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
6459 if ($parameter->type eq "SerializedScriptValue") { 6475 if ($parameter->type eq "SerializedScriptValue") {
6460 return 1; 6476 return 1;
6461 } elsif (IsIntegerType($parameter->type)) { 6477 } elsif (IsIntegerType($parameter->type)) {
6462 return 1; 6478 return 1;
6463 } 6479 }
6464 } 6480 }
6465 return 0; 6481 return 0;
6466 } 6482 }
6467 6483
6468 1; 6484 1;
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/v8/V8Binding.h » ('j') | Source/modules/mediastream/MediaDeviceInfo.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698