Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 3175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3186 | 3186 |
| 3187 my $indexedDeleterFunction = GetIndexedDeleterFunction($interface); | 3187 my $indexedDeleterFunction = GetIndexedDeleterFunction($interface); |
| 3188 my $hasCustomIndexedDeleter = $indexedDeleterFunction ? $indexedDeleterFunct ion->extendedAttributes->{"Custom"} : 0; | 3188 my $hasCustomIndexedDeleter = $indexedDeleterFunction ? $indexedDeleterFunct ion->extendedAttributes->{"Custom"} : 0; |
| 3189 if ($indexedDeleterFunction && !$hasCustomIndexedDeleter) { | 3189 if ($indexedDeleterFunction && !$hasCustomIndexedDeleter) { |
| 3190 GenerateImplementationIndexedPropertyDeleter($interface, $indexedDeleter Function); | 3190 GenerateImplementationIndexedPropertyDeleter($interface, $indexedDeleter Function); |
| 3191 } | 3191 } |
| 3192 | 3192 |
| 3193 my $indexedEnumeratorFunction = $indexedGetterFunction; | 3193 my $indexedEnumeratorFunction = $indexedGetterFunction; |
| 3194 $indexedEnumeratorFunction = 0 if $indexedGetterFunction && $indexedGetterFu nction->extendedAttributes->{"NotEnumerable"}; | 3194 $indexedEnumeratorFunction = 0 if $indexedGetterFunction && $indexedGetterFu nction->extendedAttributes->{"NotEnumerable"}; |
| 3195 | 3195 |
| 3196 # FIXME: Support generated named query bindings. | |
| 3197 my $indexedQueryFunction = 0; | 3196 my $indexedQueryFunction = 0; |
| 3198 # If there is an enumerator, there MUST be a query method to properly commun icate property attributes. | 3197 # If there is an enumerator, there MUST be a query method to properly commun icate property attributes. |
| 3199 my $hasQuery = $indexedQueryFunction || $indexedEnumeratorFunction; | 3198 my $hasQuery = $indexedQueryFunction || $indexedEnumeratorFunction; |
| 3200 | 3199 |
| 3201 my $setOn = "Instance"; | 3200 my $setOn = "Instance"; |
| 3202 | 3201 |
| 3203 # V8 has access-check callback API (see ObjectTemplate::SetAccessCheckCallba cks) and it's used on Window | 3202 # V8 has access-check callback API (see ObjectTemplate::SetAccessCheckCallba cks) and it's used on Window |
| 3204 # instead of deleters or enumerators. In addition, the getter should be set on prototype template, to | 3203 # instead of deleters or enumerators. In addition, the getter should be set on prototype template, to |
| 3205 # get implementation straight out of the Window prototype regardless of what prototype is actually set | 3204 # get implementation straight out of the Window prototype regardless of what prototype is actually set |
| 3206 # on the object. | 3205 # on the object. |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3344 } | 3343 } |
| 3345 my $hasDeleter = $namedDeleterFunction; | 3344 my $hasDeleter = $namedDeleterFunction; |
| 3346 | 3345 |
| 3347 my $namedEnumeratorFunction = $namedGetterFunction; | 3346 my $namedEnumeratorFunction = $namedGetterFunction; |
| 3348 $namedEnumeratorFunction = 0 if $namedGetterFunction && $namedGetterFunction ->extendedAttributes->{"NotEnumerable"}; | 3347 $namedEnumeratorFunction = 0 if $namedGetterFunction && $namedGetterFunction ->extendedAttributes->{"NotEnumerable"}; |
| 3349 my $hasCustomNamedEnumerator = 1 if $namedGetterFunction && $namedGetterFunc tion->extendedAttributes->{"CustomEnumerateProperty"}; | 3348 my $hasCustomNamedEnumerator = 1 if $namedGetterFunction && $namedGetterFunc tion->extendedAttributes->{"CustomEnumerateProperty"}; |
| 3350 if ($namedEnumeratorFunction && !$hasCustomNamedEnumerator) { | 3349 if ($namedEnumeratorFunction && !$hasCustomNamedEnumerator) { |
| 3351 GenerateImplementationNamedPropertyEnumerator($interface); | 3350 GenerateImplementationNamedPropertyEnumerator($interface); |
| 3352 } | 3351 } |
| 3353 | 3352 |
| 3354 # FIXME: Support generated named query bindings. | |
| 3355 my $namedQueryFunction = 0; | |
| 3356 # If there is an enumerator, there MUST be a query method to properly commun icate property attributes. | 3353 # If there is an enumerator, there MUST be a query method to properly commun icate property attributes. |
| 3357 my $hasQuery = $namedQueryFunction || $namedEnumeratorFunction; | 3354 my $hasQuery = $namedEnumeratorFunction; |
| 3355 my $hasCustomNamedQuery = $hasCustomNamedEnumerator; | |
| 3356 if ($hasQuery && !$hasCustomNamedQuery) { | |
| 3357 GenerateImplementationNamedPropertyQuery($interface); | |
| 3358 } | |
| 3358 | 3359 |
| 3359 my $subCode = ""; | 3360 my $subCode = ""; |
| 3360 if ($namedGetterFunction || $namedSetterFunction || $namedDeleterFunction || $namedEnumeratorFunction || $hasQuery) { | 3361 if ($namedGetterFunction || $namedSetterFunction || $namedDeleterFunction || $namedEnumeratorFunction || $hasQuery) { |
| 3361 my $setOn = "Instance"; | 3362 my $setOn = "Instance"; |
| 3362 | 3363 |
| 3363 # V8 has access-check callback API (see ObjectTemplate::SetAccessCheckCa llbacks) and it's used on Window | 3364 # V8 has access-check callback API (see ObjectTemplate::SetAccessCheckCa llbacks) and it's used on Window |
| 3364 # instead of deleters or enumerators. In addition, the getter should be set on prototype template, to | 3365 # instead of deleters or enumerators. In addition, the getter should be set on prototype template, to |
| 3365 # get implementation straight out of the Window prototype regardless of what prototype is actually set | 3366 # get implementation straight out of the Window prototype regardless of what prototype is actually set |
| 3366 # on the object. | 3367 # on the object. |
| 3367 if ($interfaceName eq "Window") { | 3368 if ($interfaceName eq "Window") { |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3636 } | 3637 } |
| 3637 v8::Handle<v8::Array> v8names = v8::Array::New(names.size()); | 3638 v8::Handle<v8::Array> v8names = v8::Array::New(names.size()); |
| 3638 for (size_t i = 0; i < names.size(); ++i) | 3639 for (size_t i = 0; i < names.size(); ++i) |
| 3639 v8names->Set(v8Integer(i, info.GetIsolate()), v8String(names[i], info.Ge tIsolate())); | 3640 v8names->Set(v8Integer(i, info.GetIsolate()), v8String(names[i], info.Ge tIsolate())); |
| 3640 v8SetReturnValue(info, v8names); | 3641 v8SetReturnValue(info, v8names); |
| 3641 } | 3642 } |
| 3642 | 3643 |
| 3643 END | 3644 END |
| 3644 } | 3645 } |
| 3645 | 3646 |
| 3647 sub GenerateImplementationNamedPropertyQuery | |
| 3648 { | |
| 3649 my $interface = shift; | |
| 3650 my $implClassName = GetImplName($interface); | |
| 3651 my $v8ClassName = GetV8ClassName($interface); | |
| 3652 | |
| 3653 $implementation{nameSpaceWebCore}->add(<<END); | |
| 3654 void ${v8ClassName}::namedPropertyQuery(v8::Local<v8::String> name, const v8::Pr opertyCallbackInfo<v8::Integer>& info) | |
| 3655 { | |
| 3656 ${implClassName}* collection = toNative(info.Holder()); | |
| 3657 AtomicString propertyName = toWebCoreAtomicString(name); | |
| 3658 ExceptionCode ec = 0; | |
| 3659 int returnValue = 0; | |
| 3660 bool result = collection->namedPropertyQuery(propertyName, returnValue, ec); | |
| 3661 if (ec) { | |
| 3662 setDOMException(ec, info.GetIsolate()); | |
| 3663 return; | |
| 3664 } | |
| 3665 if (!result) | |
| 3666 return; | |
| 3667 v8SetReturnValueInt(info, 0); | |
|
haraken
2013/06/17 07:41:02
0 => returnValue.
However, I might want to remove
kojih
2013/06/17 07:52:57
OK.
| |
| 3668 } | |
| 3669 | |
| 3670 END | |
| 3671 } | |
| 3672 | |
| 3646 sub GenerateImplementationLegacyCall | 3673 sub GenerateImplementationLegacyCall |
| 3647 { | 3674 { |
| 3648 my $interface = shift; | 3675 my $interface = shift; |
| 3649 my $code = ""; | 3676 my $code = ""; |
| 3650 | 3677 |
| 3651 my $v8ClassName = GetV8ClassName($interface); | 3678 my $v8ClassName = GetV8ClassName($interface); |
| 3652 | 3679 |
| 3653 if ($interface->extendedAttributes->{"CustomLegacyCall"}) { | 3680 if ($interface->extendedAttributes->{"CustomLegacyCall"}) { |
| 3654 $code .= " desc->InstanceTemplate()->SetCallAsFunctionHandler(${v8Cla ssName}::legacyCallCustom);\n"; | 3681 $code .= " desc->InstanceTemplate()->SetCallAsFunctionHandler(${v8Cla ssName}::legacyCallCustom);\n"; |
| 3655 } | 3682 } |
| (...skipping 2222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5878 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { | 5905 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { |
| 5879 $found = 1; | 5906 $found = 1; |
| 5880 } | 5907 } |
| 5881 return 1 if $found; | 5908 return 1 if $found; |
| 5882 }, 0); | 5909 }, 0); |
| 5883 | 5910 |
| 5884 return $found; | 5911 return $found; |
| 5885 } | 5912 } |
| 5886 | 5913 |
| 5887 1; | 5914 1; |
| OLD | NEW |