WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
149434
The binding for getDistributedNodes unnecessarily makes a vector of nodes
https://bugs.webkit.org/show_bug.cgi?id=149434
Summary
The binding for getDistributedNodes unnecessarily makes a vector of nodes
Ryosuke Niwa
Reported
2015-09-21 16:35:25 PDT
We shouldn't need to create a Vector<RefPtr<Node>> just so that the binding code can generate the right code.
Attachments
Fixes the bug
(3.48 KB, patch)
2015-09-21 16:48 PDT
,
Ryosuke Niwa
darin
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Ryosuke Niwa
Comment 1
2015-09-21 16:48:33 PDT
Created
attachment 261703
[details]
Fixes the bug
Darin Adler
Comment 2
2015-09-21 16:54:41 PDT
Comment on
attachment 261703
[details]
Fixes the bug View in context:
https://bugs.webkit.org/attachment.cgi?id=261703&action=review
> Source/WebCore/bindings/js/JSDOMBinding.h:467 > +template<typename T> > +inline JSC::JSValue jsArray(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, const Vector<T>* vector) > +{ > + JSC::MarkedArgumentBuffer list; > + if (vector) { > + for (auto& element : *vector) > + list.append(JSValueTraits<T>::arrayJSValue(exec, globalObject, element)); > + } > + return JSC::constructArray(exec, nullptr, globalObject, list); > +}
I suggest writing this instead: template<typename T, size_t inlineCapacity> inline JSC::JSValue jsArray(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, const Vector<T, inlineCapacity>* vector) { if (!vector) return JSC::constructEmptyArray(exec); return jsArray(exec, globalObject, *vector); }
Ryosuke Niwa
Comment 3
2015-09-21 17:26:21 PDT
Committed
r190093
: <
http://trac.webkit.org/changeset/190093
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug