[Webkit-unassigned] [Bug 103642] Add support for generic types in arrays and sequences to the code generators

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Nov 29 16:09:40 PST 2012


https://bugs.webkit.org/show_bug.cgi?id=103642


Kentaro Hara <haraken at chromium.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #176740|review?                     |review-
               Flag|                            |




--- Comment #5 from Kentaro Hara <haraken at chromium.org>  2012-11-29 16:11:56 PST ---
(From update of attachment 176740)
View in context: https://bugs.webkit.org/attachment.cgi?id=176740&action=review

The approach looks reasonable. r-ing due to duplicated code in toHostObjectArray(). I hope you can use toNativeArray().

I guess you need to make some change to CodeGenerator{GObject,CPP,ObjC}.pm to fix build errors.

> Source/WebCore/bindings/js/JSDOMBinding.h:416
> +    template <class T, class JST>
> +    Vector<RefPtr<T> > toHostObjectArray(JSC::ExecState* exec, JSC::JSValue value, T* (*toT)(JSC::JSValue value))

Can you avoid adding this method by using NativeValueTraits<T> ? See toNativeArray() and NativeValueTraits<T> in JSDOMBinding.h. toNativeArray() is doing the same thing as this method.

> Source/WebCore/bindings/js/JSDOMBinding.h:421
> +            return result;

Nit: 'return Vector<T>()' would be clearer.

> Source/WebCore/bindings/js/JSDOMBinding.h:430
> +                return result;

Maybe this should be 'return Vector<T>()' ?

>> Source/WebCore/bindings/js/JSDOMBinding.h:433
>> +        return result;
> 
> Does this mean we copy the array and churn the refcount, or are we smart enough to move it?  We might want to use an out parameter to avoid the extra memcpy.

Good point. We're doing the same thing in other methods of V8Binding.h and JSDOMBinding.h. Let's fix it in a follow-up patch.

> Source/WebCore/bindings/v8/V8Binding.h:211
> +    template <class T, class V8T>
> +    Vector<RefPtr<T> > toHostObjectArray(v8::Handle<v8::Value> value)

Ditto. Can you avoid adding this method by using NativeValueTraits<T> ?

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list