WebKit Bugzilla
Attachment 357353 Details for
Bug 192721
: Bindings generator should support Conditional= along with CachedAttribute
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192721-20181214161919.patch (text/plain), 8.20 KB, created by
Justin Michaud
on 2018-12-14 16:19:19 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Justin Michaud
Created:
2018-12-14 16:19:19 PST
Size:
8.20 KB
patch
obsolete
>Subversion Revision: 239171 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index c7c333bbc491e236532813334d0f41a531b75075..6536100ad07ed5786eb5e55ff748d203e74b0142 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,22 @@ >+2018-12-14 Justin Michaud <justin_michaud@apple.com> >+ >+ Bindings generator should support Conditional= along with CachedAttribute >+ https://bugs.webkit.org/show_bug.cgi?id=192721 >+ >+ Fix a bug where specifying both attributes causes compilation errors because the compile-time >+ condition is not included in the derived code. >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * bindings/scripts/CodeGeneratorJS.pm: >+ (GenerateImplementation): >+ * bindings/scripts/test/JS/JSTestObj.cpp: >+ (WebCore::jsTestObjCachedAttribute3Getter): >+ (WebCore::jsTestObjCachedAttribute3): >+ (WebCore::JSTestObj::visitChildren): >+ * bindings/scripts/test/JS/JSTestObj.h: >+ * bindings/scripts/test/TestObj.idl: >+ > 2018-12-13 Eric Carlson <eric.carlson@apple.com> > > [MediaStream] Calculate width or height when constraints contain only the other >diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >index 4917c14a8e7d71c59e38591ae0867127fa263f32..c5382bd7ac2d0d58bce72bcf1d741048c19ebf6d 100644 >--- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >+++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >@@ -4524,7 +4524,10 @@ sub GenerateImplementation > if ($numCachedAttributes > 0) { > foreach my $attribute (@{$interface->attributes}) { > if ($attribute->extendedAttributes->{CachedAttribute}) { >+ my $conditionalString = $codeGenerator->GenerateConditionalString($attribute); >+ push(@implContent, "#if ${conditionalString}\n") if $conditionalString; > push(@implContent, " visitor.append(thisObject->m_" . $attribute->name . ");\n"); >+ push(@implContent, "#endif\n") if $conditionalString; > } > } > } >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp >index 1bd2fa1e005c34c8b8d6e0fe1388a980bdc4140a..e2f48367eaec95daba1e6e1da0bad20951f69029 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp >@@ -1737,6 +1737,9 @@ bool setJSTestObjConditionalAttr6Constructor(JSC::ExecState*, JSC::EncodedJSValu > #endif > JSC::EncodedJSValue jsTestObjCachedAttribute1(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); > JSC::EncodedJSValue jsTestObjCachedAttribute2(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); >+#if ENABLE(CONDITION) >+JSC::EncodedJSValue jsTestObjCachedAttribute3(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); >+#endif > JSC::EncodedJSValue jsTestObjAnyAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); > bool setJSTestObjAnyAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); > JSC::EncodedJSValue jsTestObjObjectAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); >@@ -2072,6 +2075,11 @@ static const HashTableValue JSTestObjPrototypeTableValues[] = > #endif > { "cachedAttribute1", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCachedAttribute1), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, > { "cachedAttribute2", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCachedAttribute2), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, >+#if ENABLE(CONDITION) >+ { "cachedAttribute3", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCachedAttribute3), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, >+#else >+ { 0, 0, NoIntrinsic, { 0, 0 } }, >+#endif > { "anyAttribute", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAnyAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjAnyAttribute) } }, > { "objectAttribute", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjObjectAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjObjectAttribute) } }, > { "contentDocument", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjContentDocument), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, >@@ -4543,6 +4551,26 @@ EncodedJSValue jsTestObjCachedAttribute2(ExecState* state, EncodedJSValue thisVa > return IDLAttribute<JSTestObj>::get<jsTestObjCachedAttribute2Getter, CastedThisErrorBehavior::Assert>(*state, thisValue, "cachedAttribute2"); > } > >+#if ENABLE(CONDITION) >+static inline JSValue jsTestObjCachedAttribute3Getter(ExecState& state, JSTestObj& thisObject, ThrowScope& throwScope) >+{ >+ UNUSED_PARAM(throwScope); >+ UNUSED_PARAM(state); >+ if (JSValue cachedValue = thisObject.m_cachedAttribute3.get()) >+ return cachedValue; >+ auto& impl = thisObject.wrapped(); >+ JSValue result = toJS<IDLAny>(state, throwScope, impl.cachedAttribute3()); >+ thisObject.m_cachedAttribute3.set(state.vm(), &thisObject, result); >+ return result; >+} >+ >+EncodedJSValue jsTestObjCachedAttribute3(ExecState* state, EncodedJSValue thisValue, PropertyName) >+{ >+ return IDLAttribute<JSTestObj>::get<jsTestObjCachedAttribute3Getter, CastedThisErrorBehavior::Assert>(*state, thisValue, "cachedAttribute3"); >+} >+ >+#endif >+ > static inline JSValue jsTestObjAnyAttributeGetter(ExecState& state, JSTestObj& thisObject, ThrowScope& throwScope) > { > UNUSED_PARAM(throwScope); >@@ -8494,6 +8522,9 @@ void JSTestObj::visitChildren(JSCell* cell, SlotVisitor& visitor) > Base::visitChildren(thisObject, visitor); > visitor.append(thisObject->m_cachedAttribute1); > visitor.append(thisObject->m_cachedAttribute2); >+#if ENABLE(CONDITION) >+ visitor.append(thisObject->m_cachedAttribute3); >+#endif > } > > void JSTestObj::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h >index 1e1b467ffe17da906e8faf1d3942f88e1a15c1c8..0566b17d337d3a3bf1a6ba3c16f63f7b559924e5 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h >@@ -60,6 +60,9 @@ public: > static JSC::JSObject* serialize(JSC::ExecState&, JSTestObj& thisObject, JSDOMGlobalObject&, JSC::ThrowScope&); > mutable JSC::WriteBarrier<JSC::Unknown> m_cachedAttribute1; > mutable JSC::WriteBarrier<JSC::Unknown> m_cachedAttribute2; >+#if ENABLE(CONDITION) >+ mutable JSC::WriteBarrier<JSC::Unknown> m_cachedAttribute3; >+#endif > static void visitChildren(JSCell*, JSC::SlotVisitor&); > > static void heapSnapshot(JSCell*, JSC::HeapSnapshotBuilder&); >diff --git a/Source/WebCore/bindings/scripts/test/TestObj.idl b/Source/WebCore/bindings/scripts/test/TestObj.idl >index 6da48039be6169865de14c71d906a1434ce301a1..b77e953617a8ef2ccfb56aa2194baa7a2fb0da61 100644 >--- a/Source/WebCore/bindings/scripts/test/TestObj.idl >+++ b/Source/WebCore/bindings/scripts/test/TestObj.idl >@@ -276,6 +276,7 @@ enum TestConfidence { "high", "kinda-low" }; > > [CachedAttribute] readonly attribute any cachedAttribute1; > [CachedAttribute] readonly attribute any cachedAttribute2; >+ [CachedAttribute, Conditional=CONDITION] readonly attribute any cachedAttribute3; > > attribute any anyAttribute; > attribute object objectAttribute;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192721
:
357353
|
357513