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

Unified Diff: webkit/media/buffered_data_source.cc

Issue 9113023: Fire canplaythrough as soon as download defers to fix autoplay (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT Created 8 years, 11 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 | « media/base/download_rate_monitor_unittest.cc ('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 20b9b7a372eae5aa583a7937567c394be84d0847..48aa3ccc48dfe593060939f4a3f667ad228fee01 100644
--- a/webkit/media/buffered_data_source.cc
+++ b/webkit/media/buffered_data_source.cc
@@ -597,11 +597,10 @@ void BufferedDataSource::ReadCallback(int error) {
// before. Update the total size so Read()s past the end of the file will
// fail like they would if we had known the file size at the beginning.
total_bytes_ = loader_->instance_size();
+ if (total_bytes_ != kPositionNotSpecified)
+ buffered_bytes_ = total_bytes_;
- if (host() && total_bytes_ != kPositionNotSpecified) {
- host()->SetTotalBytes(total_bytes_);
- host()->SetBufferedBytes(total_bytes_);
- }
+ UpdateHostState_Locked();
}
DoneRead_Locked(error);
}
@@ -634,15 +633,10 @@ void BufferedDataSource::NetworkEventCallback() {
if (stop_signal_received_)
return;
- if (is_downloading_data != is_downloading_data_) {
- is_downloading_data_ = is_downloading_data;
- if (host())
- host()->SetNetworkActivity(is_downloading_data);
- }
-
+ is_downloading_data_ = is_downloading_data;
buffered_bytes_ = buffered_position + 1;
- if (host())
- host()->SetBufferedBytes(buffered_bytes_);
+
+ UpdateHostState_Locked();
}
void BufferedDataSource::UpdateHostState_Locked() {
@@ -654,6 +648,7 @@ void BufferedDataSource::UpdateHostState_Locked() {
if (total_bytes_ != kPositionNotSpecified)
host()->SetTotalBytes(total_bytes_);
+ host()->SetNetworkActivity(is_downloading_data_);
host()->SetBufferedBytes(buffered_bytes_);
}
« no previous file with comments | « media/base/download_rate_monitor_unittest.cc ('k') | webkit/media/buffered_data_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698