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

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

Issue 145103007: IDL compiler: always include GetPtr.h and RefPtr.h (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
« no previous file with comments | « no previous file | Source/bindings/scripts/unstable/v8_callback_interface.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3583 matching lines...) Expand 10 before | Expand all | Expand 10 after
3594 my $interface = shift; 3594 my $interface = shift;
3595 my $interfaceName = $interface->name; 3595 my $interfaceName = $interface->name;
3596 my $implClassName = GetImplName($interface); 3596 my $implClassName = GetImplName($interface);
3597 my $v8ClassName = GetV8ClassName($interface); 3597 my $v8ClassName = GetV8ClassName($interface);
3598 3598
3599 my $indexedGetterFunction = GetIndexedGetterFunction($interface); 3599 my $indexedGetterFunction = GetIndexedGetterFunction($interface);
3600 if ($indexedGetterFunction) { 3600 if ($indexedGetterFunction) {
3601 # includes for return type even if custom 3601 # includes for return type even if custom
3602 my $returnType = $indexedGetterFunction->type; 3602 my $returnType = $indexedGetterFunction->type;
3603 AddIncludesForType($returnType); 3603 AddIncludesForType($returnType);
3604 if (IsRefPtrType($returnType)) {
3605 AddToImplIncludes("wtf/RefPtr.h");
3606 AddToImplIncludes("wtf/GetPtr.h");
3607 }
3608 my $hasCustomIndexedGetter = $indexedGetterFunction->extendedAttributes- >{"Custom"}; 3604 my $hasCustomIndexedGetter = $indexedGetterFunction->extendedAttributes- >{"Custom"};
3609 if (!$hasCustomIndexedGetter) { 3605 if (!$hasCustomIndexedGetter) {
3610 GenerateImplementationIndexedPropertyGetter($interface, $indexedGett erFunction); 3606 GenerateImplementationIndexedPropertyGetter($interface, $indexedGett erFunction);
3611 } 3607 }
3612 GenerateImplementationIndexedPropertyGetterCallback($interface, $hasCust omIndexedGetter); 3608 GenerateImplementationIndexedPropertyGetterCallback($interface, $hasCust omIndexedGetter);
3613 } 3609 }
3614 3610
3615 my $indexedSetterFunction = GetIndexedSetterFunction($interface); 3611 my $indexedSetterFunction = GetIndexedSetterFunction($interface);
3616 if ($indexedSetterFunction) { 3612 if ($indexedSetterFunction) {
3617 AddIncludesForType($indexedSetterFunction->parameters->[1]->type); # in cludes for argument type even if custom 3613 AddIncludesForType($indexedSetterFunction->parameters->[1]->type); # in cludes for argument type even if custom
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
3820 my $implClassName = GetImplName($interface); 3816 my $implClassName = GetImplName($interface);
3821 my $v8ClassName = GetV8ClassName($interface); 3817 my $v8ClassName = GetV8ClassName($interface);
3822 3818
3823 my $namedGetterFunction = GetNamedGetterFunction($interface); 3819 my $namedGetterFunction = GetNamedGetterFunction($interface);
3824 my $namedEnumeratorFunction = $namedGetterFunction && !$namedGetterFunction- >extendedAttributes->{"NotEnumerable"}; 3820 my $namedEnumeratorFunction = $namedGetterFunction && !$namedGetterFunction- >extendedAttributes->{"NotEnumerable"};
3825 3821
3826 if ($namedGetterFunction) { 3822 if ($namedGetterFunction) {
3827 # includes for return type even if custom 3823 # includes for return type even if custom
3828 my $returnType = $namedGetterFunction->type; 3824 my $returnType = $namedGetterFunction->type;
3829 AddIncludesForType($returnType); 3825 AddIncludesForType($returnType);
3830 if (IsRefPtrType($returnType)) {
3831 AddToImplIncludes("wtf/RefPtr.h");
3832 AddToImplIncludes("wtf/GetPtr.h");
3833 }
3834 my $hasCustomNamedGetter = HasCustomPropertyGetter($namedGetterFunction- >extendedAttributes); 3826 my $hasCustomNamedGetter = HasCustomPropertyGetter($namedGetterFunction- >extendedAttributes);
3835 if (!$hasCustomNamedGetter) { 3827 if (!$hasCustomNamedGetter) {
3836 GenerateImplementationNamedPropertyGetter($interface, $namedGetterFu nction); 3828 GenerateImplementationNamedPropertyGetter($interface, $namedGetterFu nction);
3837 } 3829 }
3838 GenerateImplementationNamedPropertyGetterCallback($interface, $hasCustom NamedGetter); 3830 GenerateImplementationNamedPropertyGetterCallback($interface, $hasCustom NamedGetter);
3839 } 3831 }
3840 3832
3841 my $namedSetterFunction = GetNamedSetterFunction($interface); 3833 my $namedSetterFunction = GetNamedSetterFunction($interface);
3842 if ($namedSetterFunction) { 3834 if ($namedSetterFunction) {
3843 AddIncludesForType($namedSetterFunction->parameters->[1]->type); # incl udes for argument type even if custom 3835 AddIncludesForType($namedSetterFunction->parameters->[1]->type); # incl udes for argument type even if custom
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
4272 my $interfaceName = $interface->name; 4264 my $interfaceName = $interface->name;
4273 my $implClassName = GetImplName($interface); 4265 my $implClassName = GetImplName($interface);
4274 my $v8ClassName = GetV8ClassName($interface); 4266 my $v8ClassName = GetV8ClassName($interface);
4275 my $nativeType = GetNativeTypeForConversions($interface); 4267 my $nativeType = GetNativeTypeForConversions($interface);
4276 4268
4277 AddToImplIncludes("RuntimeEnabledFeatures.h"); 4269 AddToImplIncludes("RuntimeEnabledFeatures.h");
4278 AddToImplIncludes("bindings/v8/ExceptionState.h"); 4270 AddToImplIncludes("bindings/v8/ExceptionState.h");
4279 AddToImplIncludes("core/dom/ContextFeatures.h"); 4271 AddToImplIncludes("core/dom/ContextFeatures.h");
4280 AddToImplIncludes("core/dom/Document.h"); 4272 AddToImplIncludes("core/dom/Document.h");
4281 AddToImplIncludes("platform/TraceEvent.h"); 4273 AddToImplIncludes("platform/TraceEvent.h");
4274 AddToImplIncludes("wtf/GetPtr.h");
4275 AddToImplIncludes("wtf/RefPtr.h");
4282 4276
4283 AddIncludesForType($interfaceName); 4277 AddIncludesForType($interfaceName);
4284 if ($interface->extendedAttributes->{"CheckSecurity"}) { 4278 if ($interface->extendedAttributes->{"CheckSecurity"}) {
4285 AddToImplIncludes("bindings/v8/BindingSecurity.h"); 4279 AddToImplIncludes("bindings/v8/BindingSecurity.h");
4286 } 4280 }
4287 4281
4288 my $toActiveDOMObject = InheritsExtendedAttribute($interface, "ActiveDOMObje ct") ? "${v8ClassName}::toActiveDOMObject" : "0"; 4282 my $toActiveDOMObject = InheritsExtendedAttribute($interface, "ActiveDOMObje ct") ? "${v8ClassName}::toActiveDOMObject" : "0";
4289 my $toEventTarget = InheritsInterface($interface, "EventTarget") ? "${v8Clas sName}::toEventTarget" : "0"; 4283 my $toEventTarget = InheritsInterface($interface, "EventTarget") ? "${v8Clas sName}::toEventTarget" : "0";
4290 my $visitDOMWrapper = NeedsVisitDOMWrapper($interface) ? "${v8ClassName}::vi sitDOMWrapper" : "0"; 4284 my $visitDOMWrapper = NeedsVisitDOMWrapper($interface) ? "${v8ClassName}::vi sitDOMWrapper" : "0";
4291 4285
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
4954 sub GenerateCallbackImplementation 4948 sub GenerateCallbackImplementation
4955 { 4949 {
4956 my $object = shift; 4950 my $object = shift;
4957 my $interface = shift; 4951 my $interface = shift;
4958 my $v8ClassName = GetV8ClassName($interface); 4952 my $v8ClassName = GetV8ClassName($interface);
4959 4953
4960 AddToImplIncludes("core/dom/ExecutionContext.h"); 4954 AddToImplIncludes("core/dom/ExecutionContext.h");
4961 AddToImplIncludes("bindings/v8/V8Binding.h"); 4955 AddToImplIncludes("bindings/v8/V8Binding.h");
4962 AddToImplIncludes("bindings/v8/V8Callback.h"); 4956 AddToImplIncludes("bindings/v8/V8Callback.h");
4963 AddToImplIncludes("wtf/Assertions.h"); 4957 AddToImplIncludes("wtf/Assertions.h");
4958 AddToImplIncludes("wtf/GetPtr.h");
4959 AddToImplIncludes("wtf/RefPtr.h");
4964 4960
4965 $implementation{nameSpaceWebCore}->add(<<END); 4961 $implementation{nameSpaceWebCore}->add(<<END);
4966 ${v8ClassName}::${v8ClassName}(v8::Handle<v8::Function> callback, ExecutionConte xt* context) 4962 ${v8ClassName}::${v8ClassName}(v8::Handle<v8::Function> callback, ExecutionConte xt* context)
4967 : ActiveDOMCallback(context) 4963 : ActiveDOMCallback(context)
4968 , m_isolate(toIsolate(context)) 4964 , m_isolate(toIsolate(context))
4969 , m_callback(m_isolate, callback) 4965 , m_callback(m_isolate, callback)
4970 , m_world(DOMWrapperWorld::current(m_isolate)) 4966 , m_world(DOMWrapperWorld::current(m_isolate))
4971 { 4967 {
4972 } 4968 }
4973 4969
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
5796 } 5792 }
5797 5793
5798 AddIncludesForType($type); 5794 AddIncludesForType($type);
5799 5795
5800 if ($type eq "SerializedScriptValue") { 5796 if ($type eq "SerializedScriptValue") {
5801 my $returnValue = "$nativeValue ? $nativeValue->deserialize() : v8::Hand le<v8::Value>(v8::Null($getIsolate))"; 5797 my $returnValue = "$nativeValue ? $nativeValue->deserialize() : v8::Hand le<v8::Value>(v8::Null($getIsolate))";
5802 return "${indent}v8SetReturnValue(${getCallbackInfo}, $returnValue);" if $isReturnValue; 5798 return "${indent}v8SetReturnValue(${getCallbackInfo}, $returnValue);" if $isReturnValue;
5803 return "$indent$receiver $returnValue;"; 5799 return "$indent$receiver $returnValue;";
5804 } 5800 }
5805 5801
5806 AddToImplIncludes("wtf/RefPtr.h");
5807 AddToImplIncludes("wtf/GetPtr.h");
5808
5809 if ($getScriptWrappable) { 5802 if ($getScriptWrappable) {
5810 # FIXME: Use safe handles 5803 # FIXME: Use safe handles
5811 if ($isReturnValue) { 5804 if ($isReturnValue) {
5812 if ($forMainWorldSuffix eq "ForMainWorld") { 5805 if ($forMainWorldSuffix eq "ForMainWorld") {
5813 return "${indent}v8SetReturnValueForMainWorld(${getCallbackInfo} , $nativeValue);"; 5806 return "${indent}v8SetReturnValueForMainWorld(${getCallbackInfo} , $nativeValue);";
5814 } 5807 }
5815 return "${indent}v8SetReturnValueFast(${getCallbackInfo}, $nativeVal ue, $getScriptWrappable);"; 5808 return "${indent}v8SetReturnValueFast(${getCallbackInfo}, $nativeVal ue, $getScriptWrappable);";
5816 } 5809 }
5817 } 5810 }
5818 # FIXME: Use safe handles 5811 # FIXME: Use safe handles
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
6423 if ($parameter->type eq "SerializedScriptValue") { 6416 if ($parameter->type eq "SerializedScriptValue") {
6424 return 1; 6417 return 1;
6425 } elsif (IsIntegerType($parameter->type)) { 6418 } elsif (IsIntegerType($parameter->type)) {
6426 return 1; 6419 return 1;
6427 } 6420 }
6428 } 6421 }
6429 return 0; 6422 return 0;
6430 } 6423 }
6431 6424
6432 1; 6425 1;
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/scripts/unstable/v8_callback_interface.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698