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

Unified Diff: media/blink/multibuffer_data_source.cc

Issue 1509663003: make multibuffer work with layout tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@media_cache.integrate3
Patch Set: Created 5 years 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
Index: media/blink/multibuffer_data_source.cc
diff --git a/media/blink/multibuffer_data_source.cc b/media/blink/multibuffer_data_source.cc
index 1b01b0813df5ce8d731fb2ee48af6543a8c347c6..e400035fb42b8cfad7e71b5fce584203038b85cb 100644
--- a/media/blink/multibuffer_data_source.cc
+++ b/media/blink/multibuffer_data_source.cc
@@ -175,7 +175,6 @@ void MultibufferDataSource::Initialize(const InitializeCB& init_cb) {
reader_->Wait(1,
base::Bind(&MultibufferDataSource::StartCallback, weak_ptr_));
}
- UpdateLoadingState();
}
void MultibufferDataSource::OnRedirect(
@@ -229,6 +228,7 @@ void MultibufferDataSource::OnRedirect(
}
void MultibufferDataSource::SetPreload(Preload preload) {
+ DVLOG(1) << __FUNCTION__ << "(" << preload << ")";
DCHECK(render_task_runner_->BelongsToCurrentThread());
preload_ = preload;
UpdateBufferSizes();
@@ -392,7 +392,7 @@ void MultibufferDataSource::ReadTask() {
} else {
reader_->Wait(1, base::Bind(&MultibufferDataSource::ReadTask,
weak_factory_.GetWeakPtr()));
- UpdateLoadingState();
+ UpdateLoadingState(false);
}
}
@@ -475,12 +475,16 @@ void MultibufferDataSource::StartCallback() {
url_data_->range_supported());
}
- UpdateLoadingState();
render_task_runner_->PostTask(
FROM_HERE, base::Bind(base::ResetAndReturn(&init_cb_), success));
+
+ // Even if data is cached, say that we're loading at this point for
+ // compatibility.
+ UpdateLoadingState(true);
}
void MultibufferDataSource::ProgressCallback(int64 begin, int64 end) {
+ DVLOG(1) << __FUNCTION__ << "(" << begin << ", " << end << ")";
DCHECK(render_task_runner_->BelongsToCurrentThread());
if (assume_fully_buffered())
@@ -496,13 +500,17 @@ void MultibufferDataSource::ProgressCallback(int64 begin, int64 end) {
host_->AddBufferedByteRange(begin, end);
}
- UpdateLoadingState();
+ UpdateLoadingState(false);
}
-void MultibufferDataSource::UpdateLoadingState() {
+void MultibufferDataSource::UpdateLoadingState(bool force_loading) {
+ DVLOG(1) << __FUNCTION__;
+ if (assume_fully_buffered())
+ return;
// Update loading state.
- if ((!!reader_ && reader_->IsLoading()) != loading_) {
- loading_ = !loading_;
+ bool is_loading = !!reader_ && reader_->IsLoading();
+ if (force_loading || is_loading != loading_) {
+ loading_ = is_loading || force_loading;
liberato (no reviews please) 2015/12/08 21:59:33 if the reader reports !loading, how does loading_
hubbe 2015/12/08 22:25:59 Updated comment for |loading_|. loading_ will be s
if (!loading_ && cancel_on_defer_) {
liberato (no reviews please) 2015/12/08 21:59:33 this can happen on force_loading that wouldn't hav
hubbe 2015/12/08 22:25:59 if force_loading is true, then loading_ will be tr
reader_.reset(nullptr);
@@ -514,6 +522,7 @@ void MultibufferDataSource::UpdateLoadingState() {
}
void MultibufferDataSource::UpdateBufferSizes() {
+ DVLOG(1) << __FUNCTION__;
if (!reader_)
return;

Powered by Google App Engine
This is Rietveld 408576698