[webkit-reviews] review requested: [Bug 197535] [GLib] Expose typed arrays in the API : [Attachment 369379] WIP Patch v2

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed May 8 05:47:04 PDT 2019

Adrian Perez <aperez at igalia.com> has asked  for review:
Bug 197535: [GLib] Expose typed arrays in the API

Attachment 369379: WIP Patch v2


--- Comment #9 from Adrian Perez <aperez at igalia.com> ---
Created attachment 369379

  --> https://bugs.webkit.org/attachment.cgi?id=369379&action=review

WIP Patch v2

This version of the patch has the following changes from v1:

- New API functions and types now have documentation.

- jsc_typed_array_new_from_data() now can take an “user_data”, which is
  what gets passed to the “destroy_notify” callback. This provides some
  needed flexibility to allow wrapping something more complex than a raw
  memory buffer as a typed array (check the documentation, which uses a
  GMappedFile to exemplify this).

- jsc_typed_array_get_contents() now returns “gpointer”. I think this is
  better than the “guchar*” suggestion by Michael, because it forces the
  users of the function to think and deliberately choose which pointer
  type they need to cast the returned value to. This is good because
  typed array contents can be elements of different types, and forcing
  users to make an explicit choice avoids a potential footgun.

The patch still needs adding unit tests for the new API, which is the
next thing I will be doing. Any feedback that reviewers can provide in
the meantimea bout the patch will be valuable (thanks!)

More information about the webkit-reviews mailing list