Changeset 142730 in webkit
- Timestamp:
- Feb 13, 2013 1:43:48 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r142728 r142730 1 2013-02-12 Kentaro Hara <haraken@chromium.org> 2 3 [V8] Generate wrapper methods for custom getters/setters 4 https://bugs.webkit.org/show_bug.cgi?id=109666 5 6 Reviewed by Adam Barth. 7 8 Currently V8 directly calls back custom getters/setters written 9 in custom binding files. This makes it impossible for code generators 10 to hook custom getters/setters (e.g. Code generators cannot insert a code 11 for FeatureObservation into custom getters/setters). We should generate 12 wrapper methods for custom getters/setters. 13 14 In the future, I will insert TRACE_EVENT() macros into these wrapper methods 15 to profile DOM getters/setters/methods. 16 17 * bindings/scripts/CodeGeneratorV8.pm: 18 (GenerateNormalAttrGetter): 19 (GenerateNormalAttrSetter): 20 (GenerateSingleBatchedAttribute): 21 (GenerateImplementation): 22 * bindings/scripts/test/V8/V8TestInterface.cpp: 23 (WebCore::TestInterfaceV8Internal::supplementalStr3AttrGetter): 24 (TestInterfaceV8Internal): 25 (WebCore::TestInterfaceV8Internal::supplementalStr3AttrSetter): 26 (WebCore): 27 * bindings/scripts/test/V8/V8TestObj.cpp: 28 (WebCore::TestObjV8Internal::customAttrAttrGetter): 29 (TestObjV8Internal): 30 (WebCore::TestObjV8Internal::customAttrAttrSetter): 31 (WebCore): 32 1 33 2013-02-13 Sheriff Bot <webkit.review.bot@gmail.com> 2 34 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
r142727 r142730 899 899 push(@implContentDecls, GenerateFeatureObservation($attrExt->{"V8MeasureAs"})); 900 900 901 if (HasCustomGetter($attrExt)) { 902 push(@implContentDecls, <<END); 903 return ${v8InterfaceName}::${attrName}AccessorGetter(name, info); 904 } 905 906 END 907 push(@implContentDecls, "#endif // ${conditionalString}\n\n") if $conditionalString; 908 return; 909 } 910 901 911 if ($svgNativeType) { 902 912 my $svgWrappedNativeType = $codeGenerator->GetSVGWrappedTypeNeedingTearOff($interfaceName); … … 1174 1184 push(@implContentDecls, "static void ${attrName}AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)\n{\n"); 1175 1185 push(@implContentDecls, GenerateFeatureObservation($attribute->signature->extendedAttributes->{"V8MeasureAs"})); 1186 1187 if (HasCustomSetter($attrExt)) { 1188 push(@implContentDecls, <<END); 1189 ${v8InterfaceName}::${attrName}AccessorSetter(name, value, info); 1190 } 1191 1192 END 1193 push(@implContentDecls, "#endif // ${conditionalString}\n\n") if $conditionalString; 1194 return; 1195 } 1176 1196 1177 1197 # If the "StrictTypeChecking" extended attribute is present, and the attribute's type is an … … 2308 2328 $setter = "${interfaceName}V8Internal::${interfaceName}ReplaceableAttrSetter"; 2309 2329 } 2310 2311 if (HasCustomSetter($attrExt)) {2312 $setter = "V8${customAccessor}AccessorSetter";2313 }2314 2315 if (HasCustomGetter($attrExt)) {2316 $getter = "V8${customAccessor}AccessorGetter";2317 }2318 2330 } 2319 2331 … … 2713 2725 } 2714 2726 2715 if (!HasCustomGetter($attrExt)) { 2716 GenerateNormalAttrGetter($attribute, $interface); 2717 } 2727 GenerateNormalAttrGetter($attribute, $interface); 2718 2728 2719 2729 if ($attrExt->{"Replaceable"}) { 2720 2730 $hasReplaceable = 1; 2721 } elsif (! HasCustomSetter($attrExt) && !IsReadonly($attribute)) {2731 } elsif (!IsReadonly($attribute)) { 2722 2732 GenerateNormalAttrSetter($attribute, $interface); 2723 2733 } -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp
r142250 r142730 126 126 TestSupplemental::setSupplementalStr2(imp, v); 127 127 return; 128 } 129 130 #endif // ENABLE(Condition11) || ENABLE(Condition12) 131 132 #if ENABLE(Condition11) || ENABLE(Condition12) 133 134 static v8::Handle<v8::Value> supplementalStr3AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) 135 { 136 return V8TestInterface::supplementalStr3AccessorGetter(name, info); 137 } 138 139 #endif // ENABLE(Condition11) || ENABLE(Condition12) 140 141 #if ENABLE(Condition11) || ENABLE(Condition12) 142 143 static void supplementalStr3AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) 144 { 145 V8TestInterface::supplementalStr3AccessorSetter(name, value, info); 128 146 } 129 147 … … 217 235 #if ENABLE(Condition11) || ENABLE(Condition12) 218 236 // Attribute 'supplementalStr3' (Type: 'attribute' ExtAttr: 'CustomSetter CustomGetter Conditional ImplementedBy') 219 {"supplementalStr3", V8TestInterface::supplementalStr3AccessorGetter, V8TestInterface::supplementalStr3AccessorSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},237 {"supplementalStr3", TestInterfaceV8Internal::supplementalStr3AttrGetter, TestInterfaceV8Internal::supplementalStr3AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 220 238 #endif // ENABLE(Condition11) || ENABLE(Condition12) 221 239 #if ENABLE(Condition11) || ENABLE(Condition12) -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
r142250 r142730 499 499 setDOMException(ec, info.GetIsolate()); 500 500 return; 501 } 502 503 static v8::Handle<v8::Value> customAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) 504 { 505 return V8TestObj::customAttrAccessorGetter(name, info); 506 } 507 508 static void customAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) 509 { 510 V8TestObj::customAttrAccessorSetter(name, value, info); 501 511 } 502 512 … … 1918 1928 {"stringAttrWithSetterException", TestObjV8Internal::stringAttrWithSetterExceptionAttrGetter, TestObjV8Internal::stringAttrWithSetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 1919 1929 // Attribute 'customAttr' (Type: 'attribute' ExtAttr: 'Custom') 1920 {"customAttr", V8TestObj::customAttrAccessorGetter, V8TestObj::customAttrAccessorSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},1930 {"customAttr", TestObjV8Internal::customAttrAttrGetter, TestObjV8Internal::customAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 1921 1931 // Attribute 'withScriptStateAttribute' (Type: 'attribute' ExtAttr: 'CallWith') 1922 1932 {"withScriptStateAttribute", TestObjV8Internal::withScriptStateAttributeAttrGetter, TestObjV8Internal::withScriptStateAttributeAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
Note: See TracChangeset
for help on using the changeset viewer.