[Webkit-unassigned] [Bug 41426] Add WKArrayRef API to WebKit2

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jun 30 14:21:05 PDT 2010


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





--- Comment #4 from Sam Weinig <sam at webkit.org>  2010-06-30 14:21:05 PST ---
(In reply to comment #3)
> (From update of attachment 60144 [details])
> > +        * Shared/WebArray.cpp: Added.
> > +        (WebKit::WebArray::WebArray):
> > +        (WebKit::WebArray::~WebArray):
> > +        * Shared/WebArray.h: Added.
> > +        (WebKit::WebArray::create):
> > +        (WebKit::WebArray::adopt):
> > +        (WebKit::WebArray::at):
> > +        (WebKit::WebArray::size):
> > +        (WebKit::WebArray::):
> > +        * UIProcess/API/C/WKAPICast.h:
> > +        (WebKit::):
> > +        * UIProcess/API/C/WKArray.cpp: Added.
> > +        (WKArrayGetItemAtIndex):
> > +        (WKArrayGetSize):
> > +        (WKArrayRetain):
> > +        (WKArrayRelease):
> 
> I don’t see any reason to leave in these lists of added functions. I normally just delete them for added files.

Ok.

> 
> Also, that broken "(WebKit::)" definitely should not be left in.
> 
> > +WebArray::WebArray(const void** entries, size_t size, const WebArrayCallbacks* callbacks)
> > +    : m_entries((void**)fastMalloc(size * sizeof(void*)))
> 
> How about using "new" instead of fastMalloc and avoiding the type casts? How about using static_cast if you need a typecast?

Will change.

> > +    enum AdoptTag { Adopt };
> > +    WebArray(AdoptTag, void** entries, size_t size, const WebArrayCallbacks* callbacks);
> 
> Maybe the AdoptTag should be the last argument. Might generate better code even.
> 
> I suggest leaving out the argument name "callbacks".
> 

Will fix both.

> > +WK_EXPORT const void* WKArrayGetItemAtIndex(WKArrayRef array, size_t index);
> 
> What is behavior when you use a bad index? Guarantee of returning 0? Undefined?
> 

The behavior is the undefined.  RIght now we read off the end of the buffer and ASSERT in debug builds.

> Seems OK, r=me

Anders wants me to remove the 'Web' prefix from this class and instead we decided to call it ImmutableArray.  Does that sound ok?

-- 
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