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

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

Issue 26592006: Avoid useless call to RefPtr::get() in the generated bindings code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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/tests/results/V8Float64Array.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 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 } 1539 }
1540 1540
1541 AddIncludesForType($returnType); 1541 AddIncludesForType($returnType);
1542 AddToImplIncludes("bindings/v8/V8HiddenPropertyName.h"); 1542 AddToImplIncludes("bindings/v8/V8HiddenPropertyName.h");
1543 # Check for a wrapper in the wrapper cache. If there is one, we know tha t a hidden reference has already 1543 # Check for a wrapper in the wrapper cache. If there is one, we know tha t a hidden reference has already
1544 # been created. If we don't find a wrapper, we create both a wrapper and a hidden reference. 1544 # been created. If we don't find a wrapper, we create both a wrapper and a hidden reference.
1545 my $nativeReturnType = GetNativeType($returnType); 1545 my $nativeReturnType = GetNativeType($returnType);
1546 my $v8ReturnType = "V8" . $returnType; 1546 my $v8ReturnType = "V8" . $returnType;
1547 $code .= " $nativeReturnType result = ${getterString};\n"; 1547 $code .= " $nativeReturnType result = ${getterString};\n";
1548 if ($forMainWorldSuffix) { 1548 if ($forMainWorldSuffix) {
1549 $code .= " if (result.get() && DOMDataStore::setReturnValueFromWr apper${forMainWorldSuffix}<${v8ReturnType}>(info.GetReturnValue(), result.get()) )\n"; 1549 $code .= " if (result && DOMDataStore::setReturnValueFromWrapper$ {forMainWorldSuffix}<${v8ReturnType}>(info.GetReturnValue(), result.get()))\n";
1550 } else { 1550 } else {
1551 $code .= " if (result.get() && DOMDataStore::setReturnValueFromWr apper<${v8ReturnType}>(info.GetReturnValue(), result.get()))\n"; 1551 $code .= " if (result && DOMDataStore::setReturnValueFromWrapper< ${v8ReturnType}>(info.GetReturnValue(), result.get()))\n";
1552 } 1552 }
1553 $code .= " return;\n"; 1553 $code .= " return;\n";
1554 $code .= " v8::Handle<v8::Value> wrapper = toV8(result.get(), info.Ho lder(), info.GetIsolate());\n"; 1554 $code .= " v8::Handle<v8::Value> wrapper = toV8(result.get(), info.Ho lder(), info.GetIsolate());\n";
1555 $code .= " if (!wrapper.IsEmpty()) {\n"; 1555 $code .= " if (!wrapper.IsEmpty()) {\n";
1556 $code .= " V8HiddenPropertyName::setNamedHiddenReference(info.Hol der(), \"${attrName}\", wrapper);\n"; 1556 $code .= " V8HiddenPropertyName::setNamedHiddenReference(info.Hol der(), \"${attrName}\", wrapper);\n";
1557 $code .= " v8SetReturnValue(info, wrapper);\n"; 1557 $code .= " v8SetReturnValue(info, wrapper);\n";
1558 $code .= " }\n"; 1558 $code .= " }\n";
1559 $code .= "}\n"; 1559 $code .= "}\n";
1560 $code .= "#endif // ${conditionalString}\n" if $conditionalString; 1560 $code .= "#endif // ${conditionalString}\n" if $conditionalString;
1561 $code .= "\n"; 1561 $code .= "\n";
(...skipping 3303 matching lines...) Expand 10 before | Expand all | Expand 10 after
4865 || InheritsExtendedAttribute($interface, "GenerateIsReachable") 4865 || InheritsExtendedAttribute($interface, "GenerateIsReachable")
4866 || InheritsExtendedAttribute($interface, "CustomIsReachable") 4866 || InheritsExtendedAttribute($interface, "CustomIsReachable")
4867 || $v8ClassName =~ /SVG/) { 4867 || $v8ClassName =~ /SVG/) {
4868 $wrapperConfiguration = "WrapperConfiguration::Dependent"; 4868 $wrapperConfiguration = "WrapperConfiguration::Dependent";
4869 } 4869 }
4870 4870
4871 my $code = ""; 4871 my $code = "";
4872 $code .= <<END; 4872 $code .= <<END;
4873 v8::Handle<v8::Object> ${v8ClassName}::createWrapper(${createWrapperArgumentType } impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 4873 v8::Handle<v8::Object> ${v8ClassName}::createWrapper(${createWrapperArgumentType } impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
4874 { 4874 {
4875 ASSERT(impl.get()); 4875 ASSERT(impl);
4876 ASSERT(!DOMDataStore::containsWrapper<${v8ClassName}>(impl.get(), isolate)); 4876 ASSERT(!DOMDataStore::containsWrapper<${v8ClassName}>(impl.get(), isolate));
4877 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 4877 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
4878 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get()); 4878 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get());
4879 // Might be a XXXConstructor::info instead of an XXX::info. These will b oth have 4879 // Might be a XXXConstructor::info instead of an XXX::info. These will b oth have
4880 // the same object de-ref functions, though, so use that as the basis of the check. 4880 // the same object de-ref functions, though, so use that as the basis of the check.
4881 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == info.derefObjectFunction); 4881 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == info.derefObjectFunction);
4882 } 4882 }
4883 4883
4884 END 4884 END
4885 4885
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after
6167 my $interface = shift; 6167 my $interface = shift;
6168 6168
6169 return 1 if $interface->extendedAttributes->{"CustomToV8"}; 6169 return 1 if $interface->extendedAttributes->{"CustomToV8"};
6170 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; 6170 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"};
6171 return 1 if InheritsInterface($interface, "Document"); 6171 return 1 if InheritsInterface($interface, "Document");
6172 6172
6173 return 0; 6173 return 0;
6174 } 6174 }
6175 6175
6176 1; 6176 1;
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/tests/results/V8Float64Array.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698