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

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

Issue 140653013: Have DOMImplementation::document() return reference. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added SetWrapperReferenceFromReference IDL attribute 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
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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 my $idlFilename = Cwd::abs_path(IDLFileForInterface($interfaceName)) or die("Could NOT find IDL file for interface \"$interfaceName\" $!\n"); 498 my $idlFilename = Cwd::abs_path(IDLFileForInterface($interfaceName)) or die("Could NOT find IDL file for interface \"$interfaceName\" $!\n");
499 my $idlRelPath = File::Spec->abs2rel($idlFilename, $sourceRoot); 499 my $idlRelPath = File::Spec->abs2rel($idlFilename, $sourceRoot);
500 push(@includes, dirname($idlRelPath) . "/" . $implClassName . ".h"); 500 push(@includes, dirname($idlRelPath) . "/" . $implClassName . ".h");
501 } 501 }
502 return @includes; 502 return @includes;
503 } 503 }
504 504
505 sub NeedsVisitDOMWrapper 505 sub NeedsVisitDOMWrapper
506 { 506 {
507 my $interface = shift; 507 my $interface = shift;
508 return ExtendedAttributeContains($interface->extendedAttributes->{"Custom"}, "VisitDOMWrapper") || $interface->extendedAttributes->{"SetWrapperReferenceFrom "} || $interface->extendedAttributes->{"SetWrapperReferenceTo"} || SVGTypeNeedsT oHoldContextElement($interface->name); 508 return ExtendedAttributeContains($interface->extendedAttributes->{"Custom"}, "VisitDOMWrapper") || $interface->extendedAttributes->{"SetWrapperReferenceFrom "} || $interface->extendedAttributes->{"SetWrapperReferenceFromReference"} || $i nterface->extendedAttributes->{"SetWrapperReferenceTo"} || SVGTypeNeedsToHoldCon textElement($interface->name);
509 } 509 }
510 510
511 sub GenerateVisitDOMWrapper 511 sub GenerateVisitDOMWrapper
512 { 512 {
513 my $interface = shift; 513 my $interface = shift;
514 my $implClassName = GetImplName($interface); 514 my $implClassName = GetImplName($interface);
515 my $v8ClassName = GetV8ClassName($interface); 515 my $v8ClassName = GetV8ClassName($interface);
516 516
517 if (ExtendedAttributeContains($interface->extendedAttributes->{"Custom"}, "V isitDOMWrapper")) { 517 if (ExtendedAttributeContains($interface->extendedAttributes->{"Custom"}, "V isitDOMWrapper")) {
518 return; 518 return;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 AddToImplIncludes("core/dom/Element.h"); 569 AddToImplIncludes("core/dom/Element.h");
570 $code .= <<END; 570 $code .= <<END;
571 if (Node* owner = impl->${isReachableMethod}()) { 571 if (Node* owner = impl->${isReachableMethod}()) {
572 Node* root = V8GCController::opaqueRootForGC(owner, isolate); 572 Node* root = V8GCController::opaqueRootForGC(owner, isolate);
573 isolate->SetReferenceFromGroup(v8::UniqueId(reinterpret_cast<intptr_t>(r oot)), wrapper); 573 isolate->SetReferenceFromGroup(v8::UniqueId(reinterpret_cast<intptr_t>(r oot)), wrapper);
574 return; 574 return;
575 } 575 }
576 END 576 END
577 } 577 }
578 578
579 $code .= <<END; 579 my $isReachableReferenceMethod = $interface->extendedAttributes->{"SetWrappe rReferenceFromReference"};
Inactive 2014/02/04 14:31:40 I would try to merge this as much as possible with
580 if ($isReachableReferenceMethod) {
581 AddToImplIncludes("bindings/v8/V8GCController.h");
582 AddToImplIncludes("core/dom/Element.h");
583 $code .= <<END;
584 Node* root = V8GCController::opaqueRootForGC(&impl->${isReachableReferenceMe thod}(), isolate);
585 isolate->SetReferenceFromGroup(v8::UniqueId(reinterpret_cast<intptr_t>(root) ), wrapper);
586 }
587
588 END
589 }
590
591 if (!$isReachableReferenceMethod) {
592 $code .= <<END;
580 setObjectGroup(object, wrapper, isolate); 593 setObjectGroup(object, wrapper, isolate);
581 } 594 }
582 595
583 END 596 END
597 }
598
584 $implementation{nameSpaceWebCore}->add($code); 599 $implementation{nameSpaceWebCore}->add($code);
585 } 600 }
586 601
587 sub GetSVGPropertyTypes 602 sub GetSVGPropertyTypes
588 { 603 {
589 my $implType = shift; 604 my $implType = shift;
590 605
591 my $svgPropertyType; 606 my $svgPropertyType;
592 my $svgListPropertyType; 607 my $svgListPropertyType;
593 my $svgNativeType; 608 my $svgNativeType;
(...skipping 5822 matching lines...) Expand 10 before | Expand all | Expand 10 after
6416 if ($parameter->type eq "SerializedScriptValue") { 6431 if ($parameter->type eq "SerializedScriptValue") {
6417 return 1; 6432 return 1;
6418 } elsif (IsIntegerType($parameter->type)) { 6433 } elsif (IsIntegerType($parameter->type)) {
6419 return 1; 6434 return 1;
6420 } 6435 }
6421 } 6436 }
6422 return 0; 6437 return 0;
6423 } 6438 }
6424 6439
6425 1; 6440 1;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698