Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Issue 2251853002: Add net::SourceStream and net::FilterSourceStream (Closed)

Created:
4 years, 4 months ago by xunjieli
Modified:
4 years, 3 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add net::SourceStream and net::FilterSourceStream This CL adds two new classes net::SourceStream and net::FilterSourceStream. This is a part of the effort to refactor net::Filter into a pull-based interface. The complete CL is at crrev.com/1662763002. BUG=474859 Committed: https://crrev.com/95ea25f5dd7e255a01efd1b10bd9250cbc3c0d69 Cr-Commit-Position: refs/heads/master@{#417716}

Patch Set 1 : Same as PS#18 of old CL but with upstream/downstream name change #

Total comments: 46

Patch Set 2 : Address Matt's comments #

Patch Set 3 : fix compile #

Patch Set 4 : fix tests #

Patch Set 5 : Fix a typo #

Total comments: 61

Patch Set 6 : address Matt's comments #

Patch Set 7 : self review #

Total comments: 43

Patch Set 8 : address Randy's comments (synced to r412509) #

Patch Set 9 : Add a method to allow filter to specify whether it is done #

Total comments: 11

Patch Set 10 : Have an explict Pull() method #

Total comments: 3

Patch Set 11 : PS#9 documentation TODOs (synced to r417301) #

Total comments: 10

Patch Set 12 : address comments #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+1072 lines, -9 lines) Patch
A net/docs/filter.md View 1 2 3 4 5 6 7 8 9 1 chunk +36 lines, -0 lines 0 comments Download
A net/filter/filter_source_stream.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +117 lines, -0 lines 6 comments Download
A net/filter/filter_source_stream.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +166 lines, -0 lines 0 comments Download
A net/filter/filter_source_stream_unittest.cc View 1 2 3 4 5 6 7 10 1 chunk +512 lines, -0 lines 0 comments Download
A net/filter/mock_source_stream.h View 1 2 3 4 5 6 7 1 chunk +70 lines, -0 lines 0 comments Download
A net/filter/mock_source_stream.cc View 1 2 3 4 5 6 7 1 chunk +78 lines, -0 lines 0 comments Download
A net/filter/source_stream.h View 1 2 3 4 5 6 7 1 chunk +66 lines, -0 lines 0 comments Download
A + net/filter/source_stream.cc View 1 2 3 4 5 6 7 1 chunk +8 lines, -9 lines 0 comments Download
A net/filter/source_stream_type_list.h View 1 chunk +11 lines, -0 lines 0 comments Download
M net/net.gypi View 1 2 3 4 5 6 7 8 9 10 2 chunks +8 lines, -0 lines 0 comments Download

Messages

