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

Unified Diff: content/renderer/media/video_capture_impl.cc

Issue 8036005: Add a flag in StopCapture to allow event handler to choose event notification. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: add missing file 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 | « content/renderer/media/video_capture_impl.h ('k') | content/renderer/media/video_capture_module_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/video_capture_impl.cc
===================================================================
--- content/renderer/media/video_capture_impl.cc (revision 102594)
+++ content/renderer/media/video_capture_impl.cc (working copy)
@@ -5,6 +5,7 @@
#include "content/renderer/media/video_capture_impl.h"
#include "base/stl_util.h"
+#include "base/synchronization/waitable_event.h"
#include "content/common/child_process.h"
#include "content/common/media/video_capture_messages.h"
@@ -94,9 +95,19 @@
capability));
}
-void VideoCaptureImpl::StopCapture(media::VideoCapture::EventHandler* handler) {
- ml_proxy_->PostTask(FROM_HERE,
- NewRunnableMethod(this, &VideoCaptureImpl::DoStopCapture, handler));
+void VideoCaptureImpl::StopCapture(media::VideoCapture::EventHandler* handler,
+ bool need_notification) {
+ if (need_notification) {
+ ml_proxy_->PostTask(FROM_HERE,
+ NewRunnableMethod(this, &VideoCaptureImpl::DoStopCapture, handler,
+ static_cast<base::WaitableEvent*>(NULL)));
+ } else {
+ base::WaitableEvent completion(false, false);
+ ml_proxy_->PostTask(FROM_HERE,
+ NewRunnableMethod(this, &VideoCaptureImpl::DoStopCapture, handler,
+ &completion));
+ completion.Wait();
+ }
}
void VideoCaptureImpl::FeedBuffer(scoped_refptr<VideoFrameBuffer> buffer) {
@@ -213,20 +224,27 @@
}
void VideoCaptureImpl::DoStopCapture(
- media::VideoCapture::EventHandler* handler) {
+ media::VideoCapture::EventHandler* handler,
+ base::WaitableEvent* completion) {
DCHECK(ml_proxy_->BelongsToCurrentThread());
ClientInfo::iterator it = pending_clients_.find(handler);
if (it != pending_clients_.end()) {
- handler->OnStopped(this);
pending_clients_.erase(it);
+ if (!completion)
+ handler->OnStopped(this);
+ else
+ completion->Signal();
return;
}
if (clients_.find(handler) == clients_.end())
return;
- handler->OnStopped(this);
+ if (!completion)
+ handler->OnStopped(this);
+ else
+ completion->Signal();
clients_.erase(handler);
master_clients_.remove(handler);
« no previous file with comments | « content/renderer/media/video_capture_impl.h ('k') | content/renderer/media/video_capture_module_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698