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

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

Issue 9939001: Merge 111813 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1025/
Patch Set: Created 8 years, 8 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
« no previous file with comments | « no previous file | no next file » | 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 Google Inc. 6 # Copyright (C) 2007, 2008, 2009 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 # 10 #
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 GenerateHeaderCustomCall($dataNode); 427 GenerateHeaderCustomCall($dataNode);
428 GenerateHeaderCustomInternalFieldIndices($dataNode); 428 GenerateHeaderCustomInternalFieldIndices($dataNode);
429 429
430 if ($dataNode->extendedAttributes->{"CheckDomainSecurity"}) { 430 if ($dataNode->extendedAttributes->{"CheckDomainSecurity"}) {
431 push(@headerContent, <<END); 431 push(@headerContent, <<END);
432 static bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Val ue> key, v8::AccessType, v8::Local<v8::Value> data); 432 static bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Val ue> key, v8::AccessType, v8::Local<v8::Value> data);
433 static bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::AccessType, v8::Local<v8::Value> data); 433 static bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::AccessType, v8::Local<v8::Value> data);
434 END 434 END
435 } 435 }
436 436
437 my $wrapSlowArgumentType = GetPassRefPtrType($nativeType);
437 push(@headerContent, <<END); 438 push(@headerContent, <<END);
438 static v8::Handle<v8::Object> existingWrapper(${nativeType}*); 439 static v8::Handle<v8::Object> existingWrapper(${nativeType}*);
439 440
440 private: 441 private:
441 static v8::Handle<v8::Object> wrapSlow(${nativeType}*); 442 static v8::Handle<v8::Object> wrapSlow(${wrapSlowArgumentType});
442 }; 443 };
443 444
444 END 445 END
445 446
446 push(@headerContent, <<END); 447 push(@headerContent, <<END);
447 ALWAYS_INLINE v8::Handle<v8::Object> ${className}::existingWrapper(${nativeType} * impl) 448 ALWAYS_INLINE v8::Handle<v8::Object> ${className}::existingWrapper(${nativeType} * impl)
448 { 449 {
449 END 450 END
450 my $getWrapper = IsNodeSubType($dataNode) ? "V8DOMWrapper::getWrapper(impl)" : "${domMapFunction}.get(impl)"; 451 my $getWrapper = IsNodeSubType($dataNode) ? "V8DOMWrapper::getWrapper(impl)" : "${domMapFunction}.get(impl)";
451 push(@headerContent, <<END); 452 push(@headerContent, <<END);
(...skipping 2582 matching lines...) Expand 10 before | Expand all | Expand 10 after
3034 { 3035 {
3035 my $dataNode = shift; 3036 my $dataNode = shift;
3036 my $interfaceName = shift; 3037 my $interfaceName = shift;
3037 my $className = shift; 3038 my $className = shift;
3038 my $nativeType = shift; 3039 my $nativeType = shift;
3039 my $serializedAttribute = shift; 3040 my $serializedAttribute = shift;
3040 3041
3041 my $domMapFunction = GetDomMapFunction($dataNode, $interfaceName); 3042 my $domMapFunction = GetDomMapFunction($dataNode, $interfaceName);
3042 my $forceNewObjectInput = IsDOMNodeType($interfaceName) ? ", bool forceNewOb ject" : ""; 3043 my $forceNewObjectInput = IsDOMNodeType($interfaceName) ? ", bool forceNewOb ject" : "";
3043 my $forceNewObjectCall = IsDOMNodeType($interfaceName) ? ", forceNewObject" : ""; 3044 my $forceNewObjectCall = IsDOMNodeType($interfaceName) ? ", forceNewObject" : "";
3045 my $wrapSlowArgumentType = GetPassRefPtrType($nativeType);
3044 3046
3045 push(@implContent, <<END); 3047 push(@implContent, <<END);
3046 3048
3047 v8::Handle<v8::Object> ${className}::wrapSlow(${nativeType}* impl) 3049 v8::Handle<v8::Object> ${className}::wrapSlow(${wrapSlowArgumentType} impl)
3048 { 3050 {
3049 v8::Handle<v8::Object> wrapper; 3051 v8::Handle<v8::Object> wrapper;
3050 V8Proxy* proxy = 0; 3052 V8Proxy* proxy = 0;
3051 END 3053 END
3052 3054
3053 if (IsNodeSubType($dataNode)) { 3055 if (IsNodeSubType($dataNode)) {
3054 push(@implContent, <<END); 3056 push(@implContent, <<END);
3055 if (impl->document()) { 3057 if (impl->document()) {
3056 proxy = V8Proxy::retrieve(impl->document()->frame()); 3058 proxy = V8Proxy::retrieve(impl->document()->frame());
3057 if (proxy && static_cast<Node*>(impl->document()) == static_cast<Node*>( impl)) { 3059 if (proxy && static_cast<Node*>(impl->document()) == static_cast<Node*>( impl.get())) {
3058 if (proxy->windowShell()->context().IsEmpty() && proxy->windowShell( )->initContextIfNeeded()) { 3060 if (proxy->windowShell()->context().IsEmpty() && proxy->windowShell( )->initContextIfNeeded()) {
3059 // initContextIfNeeded may have created a wrapper for the object , retry from the start. 3061 // initContextIfNeeded may have created a wrapper for the object , retry from the start.
3060 return ${className}::wrap(impl); 3062 return ${className}::wrap(impl.get());
3061 } 3063 }
3062 } 3064 }
3063 } 3065 }
3064 3066
3065 END 3067 END
3066 } 3068 }
3067 3069
3068 # FIXME: We need a better way of recovering the correct prototype chain 3070 # FIXME: We need a better way of recovering the correct prototype chain
3069 # for every sort of object. For now, we special-case cross-origin visible 3071 # for every sort of object. For now, we special-case cross-origin visible
3070 # objects (i.e., those with CheckDomainSecurity). 3072 # objects (i.e., those with CheckDomainSecurity).
(...skipping 14 matching lines...) Expand all
3085 if (proxy) 3087 if (proxy)
3086 context = proxy->context(); 3088 context = proxy->context();
3087 3089
3088 // Enter the node's context and create the wrapper in that context. 3090 // Enter the node's context and create the wrapper in that context.
3089 if (!context.IsEmpty()) 3091 if (!context.IsEmpty())
3090 context->Enter(); 3092 context->Enter();
3091 END 3093 END
3092 } 3094 }
3093 3095
3094 push(@implContent, <<END); 3096 push(@implContent, <<END);
3095 wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl); 3097 wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl.get());
3096 END 3098 END
3097 if (IsNodeSubType($dataNode) || IsVisibleAcrossOrigins($dataNode)) { 3099 if (IsNodeSubType($dataNode) || IsVisibleAcrossOrigins($dataNode)) {
3098 push(@implContent, <<END); 3100 push(@implContent, <<END);
3099 // Exit the node's context if it was entered. 3101 // Exit the node's context if it was entered.
3100 if (!context.IsEmpty()) 3102 if (!context.IsEmpty())
3101 context->Exit(); 3103 context->Exit();
3102 END 3104 END
3103 } 3105 }
3104 3106
3105 push(@implContent, <<END); 3107 push(@implContent, <<END);
3106 if (wrapper.IsEmpty()) 3108 if (wrapper.IsEmpty())
3107 return wrapper; 3109 return wrapper;
3108 END 3110 END
3109 push(@implContent, "\n impl->ref();\n") if IsRefPtrType($interfaceName);
3110
3111 if ($serializedAttribute) { 3111 if ($serializedAttribute) {
3112 GenerateEagerDeserialization($serializedAttribute); 3112 GenerateEagerDeserialization($serializedAttribute);
3113 } 3113 }
3114 3114
3115 push(@implContent, <<END); 3115 push(@implContent, <<END);
3116 v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(w rapper); 3116 v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(w rapper);
3117 3117
3118 if (!hasDependentLifetime) 3118 if (!hasDependentLifetime)
3119 wrapperHandle.MarkIndependent(); 3119 wrapperHandle.MarkIndependent();
3120 END 3120 END
3121 if (IsNodeSubType($dataNode)) { 3121 if (IsNodeSubType($dataNode)) {
3122 push(@implContent, <<END); 3122 push(@implContent, <<END);
3123 wrapperHandle.SetWrapperClassId(v8DOMSubtreeClassId); 3123 wrapperHandle.SetWrapperClassId(v8DOMSubtreeClassId);
3124 END 3124 END
3125 } 3125 }
3126 push(@implContent, <<END); 3126 push(@implContent, <<END);
3127 ${domMapFunction}.set(impl, wrapperHandle); 3127 ${domMapFunction}.set(impl.leakRef(), wrapperHandle);
3128 END
3129
3130 push(@implContent, <<END);
3131 return wrapper; 3128 return wrapper;
3132 } 3129 }
3133 END 3130 END
3134 } 3131 }
3135 3132
3136 sub HasCustomToV8Implementation { 3133 sub HasCustomToV8Implementation {
3137 # FIXME: This subroutine is lame. Probably should be an .idl attribute (Cust omToV8)? 3134 # FIXME: This subroutine is lame. Probably should be an .idl attribute (Cust omToV8)?
3138 my $dataNode = shift; 3135 my $dataNode = shift;
3139 my $interfaceName = shift; 3136 my $interfaceName = shift;
3140 3137
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
3891 { 3888 {
3892 my $signature = shift; 3889 my $signature = shift;
3893 3890
3894 # If a parameter is given (e.g. "EnabledAtRuntime=FeatureName") return the R untimeEnabledFeatures::{FeatureName}Enabled() method. 3891 # If a parameter is given (e.g. "EnabledAtRuntime=FeatureName") return the R untimeEnabledFeatures::{FeatureName}Enabled() method.
3895 return "RuntimeEnabledFeatures::" . $codeGenerator->WK_lcfirst($signature->e xtendedAttributes->{"EnabledAtRuntime"}) . "Enabled" if ($signature->extendedAtt ributes->{"EnabledAtRuntime"} && $signature->extendedAttributes->{"EnabledAtRunt ime"} ne "1"); 3892 return "RuntimeEnabledFeatures::" . $codeGenerator->WK_lcfirst($signature->e xtendedAttributes->{"EnabledAtRuntime"}) . "Enabled" if ($signature->extendedAtt ributes->{"EnabledAtRuntime"} && $signature->extendedAttributes->{"EnabledAtRunt ime"} ne "1");
3896 3893
3897 # Otherwise return a function named RuntimeEnabledFeatures::{methodName}Enab led(). 3894 # Otherwise return a function named RuntimeEnabledFeatures::{methodName}Enab led().
3898 return "RuntimeEnabledFeatures::" . $codeGenerator->WK_lcfirst($signature->n ame) . "Enabled"; 3895 return "RuntimeEnabledFeatures::" . $codeGenerator->WK_lcfirst($signature->n ame) . "Enabled";
3899 } 3896 }
3900 3897
3898 sub GetPassRefPtrType
3899 {
3900 my $className = shift;
3901
3902 my $angleBracketSpace = $className =~ />$/ ? " " : "";
3903 return "PassRefPtr<${className}${angleBracketSpace}>";
3904 }
3905
3901 sub DebugPrint 3906 sub DebugPrint
3902 { 3907 {
3903 my $output = shift; 3908 my $output = shift;
3904 3909
3905 print $output; 3910 print $output;
3906 print "\n"; 3911 print "\n";
3907 } 3912 }
3908 3913
3909 1; 3914 1;
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698