Re: [ServiceWorker] Can we change the body attribute of Request/Response to a method? (#606)

@horo-t 

We have similar data copying issues issues in gecko, although we don't have a separate process for ServiceWorker (yet?).

The way we avoid copying lots of data across process boundaries for something like this is to dup(2) the file descriptor for the cached response's body.  This means we're only copying an integer across process boundaries at first and the child process is responsible for all the reading into memory.

Can you do something similar?

So in this case you would just be passing the file descriptor to the SW process and if it doesn't actually touch the data, then you never actually read any of the stream data into memory.

Overall, though, it seems part of the point of making the body methods like text() and json() async with promises is because there is an expectation the UA will have to do work to get the data into memory when you access them.  I'm not sure I would really classify this as a "side-effect".  Just my opinion, of course, though.

---
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/606#issuecomment-70852569

Received on Wednesday, 21 January 2015 15:04:50 UTC