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

Unified Diff: media/blink/multibuffer_data_source.cc

Issue 2437273002: fix multibuffer "is loading" (Closed)
Patch Set: Created 4 years, 2 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/blink/multibuffer_data_source.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/blink/multibuffer_data_source.cc
diff --git a/media/blink/multibuffer_data_source.cc b/media/blink/multibuffer_data_source.cc
index 1390c69c36e78319d6f4063678258090b72bc099..ce450c96bce12b6c93e885e4fb8a49b5d938396e 100644
--- a/media/blink/multibuffer_data_source.cc
+++ b/media/blink/multibuffer_data_source.cc
@@ -505,6 +505,14 @@ void MultibufferDataSource::StartCallback() {
render_task_runner_->PostTask(
FROM_HERE, base::Bind(base::ResetAndReturn(&init_cb_), success));
+ // When we tell our clients that we're loading below, it's possible that
+ // the entire file is already cashed. If that's true, then we won't get
+ // any progress callbacks later, so we'll never tell the client that we
+ // stopped loading. Post a task to make sure that we check the loading
+ // state at least once.
+ render_task_runner_->PostTask(
+ FROM_HERE, base::Bind(&MultibufferDataSource::UpdateLoadingState,
+ weak_factory_.GetWeakPtr()));
// Even if data is cached, say that we're loading at this point for
// compatibility.
UpdateLoadingState_Locked(true);
@@ -552,6 +560,12 @@ void MultibufferDataSource::UpdateLoadingState_Locked(bool force_loading) {
}
}
+void MultibufferDataSource::UpdateLoadingState() {
+ DCHECK(render_task_runner_->BelongsToCurrentThread());
+ base::AutoLock auto_lock(lock_);
+ UpdateLoadingState_Locked(false);
+}
+
void MultibufferDataSource::UpdateBufferSizes() {
DVLOG(1) << __func__;
if (!reader_)
« no previous file with comments | « media/blink/multibuffer_data_source.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698