Open Bug 1255070 Opened 10 years ago Updated 1 year ago

implement nsIBufferedInputStream and nsIBufferedOutputStream on more stream classes that support ReadSegments and WriteSegments

Categories

(Core :: XPCOM, defect, P3)

defect

Tracking

()

Tracking Status
e10s + ---

People

(Reporter: bkelly, Unassigned)

References

Details

Attachments

(7 files, 4 obsolete files)

5.49 KB, patch
Details | Diff | Splinter Review
3.76 KB, patch
Details | Diff | Splinter Review
8.00 KB, patch
Details | Diff | Splinter Review
3.67 KB, patch
Details | Diff | Splinter Review
3.24 KB, patch
Details | Diff | Splinter Review
4.72 KB, patch
Details | Diff | Splinter Review
4.73 KB, patch
Details | Diff | Splinter Review
Currently methods like NS_InputStreamIsBuffered() and NS_OutputStreamIsBuffered() do something like this: 1) Check if the stream implements the appropriate nsIBuffered* interface type. 2) If not, call ReadSegments() or WriteSegments() with a dummy callback. Currently the only stream types that implement the nsIBuffered* interfaces are nsBufferedInputStream and nsBufferedOutputStream. This means we hit case (2) a lot. The fallback in (2) is a problem for a couple reasons: a) It can cause I/O b) It is unreliable. For example, an async stream might return WOULD_BLOCK which results in the stream being marked as non-buffered. It would be much better all around if we simply implemented nsIBufferedInputStream and nsIBufferedOutputStream on my concrete stream classes. I have a patch to do this for nsPipeInputStream in bug 1093357, but I think we should do it to others as well.
This patch has r+, but needs some review comments addressed from bug 1093357 comment 64.
Attachment #8728499 - Flags: review+
Blocks: 1093357
Addressed review feedback. Updated commit message to reflect new bug.
Attachment #8728499 - Attachment is obsolete: true
Attachment #8728590 - Flags: review+
Lets just see how these few changes do on try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=bd3866e72dd7
See Also: → 1255604
Comment on attachment 8728590 [details] [diff] [review] P1 Make nsPipeInputStream implement nsIBufferedInputStream. r=froydnj I landed this in bug 1093357 after all.
Attachment #8728590 - Attachment is obsolete: true
tracking-e10s: --- → +
Priority: -- → P1
I'm surprised this is such a priority for e10s. Do you have data that shows this is a bad problem in practice. My work here has been a bit speculative. Incidentally I think we should take this bug in a slightly different direction. Instead of directly implementing nsIBufferedInputStream I think we should create a new interface type. This new type would provide a better that could be used to test buffered status at runtime in order to support aggregate stream types. nsIBufferedInputStream and these other stream types would implement this new interface.
Priority: P1 → P3
Andrea, this might be of interest to you.
Assignee: ben → nobody
Status: ASSIGNED → NEW
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: