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

Issue 6815012: Only make Range requests when the desired range doesn't cover the whole file. (Closed)

Created:
9 years, 8 months ago by acolwell GONE FROM CHROMIUM
Modified:
9 years, 6 months ago
CC:
chromium-reviews
Visibility:
Public.

Description

Fix BufferedResourceLoader so it only makes Range requests when a subset of the file is needed. BUG=74975 TEST=none Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=82061

Patch Set 1 : Fix unit tests #

Total comments: 11

Patch Set 2 : Fix CR nits and added unit test for lying server case. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+111 lines, -50 lines) Patch
M webkit/glue/media/buffered_data_source.cc View 1 4 chunks +12 lines, -7 lines 0 comments Download
M webkit/glue/media/buffered_data_source_unittest.cc View 1 7 chunks +37 lines, -17 lines 0 comments Download
M webkit/glue/media/buffered_resource_loader.h View 1 3 chunks +8 lines, -5 lines 0 comments Download
M webkit/glue/media/buffered_resource_loader.cc View 1 10 chunks +34 lines, -14 lines 0 comments Download
M webkit/glue/media/buffered_resource_loader_unittest.cc View 5 chunks +20 lines, -7 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
acolwell GONE FROM CHROMIUM
http://codereview.chromium.org/6815012/diff/2001/webkit/glue/media/buffered_data_source.cc File webkit/glue/media/buffered_data_source.cc (right): http://codereview.chromium.org/6815012/diff/2001/webkit/glue/media/buffered_data_source.cc#newcode575 webkit/glue/media/buffered_data_source.cc:575: if (error == net::OK) { loader_->partial_response() is not needed ...
9 years, 8 months ago (2011-04-07 22:56:48 UTC) #1
Ami GONE FROM CHROMIUM
http://codereview.chromium.org/6815012/diff/2001/webkit/glue/media/buffered_data_source.cc File webkit/glue/media/buffered_data_source.cc (right): http://codereview.chromium.org/6815012/diff/2001/webkit/glue/media/buffered_data_source.cc#newcode638 webkit/glue/media/buffered_data_source.cc:638: host()->SetTotalBytes(total_bytes_); Do you not need to check that host()!=NULL? ...
9 years, 8 months ago (2011-04-08 03:02:10 UTC) #2
scherkus (not reviewing)
also wondering about the "lying server" case but in instances like that I'd like to ...
9 years, 8 months ago (2011-04-11 17:41:54 UTC) #3
scherkus (not reviewing)
also wondering about the "lying server" case but in instances like that I'd like to ...
9 years, 8 months ago (2011-04-11 17:41:55 UTC) #4
acolwell GONE FROM CHROMIUM
9 years, 8 months ago (2011-04-18 22:09:56 UTC) #5
http://codereview.chromium.org/6815012/diff/2001/webkit/glue/media/buffered_d...
File webkit/glue/media/buffered_data_source.cc (right):

http://codereview.chromium.org/6815012/diff/2001/webkit/glue/media/buffered_d...
webkit/glue/media/buffered_data_source.cc:638:
host()->SetTotalBytes(total_bytes_);
On 2011/04/08 03:02:10, Ami Fischman wrote:
> Do you not need to check that host()!=NULL?

Done.

http://codereview.chromium.org/6815012/diff/2001/webkit/glue/media/buffered_d...
File webkit/glue/media/buffered_data_source_unittest.cc (right):

http://codereview.chromium.org/6815012/diff/2001/webkit/glue/media/buffered_d...
webkit/glue/media/buffered_data_source_unittest.cc:169: ON_CALL(*loader_,
range_supported())
On 2011/04/08 03:02:10, Ami Fischman wrote:
> Is there a test here for the case of a lying server (claims to support range
but
> returns 200 instead of 206)?

Done. Added ServerLiesAboutRangeSupport test to simulate this situation.

http://codereview.chromium.org/6815012/diff/2001/webkit/glue/media/buffered_r...
File webkit/glue/media/buffered_resource_loader.cc (right):

http://codereview.chromium.org/6815012/diff/2001/webkit/glue/media/buffered_r...
webkit/glue/media/buffered_resource_loader.cc:385: // If we didn't know the
|instance_size_| we do now.
On 2011/04/11 17:41:55, scherkus wrote:
> pedantic nit: the rest of this file seems to put if-statement comments before
> the if as opposed to inside the if

Done.

http://codereview.chromium.org/6815012/diff/2001/webkit/glue/media/buffered_r...
webkit/glue/media/buffered_resource_loader.cc:649: last_byte_position_ ==
kPositionNotSpecified);
On 2011/04/11 17:41:55, scherkus wrote:
> is it worth checking last_byte_position_ == content_length_ ?
> 
> if content_length_ is still kPositionNotSpecified, then we're good
> if content_length_ is properly set, then we're also good (however I do find
this
> extremely unintuitive so perhaps better to not handle this case)

I don't think this is worth checking. It would cause inconsistent behavior if
the the range was passed in the constructor and then a Read() for the same range
was issued. In the first request, it would use the range because we don't know
how long the file is yet. In the second request the range would not be used
because the file size is known. I can see this causing confusion at some point
down the line.

I suppose I could change the name of the method to something a little more
specific like IsUnspecifiedOrZeroToEndRange(). That seems a little long winded,
but more accurate.

http://codereview.chromium.org/6815012/diff/2001/webkit/glue/media/buffered_r...
File webkit/glue/media/buffered_resource_loader.h (right):

http://codereview.chromium.org/6815012/diff/2001/webkit/glue/media/buffered_r...
webkit/glue/media/buffered_resource_loader.h:211: // whole file (ie. 0-).
On 2011/04/08 03:02:10, Ami Fischman wrote:
> s/)/ or 0-max)/
This method doesn't return true if 0-max is specified so I don't think this is
comment applies. I did update the comment to be more precise though and indicate
that it only returns true for an unspecified range or the 0- range.

Powered by Google App Engine
This is Rietveld 408576698