Total messages: 86 (44 generated)
xunjieli
4 years, 4 months ago (2016-08-16 22:35:22 UTC) #4
Randy Smith (Not in Mondays)
Which PS in the original CL does this CL correspond to? I want to figure ...
4 years, 4 months ago (2016-08-17 15:56:33 UTC) #10
xunjieli
On 2016/08/17 15:56:33, Randy Smith - Not in Fridays wrote: > Which PS in the ...
4 years, 4 months ago (2016-08-17 15:59:55 UTC) #11
Randy Smith (Not in Mondays)
On 2016/08/17 15:59:55, xunjieli wrote: > On 2016/08/17 15:56:33, Randy Smith - Not in Fridays ...
4 years, 4 months ago (2016-08-17 16:08:55 UTC) #12
xunjieli
On 2016/08/17 16:08:55, Randy Smith - Not in Fridays wrote: > On 2016/08/17 15:59:55, xunjieli ...
4 years, 4 months ago (2016-08-17 17:00:18 UTC) #16
mmenke
Just nits. Haven't looked at tests. https://codereview.chromium.org/2251853002/diff/60001/net/filter/filter_source_stream.cc File net/filter/filter_source_stream.cc (right): https://codereview.chromium.org/2251853002/diff/60001/net/filter/filter_source_stream.cc#newcode35 net/filter/filter_source_stream.cc:35: const CompletionCallback& callback) ...
4 years, 4 months ago (2016-08-17 19:01:56 UTC) #17
mmenke
https://codereview.chromium.org/2251853002/diff/60001/net/filter/mock_source_stream.cc File net/filter/mock_source_stream.cc (right): https://codereview.chromium.org/2251853002/diff/60001/net/filter/mock_source_stream.cc#newcode37 net/filter/mock_source_stream.cc:37: DCHECK_GE(buffer_size, r.len); On 2016/08/17 19:01:56, mmenke wrote: > May ...
4 years, 4 months ago (2016-08-17 19:05:42 UTC) #18
mmenke
4 years, 4 months ago (2016-08-17 19:05:43 UTC) #19
xunjieli
Thanks for the review! very helpful. thank you. https://codereview.chromium.org/2251853002/diff/60001/net/filter/filter_source_stream.cc File net/filter/filter_source_stream.cc (right): https://codereview.chromium.org/2251853002/diff/60001/net/filter/filter_source_stream.cc#newcode35 net/filter/filter_source_stream.cc:35: const ...
4 years, 4 months ago (2016-08-17 20:00:20 UTC) #22
mmenke
Trying to bisect a major perf regression that I can reproduce only after reviewing code ...
4 years, 4 months ago (2016-08-18 16:18:43 UTC) #29
mmenke
https://codereview.chromium.org/2251853002/diff/140001/net/filter/filter_source_stream_unittest.cc File net/filter/filter_source_stream_unittest.cc (right): https://codereview.chromium.org/2251853002/diff/140001/net/filter/filter_source_stream_unittest.cc#newcode120 net/filter/filter_source_stream_unittest.cc:120: }; On 2016/08/18 16:18:42, mmenke wrote: > Suggestions: > ...
4 years, 4 months ago (2016-08-18 16:59:21 UTC) #30
xunjieli
Thanks for being so incredibly patient with this very unpolished code!! I have uploaded a ...
4 years, 4 months ago (2016-08-19 14:31:40 UTC) #34
Randy Smith (Not in Mondays)
Despite the number of comments, this looks pretty good-most of my comments are nits. https://codereview.chromium.org/2251853002/diff/60001/net/docs/filter.md ...
4 years, 4 months ago (2016-08-22 22:37:17 UTC) #35
mmenke
https://codereview.chromium.org/2251853002/diff/200001/net/filter/mock_source_stream.cc File net/filter/mock_source_stream.cc (right): https://codereview.chromium.org/2251853002/diff/200001/net/filter/mock_source_stream.cc#newcode26 net/filter/mock_source_stream.cc:26: DCHECK(!results_.empty()); On 2016/08/22 22:37:16, Randy Smith - Not in ...
4 years, 4 months ago (2016-08-22 22:46:42 UTC) #36
Randy Smith (Not in Mondays)
On 2016/08/22 22:46:42, mmenke wrote: > https://codereview.chromium.org/2251853002/diff/200001/net/filter/mock_source_stream.cc > File net/filter/mock_source_stream.cc (right): > > https://codereview.chromium.org/2251853002/diff/200001/net/filter/mock_source_stream.cc#newcode26 > ...
4 years, 4 months ago (2016-08-23 17:43:15 UTC) #37
mmenke
On 2016/08/23 17:43:15, Randy Smith - Not in Fridays wrote: > On 2016/08/22 22:46:42, mmenke ...
4 years, 4 months ago (2016-08-23 17:45:01 UTC) #38
mmenke
On 2016/08/23 17:45:01, mmenke wrote: > On 2016/08/23 17:43:15, Randy Smith - Not in Fridays ...
4 years, 4 months ago (2016-08-23 17:45:55 UTC) #39
xunjieli
Thanks a lot for the review! I uploaded a new patch. Additionally I've changed OrderedTypeStringList() ...
4 years, 3 months ago (2016-08-29 16:25:29 UTC) #40
mmenke
https://codereview.chromium.org/2251853002/diff/200001/net/filter/filter_source_stream.h File net/filter/filter_source_stream.h (right): https://codereview.chromium.org/2251853002/diff/200001/net/filter/filter_source_stream.h#newcode71 net/filter/filter_source_stream.h:71: // input data from |upstream|. On 2016/08/29 16:25:28, xunjieli(OOO-8.21-8.26) ...
4 years, 3 months ago (2016-08-29 16:41:03 UTC) #41
xunjieli
https://codereview.chromium.org/2251853002/diff/200001/net/filter/filter_source_stream.h File net/filter/filter_source_stream.h (right): https://codereview.chromium.org/2251853002/diff/200001/net/filter/filter_source_stream.h#newcode71 net/filter/filter_source_stream.h:71: // input data from |upstream|. On 2016/08/29 16:41:03, mmenke ...
4 years, 3 months ago (2016-08-30 17:27:21 UTC) #46
Randy Smith (Not in Mondays)
LGTM; everything below are suggestions. https://codereview.chromium.org/2251853002/diff/240001/net/docs/filter.md File net/docs/filter.md (right): https://codereview.chromium.org/2251853002/diff/240001/net/docs/filter.md#newcode14 net/docs/filter.md:14: always flows from upstream ...
4 years, 3 months ago (2016-08-31 19:22:45 UTC) #47
mmenke
https://codereview.chromium.org/2251853002/diff/240001/net/filter/filter_source_stream.cc File net/filter/filter_source_stream.cc (right): https://codereview.chromium.org/2251853002/diff/240001/net/filter/filter_source_stream.cc#newcode140 net/filter/filter_source_stream.cc:140: if (bytes_output == OK && !upstream_end_reached_ && NeedMoreData()) I ...
4 years, 3 months ago (2016-08-31 20:52:29 UTC) #48
xunjieli
https://codereview.chromium.org/2251853002/diff/240001/net/docs/filter.md File net/docs/filter.md (right): https://codereview.chromium.org/2251853002/diff/240001/net/docs/filter.md#newcode14 net/docs/filter.md:14: always flows from upstream to downstream: On 2016/08/31 19:22:44, ...
4 years, 3 months ago (2016-09-01 21:26:59 UTC) #50
mmenke
https://codereview.chromium.org/2251853002/diff/240001/net/filter/filter_source_stream.cc File net/filter/filter_source_stream.cc (right): https://codereview.chromium.org/2251853002/diff/240001/net/filter/filter_source_stream.cc#newcode158 net/filter/filter_source_stream.cc:158: return !upstream_end_reached_; On 2016/09/01 21:26:59, xunjieli wrote: > On ...
4 years, 3 months ago (2016-09-01 21:54:46 UTC) #53
xunjieli
Randy: any thought on the new design? I tried incorporating this in the larger CL. ...
4 years, 3 months ago (2016-09-07 14:24:18 UTC) #56
Randy Smith (Not in Mondays)
On 2016/09/07 14:24:18, xunjieli wrote: > Randy: any thought on the new design? > I ...
4 years, 3 months ago (2016-09-07 14:48:26 UTC) #57
mmenke
On 2016/09/07 14:48:26, Randy Smith - Not in Fridays wrote: > On 2016/09/07 14:24:18, xunjieli ...
4 years, 3 months ago (2016-09-07 15:01:10 UTC) #58
Randy Smith (Not in Mondays)
So thank you for https://codereview.chromium.org/2316053003/! Unfortunately, I'm still having the feeling I had this afternoon ...
4 years, 3 months ago (2016-09-08 00:03:32 UTC) #59
xunjieli
Matt and Randy PTAL at PS#11. I talked to Randy offline. I agree with Randy ...
4 years, 3 months ago (2016-09-08 16:12:09 UTC) #61
mmenke
On 2016/09/08 16:12:09, xunjieli wrote: > Matt and Randy PTAL at PS#11. > > I ...
4 years, 3 months ago (2016-09-08 17:12:45 UTC) #64
Randy Smith (Not in Mondays)
So this still LGTM modulo the various comment and DCHECK suggestions I made. Matt, one ...
4 years, 3 months ago (2016-09-08 18:57:41 UTC) #67
xunjieli
Matt, do you want to take a look before I CQ this? https://codereview.chromium.org/2251853002/diff/320001/net/filter/filter_source_stream.cc File net/filter/filter_source_stream.cc ...
4 years, 3 months ago (2016-09-08 19:11:43 UTC) #68
xunjieli
On 2016/09/08 19:11:43, xunjieli wrote: > Matt, do you want to take a look before ...
4 years, 3 months ago (2016-09-09 19:54:02 UTC) #73
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2251853002/340001
4 years, 3 months ago (2016-09-09 19:55:03 UTC) #76
commit-bot: I haz the power
Committed patchset #12 (id:340001)
4 years, 3 months ago (2016-09-09 21:33:35 UTC) #78
commit-bot: I haz the power
Patchset 12 (id:??) landed as https://crrev.com/95ea25f5dd7e255a01efd1b10bd9250cbc3c0d69 Cr-Commit-Position: refs/heads/master@{#417716}
4 years, 3 months ago (2016-09-09 21:36:53 UTC) #80
Randy Smith (Not in Mondays)
My apologies for coming back to this CL after landing, but I think we should ...
4 years, 3 months ago (2016-09-12 21:05:03 UTC) #81
mmenke
On 2016/09/12 21:05:03, Randy Smith - Not in Fridays wrote: > My apologies for coming ...
4 years, 3 months ago (2016-09-12 21:09:54 UTC) #82
Randy Smith (Not in Mondays)
On 2016/09/12 21:09:54, mmenke wrote: > On 2016/09/12 21:05:03, Randy Smith - Not in Fridays ...
4 years, 3 months ago (2016-09-12 21:13:25 UTC) #83
xunjieli
https://codereview.chromium.org/2251853002/diff/340001/net/filter/filter_source_stream.h File net/filter/filter_source_stream.h (right): https://codereview.chromium.org/2251853002/diff/340001/net/filter/filter_source_stream.h#newcode69 net/filter/filter_source_stream.h:69: // FilterData() will be repeatedly invoked with the same ...
4 years, 3 months ago (2016-09-13 19:45:25 UTC) #84
mmenke
https://codereview.chromium.org/2251853002/diff/340001/net/filter/filter_source_stream.h File net/filter/filter_source_stream.h (right): https://codereview.chromium.org/2251853002/diff/340001/net/filter/filter_source_stream.h#newcode69 net/filter/filter_source_stream.h:69: // FilterData() will be repeatedly invoked with the same ...
4 years, 3 months ago (2016-09-13 19:50:57 UTC) #85
xunjieli
4 years, 3 months ago (2016-09-13 19:54:59 UTC) #86
Message was sent while issue was closed.
https://codereview.chromium.org/2251853002/diff/340001/net/filter/filter_sour...
File net/filter/filter_source_stream.h (right):

