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

Unified Diff: webkit/media/buffered_data_source.cc

Issue 10700125: Fold RestartLoadingTask() into ReadCallback() as the method is called on the render thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase tot 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_resource_loader.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 1203f664a39177c12ab13ddb9123c157f6cbe31e..c91504e656e6de5d459d7c57b4962ed1a364d507 100644
--- a/webkit/media/buffered_data_source.cc
+++ b/webkit/media/buffered_data_source.cc
@@ -254,27 +254,6 @@ void BufferedDataSource::CleanupTask() {
read_buffer_ = 0;
}
-void BufferedDataSource::RestartLoadingTask() {
- DCHECK(MessageLoop::current() == render_loop_);
- if (stopped_on_render_loop_)
- return;
-
- {
- // If there's no outstanding read then return early.
- base::AutoLock auto_lock(lock_);
- if (read_cb_.is_null())
- return;
- }
-
- // Start reading from where we last left off until the end of the resource.
- loader_.reset(CreateResourceLoader(last_read_start_, kPositionNotSpecified));
- loader_->Start(
- base::Bind(&BufferedDataSource::PartialReadStartCallback, this),
- base::Bind(&BufferedDataSource::LoadingStateChangedCallback, this),
- base::Bind(&BufferedDataSource::ProgressCallback, this),
- frame_);
-}
-
void BufferedDataSource::SetPlaybackRateTask(float playback_rate) {
DCHECK(MessageLoop::current() == render_loop_);
DCHECK(loader_.get());
@@ -437,8 +416,16 @@ void BufferedDataSource::ReadCallback(
if (status == BufferedResourceLoader::kCacheMiss &&
cache_miss_retries_left_ > 0) {
cache_miss_retries_left_--;
- render_loop_->PostTask(FROM_HERE,
- base::Bind(&BufferedDataSource::RestartLoadingTask, this));
+
+ // Recreate a loader starting from where we last left off until the
+ // end of the resource.
+ loader_.reset(CreateResourceLoader(
+ last_read_start_, kPositionNotSpecified));
+ loader_->Start(
+ base::Bind(&BufferedDataSource::PartialReadStartCallback, this),
+ base::Bind(&BufferedDataSource::LoadingStateChangedCallback, this),
+ base::Bind(&BufferedDataSource::ProgressCallback, this),
+ frame_);
return;
}
« no previous file with comments | « webkit/media/buffered_data_source.h ('k') | webkit/media/buffered_resource_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698