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

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

Issue 17063016: Remove leak of objects between isolated worlds on custom events. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Reverted to version that expects GetHiddenValue to not return an empty Handle for undefined 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
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 2648 matching lines...) Expand 10 before | Expand all | Expand 10 after
2659 throwNotEnoughArgumentsError(args.GetIsolate()); 2659 throwNotEnoughArgumentsError(args.GetIsolate());
2660 return; 2660 return;
2661 } 2661 }
2662 2662
2663 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, type, args[0]); 2663 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, type, args[0]);
2664 ${implClassName}Init eventInit; 2664 ${implClassName}Init eventInit;
2665 if (args.Length() >= 2) { 2665 if (args.Length() >= 2) {
2666 V8TRYCATCH_VOID(Dictionary, options, Dictionary(args[1], args.GetIsolate ())); 2666 V8TRYCATCH_VOID(Dictionary, options, Dictionary(args[1], args.GetIsolate ()));
2667 if (!fill${implClassName}Init(eventInit, options)) 2667 if (!fill${implClassName}Init(eventInit, options))
2668 return; 2668 return;
2669 END
2670 for (my $index = 0; $index < @{$interface->attributes}; $index++) {
2671 my $attribute = @{$interface->attributes}[$index];
2672 if ($attribute->type eq "any") {
2673 my $attributeName = $attribute->name;
2674 $implementation{nameSpaceInternal}->add(<<END);
2675 v8::Local<v8::Value> ${attributeName};
2676 options.get("${attributeName}", ${attributeName});
2677 if (!${attributeName}.IsEmpty())
2678 args.Holder()->SetHiddenValue(V8HiddenPropertyName::${attributeName} (), ${attributeName});
2679 END
2680 }
2681 }
2682 $implementation{nameSpaceInternal}->add(<<END);
2669 } 2683 }
2670 2684
2671 RefPtr<${implClassName}> event = ${implClassName}::create(type, eventInit); 2685 RefPtr<${implClassName}> event = ${implClassName}::create(type, eventInit);
2672 2686
2673 v8::Handle<v8::Object> wrapper = args.Holder(); 2687 v8::Handle<v8::Object> wrapper = args.Holder();
2674 V8DOMWrapper::associateObjectWithWrapper(event.release(), &${v8ClassName}::i nfo, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent); 2688 V8DOMWrapper::associateObjectWithWrapper(event.release(), &${v8ClassName}::i nfo, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
2675 args.GetReturnValue().Set(wrapper); 2689 v8SetReturnValue(args, wrapper);
2676 } 2690 }
2677 END 2691 END
2678 2692
2679 my $code = ""; 2693 my $code = "";
2680 $code .= <<END; 2694 $code .= <<END;
2681 bool fill${implClassName}Init(${implClassName}Init& eventInit, const Dictionary& options) 2695 bool fill${implClassName}Init(${implClassName}Init& eventInit, const Dictionary& options)
2682 { 2696 {
2683 END 2697 END
2684 2698
2685 foreach my $interfaceBase (@{$interface->parents}) { 2699 foreach my $interfaceBase (@{$interface->parents}) {
2686 $code .= <<END; 2700 $code .= <<END;
2687 if (!fill${interfaceBase}Init(eventInit, options)) 2701 if (!fill${interfaceBase}Init(eventInit, options))
2688 return false; 2702 return false;
2689 2703
2690 END 2704 END
2691 } 2705 }
2692 2706
2693 for (my $index = 0; $index < @{$interface->attributes}; $index++) { 2707 for (my $index = 0; $index < @{$interface->attributes}; $index++) {
2694 my $attribute = @{$interface->attributes}[$index]; 2708 my $attribute = @{$interface->attributes}[$index];
2695 if ($attribute->extendedAttributes->{"InitializedByEventConstructor"}) { 2709 if ($attribute->extendedAttributes->{"InitializedByEventConstructor"}) {
2696 my $attributeName = $attribute->name; 2710 my $attributeName = $attribute->name;
2697 $code .= " options.get(\"$attributeName\", eventInit.$attributeNa me);\n"; 2711 my $attributeType = $attribute->type;
2712 if (not ($attribute->type eq "any")) {
haraken 2013/06/27 04:50:27 Perhaps you need to update run bindings tests.
jww 2013/06/27 17:44:42 Done.
2713 $code .= " options.get(\"$attributeName\", eventInit.$attribu teName);\n";
2714 }
2698 } 2715 }
2699 } 2716 }
2700 2717
2701 $code .= <<END; 2718 $code .= <<END;
2702 return true; 2719 return true;
2703 } 2720 }
2704 2721
2705 END 2722 END
2706 $implementation{nameSpaceWebCore}->add($code); 2723 $implementation{nameSpaceWebCore}->add($code);
2707 } 2724 }
(...skipping 3328 matching lines...) Expand 10 before | Expand all | Expand 10 after
6036 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { 6053 if ($currentInterface->extendedAttributes->{$extendedAttribute}) {
6037 $found = 1; 6054 $found = 1;
6038 } 6055 }
6039 return 1 if $found; 6056 return 1 if $found;
6040 }, 0); 6057 }, 0);
6041 6058
6042 return $found; 6059 return $found;
6043 } 6060 }
6044 6061
6045 1; 6062 1;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698