diff options
author | wjia@chromium.org <wjia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-27 21:45:09 +0000 |
---|---|---|
committer | wjia@chromium.org <wjia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-27 21:45:09 +0000 |
commit | 38ba7ae8f8aa0a2399e466c36d458a9e38e94297 (patch) | |
tree | adb07982f6cec3b218e638ffd7648942975a9435 /content/renderer | |
parent | 0881e190121c0a4ef24175df2f2307334d6a8d32 (diff) | |
download | chromium_src-38ba7ae8f8aa0a2399e466c36d458a9e38e94297.zip chromium_src-38ba7ae8f8aa0a2399e466c36d458a9e38e94297.tar.gz chromium_src-38ba7ae8f8aa0a2399e466c36d458a9e38e94297.tar.bz2 |
Add OnRemoved() in VideoCapture::EventHandler API
This is to allow client to know when the event handler can be deleted.
BUG=none
TEST=trybots
Review URL: http://codereview.chromium.org/8037055
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103016 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer')
6 files changed, 21 insertions, 1 deletions
diff --git a/content/renderer/media/capture_video_decoder.cc b/content/renderer/media/capture_video_decoder.cc index 74652f3..c7c0b5a 100644 --- a/content/renderer/media/capture_video_decoder.cc +++ b/content/renderer/media/capture_video_decoder.cc @@ -109,6 +109,10 @@ void CaptureVideoDecoder::OnError(media::VideoCapture* capture, NOTIMPLEMENTED(); } +void CaptureVideoDecoder::OnRemoved(media::VideoCapture* capture) { + NOTIMPLEMENTED(); +} + void CaptureVideoDecoder::OnBufferReady( media::VideoCapture* capture, scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf) { diff --git a/content/renderer/media/capture_video_decoder.h b/content/renderer/media/capture_video_decoder.h index ef2ffad..f491d5e 100644 --- a/content/renderer/media/capture_video_decoder.h +++ b/content/renderer/media/capture_video_decoder.h @@ -51,6 +51,7 @@ class CaptureVideoDecoder virtual void OnStopped(media::VideoCapture* capture) OVERRIDE; virtual void OnPaused(media::VideoCapture* capture) OVERRIDE; virtual void OnError(media::VideoCapture* capture, int error_code) OVERRIDE; + virtual void OnRemoved(media::VideoCapture* capture) OVERRIDE; virtual void OnBufferReady( media::VideoCapture* capture, scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf) OVERRIDE; diff --git a/content/renderer/media/video_capture_impl.cc b/content/renderer/media/video_capture_impl.cc index 2ac180b..3364b35 100644 --- a/content/renderer/media/video_capture_impl.cc +++ b/content/renderer/media/video_capture_impl.cc @@ -144,6 +144,7 @@ void VideoCaptureImpl::DoStartCapture( if (it != pending_clients_.end()) { handler->OnError(this, 1); + handler->OnRemoved(this); return; } @@ -157,6 +158,7 @@ void VideoCaptureImpl::DoStartCapture( capability.height != current_params_.height)) { // Can't have 2 master clients with different resolutions. handler->OnError(this, 1); + handler->OnRemoved(this); return; } @@ -219,6 +221,7 @@ void VideoCaptureImpl::DoStopCapture( ClientInfo::iterator it = pending_clients_.find(handler); if (it != pending_clients_.end()) { handler->OnStopped(this); + handler->OnRemoved(this); pending_clients_.erase(it); return; } @@ -227,6 +230,7 @@ void VideoCaptureImpl::DoStopCapture( return; handler->OnStopped(this); + handler->OnRemoved(this); clients_.erase(handler); master_clients_.remove(handler); @@ -368,7 +372,12 @@ void VideoCaptureImpl::DoStateChanged(const media::VideoCapture::State& state) { it != clients_.end(); it++) { // TODO(wjia): browser process would send error code. it->first->OnError(this, 1); + it->first->OnRemoved(this); } + clients_.clear(); + master_clients_.clear(); + state_ = kStopped; + current_params_.width = current_params_.height = 0; break; default: break; diff --git a/content/renderer/media/video_capture_impl_unittest.cc b/content/renderer/media/video_capture_impl_unittest.cc index fc66030..1dd7ae1 100644 --- a/content/renderer/media/video_capture_impl_unittest.cc +++ b/content/renderer/media/video_capture_impl_unittest.cc @@ -34,11 +34,12 @@ class MockVideoCaptureClient : public media::VideoCapture::EventHandler { MockVideoCaptureClient() {} virtual ~MockVideoCaptureClient() {} - // Filter implementation. + // EventHandler implementation. MOCK_METHOD1(OnStarted, void(media::VideoCapture* capture)); MOCK_METHOD1(OnStopped, void(media::VideoCapture* capture)); MOCK_METHOD1(OnPaused, void(media::VideoCapture* capture)); MOCK_METHOD2(OnError, void(media::VideoCapture* capture, int error_code)); + MOCK_METHOD1(OnRemoved, void(media::VideoCapture* capture)); MOCK_METHOD2(OnBufferReady, void(media::VideoCapture* capture, scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf)); diff --git a/content/renderer/media/video_capture_module_impl.cc b/content/renderer/media/video_capture_module_impl.cc index 35b10d1..e1b8b6f 100644 --- a/content/renderer/media/video_capture_module_impl.cc +++ b/content/renderer/media/video_capture_module_impl.cc @@ -105,6 +105,10 @@ void VideoCaptureModuleImpl::OnError(media::VideoCapture* capture, NOTIMPLEMENTED(); } +void VideoCaptureModuleImpl::OnRemoved(media::VideoCapture* capture) { + NOTIMPLEMENTED(); +} + void VideoCaptureModuleImpl::OnBufferReady( media::VideoCapture* capture, scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf) { diff --git a/content/renderer/media/video_capture_module_impl.h b/content/renderer/media/video_capture_module_impl.h index eaab51d..fc3bfc7 100644 --- a/content/renderer/media/video_capture_module_impl.h +++ b/content/renderer/media/video_capture_module_impl.h @@ -40,6 +40,7 @@ class VideoCaptureModuleImpl virtual void OnStopped(media::VideoCapture* capture); virtual void OnPaused(media::VideoCapture* capture); virtual void OnError(media::VideoCapture* capture, int error_code); + virtual void OnRemoved(media::VideoCapture* capture); virtual void OnBufferReady( media::VideoCapture* capture, scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf); |