consider supporting nsICloneableInputStream for file streams under some conditions




4 years ago
2 years ago


(Reporter: bkelly, Unassigned)


Firefox Tracking Flags

(Not tracked)


(Whiteboard: [necko-would-take])

In bug 1100398 I am adding the nsICloneableInputStream interface.  This allows streams to Clone() themselves in the most efficient way possible.  For file streams I had originally planned to use dup(2) for this, but later realized this was not feasible due to the file cursor being shared by the fds.

One possible way to still support Clone() of file streams would be to only allow it in the parent process.  Basically the file stream's GetCloneable() method would check to see if a file path was set.  If so, then return true.  Then in Clone() do a new Open() and seek to the correct offset in the file.

Of course, if the stream has gone through IPC, then it will only have an fd without a file path.  In this case GetCloneable() would return false.

This would allow file streams to be Clone()'d efficiently in the parent process.  This is not useful for my case (SW Cache API), but may be for other code.  For example, would imglib benefit from this?  If so, we may want to implement it.
Whiteboard: [necko-would-take]
Bulk change to priority:
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.