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

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

Issue 116983005: Use v8AtomicString instead of v8::String::NewFromUtf8 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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
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 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 return; 1241 return;
1242 } 1242 }
1243 ${implClassName}* imp = ${v8ClassName}::toNative(holder); 1243 ${implClassName}* imp = ${v8ClassName}::toNative(holder);
1244 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) { 1244 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) {
1245 static int sharedTemplateUniqueKey; 1245 static int sharedTemplateUniqueKey;
1246 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, $newTemplateParams, $functionLength) ; 1246 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, $newTemplateParams, $functionLength) ;
1247 v8SetReturnValue(info, sharedTemplate->GetFunction()); 1247 v8SetReturnValue(info, sharedTemplate->GetFunction());
1248 return; 1248 return;
1249 } 1249 }
1250 1250
1251 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N ewFromUtf8(info.GetIsolate(), "${funcName}", v8::String::kInternalizedString)); 1251 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8AtomicStrin g(info.GetIsolate(), "${funcName}"));
1252 if (!hiddenValue.IsEmpty()) { 1252 if (!hiddenValue.IsEmpty()) {
1253 v8SetReturnValue(info, hiddenValue); 1253 v8SetReturnValue(info, hiddenValue);
1254 return; 1254 return;
1255 } 1255 }
1256 1256
1257 v8SetReturnValue(info, privateTemplate->GetFunction()); 1257 v8SetReturnValue(info, privateTemplate->GetFunction());
1258 } 1258 }
1259 1259
1260 END 1260 END
1261 $implementation{nameSpaceInternal}->add(<<END); 1261 $implementation{nameSpaceInternal}->add(<<END);
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1510 $code .= "#endif // ${conditionalString}\n" if $conditionalString; 1510 $code .= "#endif // ${conditionalString}\n" if $conditionalString;
1511 $code .= "\n"; 1511 $code .= "\n";
1512 $implementation{nameSpaceInternal}->add($code); 1512 $implementation{nameSpaceInternal}->add($code);
1513 return; 1513 return;
1514 # Skip the rest of the function! 1514 # Skip the rest of the function!
1515 } 1515 }
1516 my $imp = 0; 1516 my $imp = 0;
1517 if ($attrCached) { 1517 if ($attrCached) {
1518 $imp = 1; 1518 $imp = 1;
1519 $code .= <<END; 1519 $code .= <<END;
1520 v8::Handle<v8::String> propertyName = v8::String::NewFromUtf8(info.GetIsolat e(), "${attrName}", v8::String::kInternalizedString); 1520 v8::Handle<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "${a ttrName}");
1521 ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()); 1521 ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder());
1522 if (!imp->$attrCached()) { 1522 if (!imp->$attrCached()) {
1523 v8::Handle<v8::Value> jsValue = info.Holder()->GetHiddenValue(propertyNa me); 1523 v8::Handle<v8::Value> jsValue = info.Holder()->GetHiddenValue(propertyNa me);
1524 if (!jsValue.IsEmpty()) { 1524 if (!jsValue.IsEmpty()) {
1525 v8SetReturnValue(info, jsValue); 1525 v8SetReturnValue(info, jsValue);
1526 return; 1526 return;
1527 } 1527 }
1528 } 1528 }
1529 END 1529 END
1530 } 1530 }
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
2130 if ($useExceptions) { 2130 if ($useExceptions) {
2131 $code .= " if (!exceptionState.hadException())\n"; 2131 $code .= " if (!exceptionState.hadException())\n";
2132 $code .= " wrapper->commitChange();\n"; 2132 $code .= " wrapper->commitChange();\n";
2133 } else { 2133 } else {
2134 $code .= " wrapper->commitChange();\n"; 2134 $code .= " wrapper->commitChange();\n";
2135 } 2135 }
2136 } 2136 }
2137 2137
2138 if ($attrCached) { 2138 if ($attrCached) {
2139 $code .= <<END; 2139 $code .= <<END;
2140 info.Holder()->DeleteHiddenValue(v8::String::NewFromUtf8(info.GetIsolate(), "${attrName}", v8::String::kInternalizedString)); // Invalidate the cached value . 2140 info.Holder()->DeleteHiddenValue(v8AtomicString(info.GetIsolate(), "${attrNa me}")); // Invalidate the cached value.
2141 END 2141 END
2142 } 2142 }
2143 2143
2144 $code .= "}\n"; # end of setter 2144 $code .= "}\n"; # end of setter
2145 $code .= "#endif // ${conditionalString}\n" if $conditionalString; 2145 $code .= "#endif // ${conditionalString}\n" if $conditionalString;
2146 $code .= "\n"; 2146 $code .= "\n";
2147 $implementation{nameSpaceInternal}->add($code); 2147 $implementation{nameSpaceInternal}->add($code);
2148 } 2148 }
2149 2149
2150 sub GenerateParametersCheckExpression 2150 sub GenerateParametersCheckExpression
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
3168 v8::Local<v8::FunctionTemplate> result = data->privateTemplateIfExists(curre ntWorldType, &privateTemplateUniqueKey); 3168 v8::Local<v8::FunctionTemplate> result = data->privateTemplateIfExists(curre ntWorldType, &privateTemplateUniqueKey);
3169 if (!result.IsEmpty()) 3169 if (!result.IsEmpty())
3170 return result; 3170 return result;
3171 3171
3172 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 3172 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
3173 v8::EscapableHandleScope scope(isolate); 3173 v8::EscapableHandleScope scope(isolate);
3174 result = v8::FunctionTemplate::New(isolate, ${v8ClassName}ConstructorCallbac k); 3174 result = v8::FunctionTemplate::New(isolate, ${v8ClassName}ConstructorCallbac k);
3175 3175
3176 v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate(); 3176 v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate();
3177 instanceTemplate->SetInternalFieldCount(${v8ClassName}::internalFieldCount); 3177 instanceTemplate->SetInternalFieldCount(${v8ClassName}::internalFieldCount);
3178 result->SetClassName(v8::String::NewFromUtf8(isolate, "${implClassName}", v8 ::String::kInternalizedString)); 3178 result->SetClassName(v8AtomicString(isolate, "${implClassName}"));
3179 result->Inherit(${v8ClassName}::domTemplate(isolate, currentWorldType)); 3179 result->Inherit(${v8ClassName}::domTemplate(isolate, currentWorldType));
3180 data->setPrivateTemplate(currentWorldType, &privateTemplateUniqueKey, result ); 3180 data->setPrivateTemplate(currentWorldType, &privateTemplateUniqueKey, result );
3181 3181
3182 return scope.Escape(result); 3182 return scope.Escape(result);
3183 } 3183 }
3184 3184
3185 END 3185 END
3186 $implementation{nameSpaceWebCore}->add($code); 3186 $implementation{nameSpaceWebCore}->add($code);
3187 } 3187 }
3188 3188
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
3353 my $attrExt = $attribute->extendedAttributes; 3353 my $attrExt = $attribute->extendedAttributes;
3354 my $code = ""; 3354 my $code = "";
3355 3355
3356 my ($attrName, $getter, $setter, $getterForMainWorld, $setterForMainWorld, $ data, $accessControl, $propAttribute, $onProto) = GenerateAttributeConfiguration Parameters($interface, $attribute); 3356 my ($attrName, $getter, $setter, $getterForMainWorld, $setterForMainWorld, $ data, $accessControl, $propAttribute, $onProto) = GenerateAttributeConfiguration Parameters($interface, $attribute);
3357 3357
3358 die "Static attributes do not support optimized getters or setters for the m ain world" if $getterForMainWorld || $setterForMainWorld; 3358 die "Static attributes do not support optimized getters or setters for the m ain world" if $getterForMainWorld || $setterForMainWorld;
3359 3359
3360 my $conditionalString = GenerateConditionalString($attribute); 3360 my $conditionalString = GenerateConditionalString($attribute);
3361 3361
3362 $code .= "#if ${conditionalString}\n" if $conditionalString; 3362 $code .= "#if ${conditionalString}\n" if $conditionalString;
3363 $code .= " functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf 8(isolate, \"$attrName\", v8::String::kInternalizedString), $getter, $setter, v8 ::External::New(isolate, $data), $propAttribute, v8::Handle<v8::AccessorSignatur e>(), $accessControl);\n"; 3363 $code .= " functionTemplate->SetNativeDataProperty(v8AtomicString(isolate , \"$attrName\"), $getter, $setter, v8::External::New(isolate, $data), $propAttr ibute, v8::Handle<v8::AccessorSignature>(), $accessControl);\n";
3364 $code .= "#endif // ${conditionalString}\n" if $conditionalString; 3364 $code .= "#endif // ${conditionalString}\n" if $conditionalString;
3365 3365
3366 return $code; 3366 return $code;
3367 } 3367 }
3368 3368
3369 sub IsStandardFunction 3369 sub IsStandardFunction
3370 { 3370 {
3371 my $interface = shift; 3371 my $interface = shift;
3372 my $function = shift; 3372 my $function = shift;
3373 3373
(...skipping 3008 matching lines...) Expand 10 before | Expand all | Expand 10 after
6382 6382
6383 foreach my $parameter (@{$function->parameters}) { 6383 foreach my $parameter (@{$function->parameters}) {
6384 if ($parameter->type eq "SerializedScriptValue") { 6384 if ($parameter->type eq "SerializedScriptValue") {
6385 return 1; 6385 return 1;
6386 } 6386 }
6387 } 6387 }
6388 return 0; 6388 return 0;
6389 } 6389 }
6390 6390
6391 1; 6391 1;
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/templates/attributes.cpp » ('j') | Source/bindings/v8/V8DOMConfiguration.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698