diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-11 02:36:02 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-11 02:36:02 +0000 |
commit | ef35c45ebac76746e776eec9e79c30821d70853f (patch) | |
tree | 21b021d6ac3be879bf108c33e2a8904dabff6567 /webkit/media/buffered_data_source.cc | |
parent | 65b05e976298fd31e6d56f50ea0409677ee27e9e (diff) | |
download | chromium_src-ef35c45ebac76746e776eec9e79c30821d70853f.zip chromium_src-ef35c45ebac76746e776eec9e79c30821d70853f.tar.gz chromium_src-ef35c45ebac76746e776eec9e79c30821d70853f.tar.bz2 |
Write file:// tests for BufferedDataSource and fix some bugs as a result.
It turns out we had two bugs in our non-HTTP code path:
1) Connection retries used the wrong start callback, which caused the loader to never get created
2) The start position for non-HTTP resources is kPositionNotSpecified, which caused us to report [-1, file size) instead of [0, file size) for buffered status
BUG=none
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10698139
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146035 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/media/buffered_data_source.cc')
-rw-r--r-- | webkit/media/buffered_data_source.cc | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/webkit/media/buffered_data_source.cc b/webkit/media/buffered_data_source.cc index 7375350..24d9a57 100644 --- a/webkit/media/buffered_data_source.cc +++ b/webkit/media/buffered_data_source.cc @@ -40,7 +40,7 @@ BufferedDataSource::BufferedDataSource( const DownloadingCB& downloading_cb) : cors_mode_(BufferedResourceLoader::kUnspecified), total_bytes_(kPositionNotSpecified), - buffered_bytes_(0), + assume_fully_buffered_(false), streaming_(false), frame_(frame), read_size_(0), @@ -288,7 +288,7 @@ void BufferedDataSource::RestartLoadingTask() { frame_); } else { loader_->Start( - base::Bind(&BufferedDataSource::NonHttpInitialStartCallback, this), + base::Bind(&BufferedDataSource::PartialReadStartCallback, this), base::Bind(&NonHttpLoadingStateChangedCallback), base::Bind(&NonHttpProgressCallback), frame_); @@ -452,7 +452,7 @@ void BufferedDataSource::NonHttpInitialStartCallback( if (success) { total_bytes_ = instance_size; - buffered_bytes_ = total_bytes_; + assume_fully_buffered_ = true; } else { loader_->Stop(); } @@ -607,11 +607,13 @@ void BufferedDataSource::UpdateHostState_Locked() { if (!host()) return; - if (total_bytes_ != kPositionNotSpecified) - host()->SetTotalBytes(total_bytes_); - int64 start = loader_->first_byte_position(); - if (buffered_bytes_ > start) - host()->AddBufferedByteRange(start, buffered_bytes_); + if (total_bytes_ == kPositionNotSpecified) + return; + + host()->SetTotalBytes(total_bytes_); + + if (assume_fully_buffered_) + host()->AddBufferedByteRange(0, total_bytes_); } } // namespace webkit_media |