diff options
author | fischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-09 18:36:43 +0000 |
---|---|---|
committer | fischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-09 18:36:43 +0000 |
commit | 77ed5014b883ef7e170be208f5af6a5cb1e5a8c9 (patch) | |
tree | ed2dea9543ed5fd0ad96b52fa0416ccf28e794ff /content | |
parent | 64e3f46610324bfe8d7e5bd2f833cf569d87c9a9 (diff) | |
download | chromium_src-77ed5014b883ef7e170be208f5af6a5cb1e5a8c9.zip chromium_src-77ed5014b883ef7e170be208f5af6a5cb1e5a8c9.tar.gz chromium_src-77ed5014b883ef7e170be208f5af6a5cb1e5a8c9.tar.bz2 |
Fix a couple of data races found by TSAN Race Verifier in VideoCaptureController.
Tested by removing the suppression and verifying that this command-line fails
before and passes after the .cc file change:
./tools/valgrind/chrome_tests.sh --build_dir=ninja/Debug --test content --tool tsan_rv --gtest_filter=VideoCaptureHostTest.StartCaptureErrorStop
BUG=86507
TEST=see above
Review URL: http://codereview.chromium.org/7859018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100446 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/renderer_host/media/video_capture_controller.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/content/browser/renderer_host/media/video_capture_controller.cc b/content/browser/renderer_host/media/video_capture_controller.cc index e1d5d28..bdad7e0 100644 --- a/content/browser/renderer_host/media/video_capture_controller.cc +++ b/content/browser/renderer_host/media/video_capture_controller.cc @@ -59,9 +59,10 @@ void VideoCaptureController::ReturnBuffer(int buffer_id) { { base::AutoLock lock(lock_); free_dibs_.push_back(buffer_id); - ready_to_delete = (free_dibs_.size() == owned_dibs_.size()); + ready_to_delete = (free_dibs_.size() == owned_dibs_.size()) && + report_ready_to_delete_; } - if (report_ready_to_delete_ && ready_to_delete) { + if (ready_to_delete) { event_handler_->OnReadyToDelete(id_); } } @@ -198,10 +199,10 @@ void VideoCaptureController::OnFrameInfo( void VideoCaptureController::OnDeviceStopped(Task* stopped_task) { bool ready_to_delete_now; - // Set flag to indicate we need to report when all DIBs have been returned. - report_ready_to_delete_ = true; { base::AutoLock lock(lock_); + // Set flag to indicate we need to report when all DIBs have been returned. + report_ready_to_delete_ = true; ready_to_delete_now = (free_dibs_.size() == owned_dibs_.size()); } |