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

Unified Diff: content/browser/renderer_host/media/video_capture_controller.cc

Issue 7859018: Fix a couple of data races found by TSAN Race Verifier in VideoCaptureController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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 | « no previous file | tools/valgrind/tsan/suppressions.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/media/video_capture_controller.cc
diff --git a/content/browser/renderer_host/media/video_capture_controller.cc b/content/browser/renderer_host/media/video_capture_controller.cc
index e1d5d28014181cebe5d9a0f60cc1e3b3ecc30865..bdad7e07e377087b2e06a814ee254f3e85c7071b 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());
}
« no previous file with comments | « no previous file | tools/valgrind/tsan/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698