From 21b3d203094067a4c5f55e627ceb6bd40749fd02 Mon Sep 17 00:00:00 2001 From: "fischman@chromium.org" Date: Fri, 1 Apr 2011 15:42:38 +0000 Subject: Fix deadlock during player shutdown when a Seek() and an Abort() are racing. BUG=74031 TEST=trybots, repro site from bug report, and a layouttest which I probably won't be able to submit since it requires a large (14MB) video file to repro, and webkit's bugzilla assplodes on patches over 10MB. Review URL: http://codereview.chromium.org/6690065 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80163 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/glue/media/buffered_data_source.cc | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'webkit/glue') diff --git a/webkit/glue/media/buffered_data_source.cc b/webkit/glue/media/buffered_data_source.cc index 2622255..d0d42aa 100644 --- a/webkit/glue/media/buffered_data_source.cc +++ b/webkit/glue/media/buffered_data_source.cc @@ -200,15 +200,6 @@ bool BufferedDataSource::HasSingleOrigin() { void BufferedDataSource::Abort() { DCHECK(MessageLoop::current() == render_loop_); - { - base::AutoLock auto_lock(lock_); - - // If we are told to abort, immediately return from any pending read - // with an error. - if (read_callback_.get()) - DoneRead_Locked(net::ERR_FAILED); - } - CleanupTask(); frame_ = NULL; } @@ -282,7 +273,13 @@ void BufferedDataSource::CleanupTask() { if (stopped_on_render_loop_) return; - read_callback_.reset(); + // Signal that stop task has finished execution. + // NOTE: it's vital that this be set under lock, as that's how Read() tests + // before registering a new |read_callback_| (which is cleared below). + stopped_on_render_loop_ = true; + + if (read_callback_.get()) + DoneRead_Locked(net::ERR_FAILED); } // Stop the watch dog. @@ -298,9 +295,6 @@ void BufferedDataSource::CleanupTask() { read_buffer_ = 0; read_submitted_time_ = base::Time(); read_attempts_ = 0; - - // Signal that stop task has finished execution. - stopped_on_render_loop_ = true; } void BufferedDataSource::RestartLoadingTask() { -- cgit v1.1