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

Unified Diff: webkit/glue/media/buffered_data_source.cc

Issue 5603004: Use stopped_on_render_loop_ to prevent further work from executing in BufferedDataSource. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: Created 10 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
« no previous file with comments | « webkit/glue/media/buffered_data_source.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/media/buffered_data_source.cc
diff --git a/webkit/glue/media/buffered_data_source.cc b/webkit/glue/media/buffered_data_source.cc
index a82ce87f070c4ff1fe1e6676bbd8c2ed88c3cf82..6183e67b01b54f51c0125c8ece06370bdf41a80d 100644
--- a/webkit/glue/media/buffered_data_source.cc
+++ b/webkit/glue/media/buffered_data_source.cc
@@ -738,8 +738,8 @@ void BufferedDataSource::Abort() {
// If we are told to abort, immediately return from any pending read
// with an error.
if (read_callback_.get()) {
- AutoLock auto_lock(lock_);
- DoneRead_Locked(net::ERR_FAILED);
+ AutoLock auto_lock(lock_);
+ DoneRead_Locked(net::ERR_FAILED);
}
CleanupTask();
@@ -751,7 +751,8 @@ void BufferedDataSource::Abort() {
void BufferedDataSource::InitializeTask() {
DCHECK(MessageLoop::current() == render_loop_);
DCHECK(!loader_.get());
- DCHECK(!stopped_on_render_loop_);
+ if (stopped_on_render_loop_)
+ return;
// Kick starts the watch dog task that will handle connection timeout.
// We run the watch dog 2 times faster the actual timeout so as to catch
@@ -788,11 +789,6 @@ void BufferedDataSource::ReadTask(
int64 position, int read_size, uint8* buffer,
media::DataSource::ReadCallback* read_callback) {
DCHECK(MessageLoop::current() == render_loop_);
-
- // If CleanupTask() was executed we should return immediately. We check this
- // variable to prevent doing any actual work after clean up was done. We do
- // not check |stop_signal_received_| because anything use of it has to be
- // within |lock_| which is not desirable.
if (stopped_on_render_loop_)
return;
@@ -813,8 +809,6 @@ void BufferedDataSource::ReadTask(
void BufferedDataSource::CleanupTask() {
DCHECK(MessageLoop::current() == render_loop_);
-
- // If we have already stopped, do nothing.
if (stopped_on_render_loop_)
return;
@@ -839,13 +833,6 @@ void BufferedDataSource::CleanupTask() {
void BufferedDataSource::RestartLoadingTask() {
DCHECK(MessageLoop::current() == render_loop_);
-
- // This variable is set in CleanupTask(). We check this and do an early
- // return. The sequence of actions which enable this conditions is:
- // 1. Stop() is called from the pipeline.
- // 2. ReadCallback() is called from the resource loader.
- // 3. CleanupTask() is executed.
- // 4. RestartLoadingTask() is executed.
if (stopped_on_render_loop_)
return;
@@ -863,7 +850,8 @@ void BufferedDataSource::RestartLoadingTask() {
void BufferedDataSource::WatchDogTask() {
DCHECK(MessageLoop::current() == render_loop_);
- DCHECK(!stopped_on_render_loop_);
+ if (stopped_on_render_loop_)
+ return;
// We only care if there is an active read request.
if (!read_callback_.get())
« no previous file with comments | « webkit/glue/media/buffered_data_source.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698