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

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

Issue 12377018: Revert 144157 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1425/
Patch Set: Created 7 years, 9 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 | Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp » ('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 2129 matching lines...) Expand 10 before | Expand all | Expand 10 after
2140 $raisesExceptions = 1; 2140 $raisesExceptions = 1;
2141 } 2141 }
2142 if (!$raisesExceptions) { 2142 if (!$raisesExceptions) {
2143 foreach my $parameter (@{$function->parameters}) { 2143 foreach my $parameter (@{$function->parameters}) {
2144 if ((!$parameter->extendedAttributes->{"Callback"} and TypeCanFailCo nversion($parameter)) or $parameter->extendedAttributes->{"IsIndex"}) { 2144 if ((!$parameter->extendedAttributes->{"Callback"} and TypeCanFailCo nversion($parameter)) or $parameter->extendedAttributes->{"IsIndex"}) {
2145 $raisesExceptions = 1; 2145 $raisesExceptions = 1;
2146 } 2146 }
2147 } 2147 }
2148 } 2148 }
2149 2149
2150 my $maybeObserveFeature = GenerateFeatureObservation($function->signature->e xtendedAttributes->{"V8MeasureAs"});
2151
2150 my @beforeArgumentList; 2152 my @beforeArgumentList;
2151 my @afterArgumentList; 2153 my @afterArgumentList;
2154
2152 my $toActiveDOMObject = "0"; 2155 my $toActiveDOMObject = "0";
2153 if ($codeGenerator->InheritsExtendedAttribute($interface, "ActiveDOMObject") ) { 2156 if ($codeGenerator->InheritsExtendedAttribute($interface, "ActiveDOMObject") ) {
2154 $toActiveDOMObject = "${v8InterfaceName}::toActiveDOMObject"; 2157 $toActiveDOMObject = "${v8InterfaceName}::toActiveDOMObject";
2155 } 2158 }
2156 2159
2157 my $toEventTarget = "0"; 2160 my $toEventTarget = "0";
2158 if ($codeGenerator->InheritsExtendedAttribute($interface, "EventTarget")) { 2161 if ($codeGenerator->InheritsExtendedAttribute($interface, "EventTarget")) {
2159 $toEventTarget = "${v8InterfaceName}::toEventTarget"; 2162 $toEventTarget = "${v8InterfaceName}::toEventTarget";
2160 } 2163 }
2161 2164
2162 AddToImplIncludes("Frame.h"); 2165 AddToImplIncludes("Frame.h");
2163 push(@implContent, <<END); 2166 push(@implContent, <<END);
2164 WrapperTypeInfo ${v8InterfaceName}Constructor::info = { ${v8InterfaceName}Constr uctor::GetTemplate, ${v8InterfaceName}::derefObject, $toActiveDOMObject, $toEven tTarget, 0, ${v8InterfaceName}::installPerContextPrototypeProperties, 0, Wrapper TypeObjectPrototype }; 2167 WrapperTypeInfo ${v8InterfaceName}Constructor::info = { ${v8InterfaceName}Constr uctor::GetTemplate, ${v8InterfaceName}::derefObject, $toActiveDOMObject, $toEven tTarget, 0, ${v8InterfaceName}::installPerContextPrototypeProperties, 0, Wrapper TypeObjectPrototype };
2165 2168
2166 static v8::Handle<v8::Value> namedConstructor(const v8::Arguments& args) 2169 static v8::Handle<v8::Value> ${v8InterfaceName}ConstructorCallback(const v8::Arg uments& args)
2167 { 2170 {
2171 ${maybeObserveFeature}
2168 END 2172 END
2169 push(@implContent, GenerateFeatureObservation($function->signature->extended Attributes->{"V8MeasureAs"}));
2170 push(@implContent, GenerateConstructorHeader()); 2173 push(@implContent, GenerateConstructorHeader());
2171 push(@implContent, <<END); 2174 push(@implContent, <<END);
2172 Document* document = currentDocument(BindingState::instance()); 2175 Document* document = currentDocument(BindingState::instance());
2173 2176
2174 // Make sure the document is added to the DOM Node map. Otherwise, the ${int erfaceName} instance 2177 // Make sure the document is added to the DOM Node map. Otherwise, the ${int erfaceName} instance
2175 // may end up being the only node in the map and get garbage-collected prema turely. 2178 // may end up being the only node in the map and get garbage-collected prema turely.
2176 toV8(document, args.Holder(), args.GetIsolate()); 2179 toV8(document, args.Holder(), args.GetIsolate());
2177 2180
2178 END 2181 END
2179 2182
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2214 if ($interface->extendedAttributes->{"ConstructorRaisesException"}) { 2217 if ($interface->extendedAttributes->{"ConstructorRaisesException"}) {
2215 push(@implContent, " if (ec)\n"); 2218 push(@implContent, " if (ec)\n");
2216 push(@implContent, " goto fail;\n"); 2219 push(@implContent, " goto fail;\n");
2217 } 2220 }
2218 2221
2219 push(@implContent, <<END); 2222 push(@implContent, <<END);
2220 2223
2221 V8DOMWrapper::associateObjectWithWrapper(impl.release(), &${v8InterfaceName} Constructor::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent); 2224 V8DOMWrapper::associateObjectWithWrapper(impl.release(), &${v8InterfaceName} Constructor::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
2222 return wrapper; 2225 return wrapper;
2223 END 2226 END
2227
2224 if ($raisesExceptions) { 2228 if ($raisesExceptions) {
2225 push(@implContent, " fail:\n"); 2229 push(@implContent, " fail:\n");
2226 push(@implContent, " return setDOMException(ec, args.GetIsolate());\n "); 2230 push(@implContent, " return setDOMException(ec, args.GetIsolate());\n ");
2227 } 2231 }
2232
2233 push(@implContent, "}\n");
2234
2228 push(@implContent, <<END); 2235 push(@implContent, <<END);
2229 }
2230
2231 static v8::Handle<v8::Value> namedConstructorCallback(const v8::Arguments& args)
2232 {
2233 return namedConstructor(args);
2234 }
2235 2236
2236 v8::Persistent<v8::FunctionTemplate> ${v8InterfaceName}Constructor::GetTemplate( v8::Isolate* isolate) 2237 v8::Persistent<v8::FunctionTemplate> ${v8InterfaceName}Constructor::GetTemplate( v8::Isolate* isolate)
2237 { 2238 {
2238 static v8::Persistent<v8::FunctionTemplate> cachedTemplate; 2239 static v8::Persistent<v8::FunctionTemplate> cachedTemplate;
2239 if (!cachedTemplate.IsEmpty()) 2240 if (!cachedTemplate.IsEmpty())
2240 return cachedTemplate; 2241 return cachedTemplate;
2241 2242
2242 v8::HandleScope scope; 2243 v8::HandleScope scope;
2243 v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(namedCons tructorCallback); 2244 v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(${v8Inter faceName}ConstructorCallback);
2244 2245
2245 v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate(); 2246 v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
2246 instance->SetInternalFieldCount(${v8InterfaceName}::internalFieldCount); 2247 instance->SetInternalFieldCount(${v8InterfaceName}::internalFieldCount);
2247 result->SetClassName(v8::String::NewSymbol("${interfaceName}")); 2248 result->SetClassName(v8::String::NewSymbol("${interfaceName}"));
2248 result->Inherit(${v8InterfaceName}::GetTemplate(isolate)); 2249 result->Inherit(${v8InterfaceName}::GetTemplate(isolate));
2249 2250
2250 cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(isolate, result); 2251 cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(isolate, result);
2251 return cachedTemplate; 2252 return cachedTemplate;
2252 } 2253 }
2253 2254
(...skipping 2148 matching lines...) Expand 10 before | Expand all | Expand 10 after
4402 4403
4403 sub GetPassRefPtrType 4404 sub GetPassRefPtrType
4404 { 4405 {
4405 my $v8InterfaceName = shift; 4406 my $v8InterfaceName = shift;
4406 4407
4407 my $angleBracketSpace = $v8InterfaceName =~ />$/ ? " " : ""; 4408 my $angleBracketSpace = $v8InterfaceName =~ />$/ ? " " : "";
4408 return "PassRefPtr<${v8InterfaceName}${angleBracketSpace}>"; 4409 return "PassRefPtr<${v8InterfaceName}${angleBracketSpace}>";
4409 } 4410 }
4410 4411
4411 1; 4412 1;
OLDNEW
« no previous file with comments | « no previous file | Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698