Changeset 196170 in webkit
- Timestamp:
- Feb 5, 2016 1:59:15 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r196167 r196170 1 2016-02-05 Youenn Fablet <youenn.fablet@crf.canon.fr> 2 3 Remove DOMWrapped parameter from JSKeyValueIterator 4 https://bugs.webkit.org/show_bug.cgi?id=153859 5 6 Reviewed by Sam Weinig. 7 8 No change in behavior. 9 10 Using std::declval to infer DOMWrapped from JSWrapper::wrapped. 11 12 * bindings/js/JSFetchHeadersCustom.cpp: 13 (WebCore::JSFetchHeaders::entries): 14 (WebCore::JSFetchHeaders::keys): 15 (WebCore::JSFetchHeaders::values): 16 * bindings/js/JSKeyValueIterator.h: 17 (WebCore::createIterator): 18 (WebCore::JSKeyValueIterator<JSWrapper>::destroy): 19 (WebCore::JSKeyValueIterator<JSWrapper>::next): 20 (WebCore::JSKeyValueIteratorPrototypeFunctionNext): 21 (WebCore::JSKeyValueIteratorPrototype<JSWrapper>::finishCreation): 22 1 23 2016-02-05 Nan Wang <n_wang@apple.com> 2 24 -
trunk/Source/WebCore/bindings/js/JSFetchHeadersCustom.cpp
r196128 r196170 37 37 38 38 // FIXME: Move this code to JSFetchHeaders. 39 using FetchHeadersIterator = JSKeyValueIterator<JSFetchHeaders , FetchHeaders>;40 using FetchHeadersIteratorPrototype = JSKeyValueIteratorPrototype<JSFetchHeaders , FetchHeaders>;39 using FetchHeadersIterator = JSKeyValueIterator<JSFetchHeaders>; 40 using FetchHeadersIteratorPrototype = JSKeyValueIteratorPrototype<JSFetchHeaders>; 41 41 42 42 template<> … … 48 48 JSC::JSValue JSFetchHeaders::entries(JSC::ExecState&) 49 49 { 50 return createIterator<JSFetchHeaders , FetchHeaders>(*globalObject(), *this, IterationKind::KeyValue);50 return createIterator<JSFetchHeaders>(*globalObject(), *this, IterationKind::KeyValue); 51 51 } 52 52 53 53 JSC::JSValue JSFetchHeaders::keys(JSC::ExecState&) 54 54 { 55 return createIterator<JSFetchHeaders , FetchHeaders>(*globalObject(), *this, IterationKind::Key);55 return createIterator<JSFetchHeaders>(*globalObject(), *this, IterationKind::Key); 56 56 } 57 57 58 58 JSC::JSValue JSFetchHeaders::values(JSC::ExecState&) 59 59 { 60 return createIterator<JSFetchHeaders , FetchHeaders>(*globalObject(), *this, IterationKind::Value);60 return createIterator<JSFetchHeaders>(*globalObject(), *this, IterationKind::Value); 61 61 } 62 62 -
trunk/Source/WebCore/bindings/js/JSKeyValueIterator.h
r196128 r196170 29 29 #include "JSDOMBinding.h" 30 30 #include <runtime/JSDestructibleObject.h> 31 #include <type_traits> 31 32 32 33 namespace WebCore { 33 34 34 // FIXME: Update binding generator to allow getting DOMWrapped from JSWrapper. 35 template<typename JSWrapper, typename DOMWrapped> 35 template<typename JSWrapper> 36 36 class JSKeyValueIteratorPrototype : public JSC::JSNonFinalObject { 37 37 public: 38 typedef JSC::JSNonFinalObject Base; 38 using DOMWrapped = typename std::remove_reference<decltype(std::declval<JSWrapper>().wrapped())>::type; 39 using Base = JSC::JSNonFinalObject; 39 40 40 41 static JSKeyValueIteratorPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) … … 62 63 enum class IterationKind { Key, Value, KeyValue }; 63 64 64 template<typename JSWrapper , typename DOMWrapped>65 template<typename JSWrapper> 65 66 class JSKeyValueIterator: public JSDOMObject { 66 67 public: 67 typedef JSDOMObject Base; 68 using DOMWrapped = typename std::remove_reference<decltype(std::declval<JSWrapper>().wrapped())>::type; 69 using Base = JSDOMObject; 68 70 69 71 DECLARE_INFO; … … 81 83 } 82 84 83 static JSKeyValueIteratorPrototype<JSWrapper , DOMWrapped>* createPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject)85 static JSKeyValueIteratorPrototype<JSWrapper>* createPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject) 84 86 { 85 return JSKeyValueIteratorPrototype<JSWrapper , DOMWrapped>::create(vm, globalObject,86 JSKeyValueIteratorPrototype<JSWrapper , DOMWrapped>::createStructure(vm, globalObject, globalObject->objectPrototype()));87 return JSKeyValueIteratorPrototype<JSWrapper>::create(vm, globalObject, 88 JSKeyValueIteratorPrototype<JSWrapper>::createStructure(vm, globalObject, globalObject->objectPrototype())); 87 89 } 88 90 … … 103 105 }; 104 106 105 template<typename JSWrapper , typename DOMWrapped>106 JSKeyValueIterator<JSWrapper , DOMWrapped>* createIterator(JSDOMGlobalObject& globalObject, JSWrapper& wrapper, IterationKind kind)107 template<typename JSWrapper> 108 JSKeyValueIterator<JSWrapper>* createIterator(JSDOMGlobalObject& globalObject, JSWrapper& wrapper, IterationKind kind) 107 109 { 108 return JSKeyValueIterator<JSWrapper , DOMWrapped>::create(globalObject.vm(), getDOMStructure<JSKeyValueIterator<JSWrapper, DOMWrapped>>(globalObject.vm(), globalObject), wrapper, kind);110 return JSKeyValueIterator<JSWrapper>::create(globalObject.vm(), getDOMStructure<JSKeyValueIterator<JSWrapper>>(globalObject.vm(), globalObject), wrapper, kind); 109 111 } 110 112 111 template<typename JSWrapper , typename DOMWrapped>112 void JSKeyValueIterator<JSWrapper , DOMWrapped>::destroy(JSCell* cell)113 template<typename JSWrapper> 114 void JSKeyValueIterator<JSWrapper>::destroy(JSCell* cell) 113 115 { 114 JSKeyValueIterator<JSWrapper , DOMWrapped>* thisObject = JSC::jsCast<JSKeyValueIterator<JSWrapper, DOMWrapped>*>(cell);115 thisObject->JSKeyValueIterator<JSWrapper , DOMWrapped>::~JSKeyValueIterator();116 JSKeyValueIterator<JSWrapper>* thisObject = JSC::jsCast<JSKeyValueIterator<JSWrapper>*>(cell); 117 thisObject->JSKeyValueIterator<JSWrapper>::~JSKeyValueIterator(); 116 118 } 117 119 118 template<typename JSWrapper , typename DOMWrapped>119 bool JSKeyValueIterator<JSWrapper , DOMWrapped>::next(JSC::ExecState& state, JSC::JSValue& value)120 template<typename JSWrapper> 121 bool JSKeyValueIterator<JSWrapper>::next(JSC::ExecState& state, JSC::JSValue& value) 120 122 { 121 123 typename DOMWrapped::Iterator::Key nextKey; … … 134 136 } 135 137 136 template<typename JSWrapper , typename DOMWrapped>137 JSC::EncodedJSValue JSC_HOST_CALL JSKeyValueIteratorPrototype<JSWrapper , DOMWrapped>::next(JSC::ExecState* state)138 template<typename JSWrapper> 139 JSC::EncodedJSValue JSC_HOST_CALL JSKeyValueIteratorPrototype<JSWrapper>::next(JSC::ExecState* state) 138 140 { 139 JSKeyValueIterator<JSWrapper , DOMWrapped>* iterator = JSC::jsDynamicCast<JSKeyValueIterator<JSWrapper, DOMWrapped>*>(state->thisValue());141 JSKeyValueIterator<JSWrapper>* iterator = JSC::jsDynamicCast<JSKeyValueIterator<JSWrapper>*>(state->thisValue()); 140 142 if (!iterator) 141 143 return JSC::JSValue::encode(throwTypeError(state, ASCIILiteral("Cannot call next() on a non-Iterator object"))); … … 146 148 } 147 149 148 template<typename JSWrapper , typename DOMWrapped>149 void JSKeyValueIteratorPrototype<JSWrapper , DOMWrapped>::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject)150 template<typename JSWrapper> 151 void JSKeyValueIteratorPrototype<JSWrapper>::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) 150 152 { 151 153 Base::finishCreation(vm);
Note: See TracChangeset
for help on using the changeset viewer.