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

Unified Diff: webkit/media/buffered_data_source.cc

Issue 10698139: Write file:// tests for BufferedDataSource and fix some bugs as a result. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: what the Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/media/buffered_data_source.h ('k') | webkit/media/buffered_data_source_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/media/buffered_data_source.cc
diff --git a/webkit/media/buffered_data_source.cc b/webkit/media/buffered_data_source.cc
index 737535026a0a77af9d573b16e19e8fb5184f4977..24d9a57bc4ad72cbcffe78d1d83374d86879611c 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
« no previous file with comments | « webkit/media/buffered_data_source.h ('k') | webkit/media/buffered_data_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698