Necko: support sending OnDataAvailable() to other threads: Difference between revisions

Line 21: Line 21:
Two obvious ways come to mind.  1) We could also divert OnStopRequest() to the listener's thread.  Or, 2) we could send an additional OnDataAvailable() with data length == 0 to signal the end of the Request. #1 is more intuitive for the programmer;  #2 is more conservative, in that the main thread will still receive OnStopRequest.  Since compliant nsChannels will need to be modified anyway, no one could think of a good reason not to change them to no longer expect OnStopRequest(), and so #1 is the current winner, pending discovery of any problems with not delivering OnStopReq() to the main thread.
Two obvious ways come to mind.  1) We could also divert OnStopRequest() to the listener's thread.  Or, 2) we could send an additional OnDataAvailable() with data length == 0 to signal the end of the Request. #1 is more intuitive for the programmer;  #2 is more conservative, in that the main thread will still receive OnStopRequest.  Since compliant nsChannels will need to be modified anyway, no one could think of a good reason not to change them to no longer expect OnStopRequest(), and so #1 is the current winner, pending discovery of any problems with not delivering OnStopReq() to the main thread.


3) Need to QI Channel to see if it supports other-thread delivery, and Channel in turn needs to QI chain of Listeners that they are thread-safe.
3) Code would need to query both the Channel and any StreamListeners chained between the socket and the target listener, to make sure they are all safe to be switched to a different thread for OnDataAvailable.


== Implemention Questions ==
== Implemention Questions ==
Confirmed users
431

edits