RESOLVED FIXED 47616
Support typed arrays in workers
https://bugs.webkit.org/show_bug.cgi?id=47616
Summary Support typed arrays in workers
Jian Li
Reported 2010-10-13 13:28:55 PDT
Since ArrayBuffer will be used in FileReader/FileReaderSync, we need to support adding typed arrays in workers. This involves: 1) Exposing constructors in WorkerContext. 2) Adding NoStaticTables attributes.
Attachments
Proposed Patch (9.44 KB, patch)
2010-10-13 13:55 PDT, Jian Li
jianli: commit-queue-
Proposed Patch (10.12 KB, patch)
2010-10-13 15:22 PDT, Jian Li
jianli: commit-queue-
Proposed Patch (10.31 KB, patch)
2010-10-13 16:03 PDT, Jian Li
levin: review+
jianli: commit-queue-
Jian Li
Comment 1 2010-10-13 13:55:49 PDT
Created attachment 70656 [details] Proposed Patch
Eric Seidel (no email)
Comment 2 2010-10-13 14:25:58 PDT
Jian Li
Comment 3 2010-10-13 15:22:50 PDT
Created attachment 70671 [details] Proposed Patch Fixed mac build error.
Eric Seidel (no email)
Comment 4 2010-10-13 15:50:10 PDT
Jian Li
Comment 5 2010-10-13 16:03:44 PDT
Created attachment 70678 [details] Proposed Patch
David Levin
Comment 6 2010-10-13 22:52:32 PDT
Comment on attachment 70678 [details] Proposed Patch View in context: https://bugs.webkit.org/attachment.cgi?id=70678&action=review Consider removing the 3D_CANVAS in the Conditional in workers. Also I see that the attributes are already out of sort order, but I think we can keep them mostly sorted with the moves that I suggested. > WebCore/html/canvas/ArrayBuffer.idl:33 > + NoStaticTables I'd move NoStaticTables to be sorted. Following the general idea: If ordering doesn't matter, sort. > WebCore/html/canvas/ArrayBufferView.idl:27 > + interface [Conditional=3D_CANVAS|BLOB, CustomToJS, OmitConstructor, NoStaticTables] ArrayBufferView { Consider moving before OmitConstructor. > WebCore/html/canvas/Float32Array.idl:33 > + NoStaticTables, After Generate... > WebCore/workers/WorkerContext.idl:117 > + attribute [Conditional=3D_CANVAS|BLOB,EnabledAtRuntime] ArrayBufferConstructor ArrayBuffer; // Usable with new operator Why are we exposing these in Workers when 3d canvas is enabled?
Alexey Proskuryakov
Comment 7 2010-10-14 10:57:21 PDT
> need to support adding typed arrays in workers. This involves: > 1) Exposing constructors in WorkerContext. > 2) Adding NoStaticTables attributes. A general comment: exposing any feature in workers involves making sure that its implementation is thread safe. This is by far the most important and complicated step. Watching the bugs, I'm not convinced that such analysis is being performed for each feature that's being added to workers.
Jian Li
Comment 8 2010-10-14 11:05:23 PDT
(In reply to comment #7) > > need to support adding typed arrays in workers. This involves: > > 1) Exposing constructors in WorkerContext. > > 2) Adding NoStaticTables attributes. > > A general comment: exposing any feature in workers involves making sure that its implementation is thread safe. This is by far the most important and complicated step. > > Watching the bugs, I'm not convinced that such analysis is being performed for each feature that's being added to workers. Thanks a lot for reminding. We're not supporting passing type array objects between main thread and worker thread. We only allow them to be constructed and used in one single thread. I've checked the implementations and it seems to be fine for sole use in single thread. Anything else I need to analyze?
Alexey Proskuryakov
Comment 9 2010-10-14 11:24:16 PDT
Yes, I also didn't spot anything suspicious in the implementation. Unlike a lot of WebCore code, it's not using any static data.
Jian Li
Comment 10 2010-10-14 12:07:26 PDT
Fixed as suggested and committed as http://trac.webkit.org/changeset/69782.
David Levin
Comment 11 2010-10-14 14:05:59 PDT
(In reply to comment #7) > A general comment: exposing any feature in workers involves making sure that its implementation is thread safe. This is by far the most important and complicated step. > > Watching the bugs, I'm not convinced that such analysis is being performed for each feature that's being added to workers. Thanks for the reminder Alexey! I've been trying to watch that (but in honestly for this one in particular I didn't look at closely as I should have at all of the under lying implementation until your reminder -- even thought it turned out alright). I'll make a special note each time I review one of them that I did this, so anyone scanning reviews can see what outside of the sparse comments was done.
Note You need to log in before you can comment on or make changes to this bug.