Closed Bug 921149 Opened 11 years ago Closed 6 years ago

ArchiveReader for Workers

Categories

(Core :: DOM: Core & HTML, defect, P5)

defect

Tracking

()

RESOLVED INVALID

People

(Reporter: Yoric, Unassigned)

References

Details

(Whiteboard: [Async:ready])

It would be very useful to use ArchiveReader in (at least chrome) Workers.
Should we wait for the stuff that Kyle is working on before we port more APIs to workers?
You mean like sane event loop (Bug 914762) ?
Depends on: 917182
(In reply to :Ehsan Akhgari (needinfo? me!) from comment #1)
> Should we wait for the stuff that Kyle is working on before we port more
> APIs to workers?

I suppose that we should.
There is also the question of whether the best way to achieve this feature for platform development is to port the native implementation of ArchiveReader to Workers or to reimplement something similar with js-ctypes.
David, what's your use case for this?  We need to prioritize the APIs that we want to port to workers, and currently we have a long list of things needed for Firefox OS already.
And APIs for the web (WebSocket, IDB)
(In reply to :Ehsan Akhgari (needinfo? me!) from comment #4)
> David, what's your use case for this?  We need to prioritize the APIs that
> we want to port to workers, and currently we have a long list of things
> needed for Firefox OS already.

Let's ask Mossop, who indirectly inspired this bug.
Flags: needinfo?(dtownsend+bugmail)
(In reply to David Rajchenbach Teller [:Yoric] from comment #6)
> (In reply to :Ehsan Akhgari (needinfo? me!) from comment #4)
> > David, what's your use case for this?  We need to prioritize the APIs that
> > we want to port to workers, and currently we have a long list of things
> > needed for Firefox OS already.
> 
> Let's ask Mossop, who indirectly inspired this bug.

When the add-ons manager has to extract files from an XPI it currently does so synchronously. I'm attempting to make that async but the only extraction options look to involve at the least opening file streams on the main thread.
Flags: needinfo?(dtownsend+bugmail)
Probably would be nice to have an ArchiveReaderSync API in workers. It should not be too complex because ArchiveReader is (in part) thread-safe. But I agree with ehsan: we should choose how this API is a priority.
(In reply to Andrea Marchesini (:baku) from comment #8)
> Probably would be nice to have an ArchiveReaderSync API in workers.
By default we should have same APIs on workers and main thread, and only if sync version
is something super useful, we should add such to workers, IMHO.
Actually, I believe that providing an async version for workers is nearly useless. It leads to more complex client code, it doesn't help remove the main thread bottleneck, plus it can be obtained trivially from a sync version by spawning a worker. So, on workers, I would really concentrate on the sync version. I believe that this is also our policy for e.g. IndexedDB.
We don't have any such policy (and to me it sounds really odd if we end up exposing sync IDB before async on workers. No other browser has sync IDB, but they do have async IDB even on workers)
Do we support DOMRequest in workers or do we have any plan to support it? This is the only problem I see in porting ArchiveReader to workers.
Flags: needinfo?(bugs)
We haven't exposed DOMRequest in workers since there hasn't been any use case for them.
The only part which looks main thread only is DOMRequest::Init, which assumes
window is non-null.
I guess we could rename that to InitForMainThread or make it null-safe.

And DOMRequestService can't be used on workers, but I don't know whether it is needed at all for
ArchiveReader.
Flags: needinfo?(bugs)
ArchiveRequestEvent may cause some problems since we don't have a sane event loop on workers.
Andrea, does the current implementation of ArchiveReader do any main thread I/O?
If not, for the current scenario, it's probably sufficient.
Flags: needinfo?(amarchesini)
(In reply to David Rajchenbach Teller [:Yoric] from comment #15)
> Andrea, does the current implementation of ArchiveReader do any main thread
> I/O?
> If not, for the current scenario, it's probably sufficient.

It doesn't. ArchiveReader opens the zip files/blobs in a separated thread.
Flags: needinfo?(amarchesini)
Whiteboard: [Async] → [Async:ready]
Priority: -- → P5
ArchiveReader is not part of any spec. This bug is invalid.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INVALID
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.