https://codereview.chromium.org/2251853002/diff/340001/net/filter/filter_sour...
net/filter/filter_source_stream.h:69: // FilterData() will be repeatedly invoked
with the same |input_buffer| until
On 2016/09/13 19:50:57, mmenke wrote:
> On 2016/09/13 19:45:24, xunjieli wrote:
> > On 2016/09/12 21:05:03, Randy Smith - Not in Fridays wrote:
> > > Could we remove the phrase "with the same |input_buffer|"?  That seems
like
> > > something that we don't want the subclass to be counting on.  All we want
to
> > > guarantee is that we (superclass) won't lose any data they (subclass)
> haven't
> > > drained.
> > > 
> > I added this comment per an earlier review commment. I agree this is an
> > implementation detail, which probably shouldn't be in the method
> documentation.
> > However, I feel that this is an important detail of the limitation of the
> > current design. I will keep it unless you feel strongly about removing it.
> > 
> > > (Suggestion: Matt raised the possibility of an interface where instead of
> > > passing a DrainableIOBuffer, we pass an IOBuffer & size, so it's a pure
> input
> > > argument rather than an input/output argument.  This would also have the
> > benefit
> > > of not allowing the possibility of the subclass assuming that we're
passing
> > the
> > > same IOBuffer, since we wouldn't be--we'd rewrap on each call.  I like
this
> > > idea, but not with a deep passion, so just a suggestion.)
> > 
> > Acknowledged. I will keep this as it is. I like the DrainableIOBuffer so
> > subclasses can have multiple routines to consume bytes from the buffer
without
> > keeping track of the offsets themselves. You can see gzip_source_stream.cc
for
> > an example. I will keep this as it is.
> 
> Don't think you understand the comment - the parent class would track the
> offset, we'd just remove the weird contract that we always return the same
> drainable IO buffer, which the subclass is responsible for managing itself.
> 
> i.e, we'd do something like:
> 
> FilterData(..., in_buffer, in_buffer_size, &consumed_bytes);
> which then reads part of the data and sets consumed_bytes to if (say it's set
to
> 8).
> 
> Then the next call to FilterData would return another IOBuffer, with 8 fewer
> bytes in it (i.e., the parent class would completely manage the
> DrainableIOBuffer).

Thanks for the follow-up. I will do that in a separate CL.

Powered by Google App Engine
This is Rietveld 408576698