summaryrefslogtreecommitdiffstats
path: root/media/video
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-28 18:07:43 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-28 18:07:43 +0000
commit3ab556a38fda71a0e63604ce3f249a21f985deed (patch)
treeed73cb68eddf34ff716f7b96a71891a0feeadd6c /media/video
parentf491617687763f9f6b8d8d1d44d5aa13ef6d730e (diff)
downloadchromium_src-3ab556a38fda71a0e63604ce3f249a21f985deed.zip
chromium_src-3ab556a38fda71a0e63604ce3f249a21f985deed.tar.gz
chromium_src-3ab556a38fda71a0e63604ce3f249a21f985deed.tar.bz2
Properly scope the lifetime of the |PPB_VideoCapture_Impl|.
Since it/its proxy are |media::VideoCapture::EventHandler|s, they must remain alive from the |StartCapture()| call until |OnRemoved()| is received. (Precisely, the |PPB_VideoCapture_Impl| owns a |PlatformVideoCapture(Impl)|, which owns a |VideoCaptureHandlerProxy|. Keeping the |PPB_VideoCapture_Impl| alive keeps all these things alive.) BUG=none TEST=Closing a page with a PPAPI plugin using the video capture interface doesn't cause the renderer to crash. Other similar things should also work more or less properly (and at least not crash). Review URL: http://codereview.chromium.org/8052023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103138 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/video')
-rw-r--r--media/video/capture/video_capture_proxy.cc13
-rw-r--r--media/video/capture/video_capture_proxy.h3
2 files changed, 15 insertions, 1 deletions
diff --git a/media/video/capture/video_capture_proxy.cc b/media/video/capture/video_capture_proxy.cc
index a8d00cb..221f2c6 100644
--- a/media/video/capture/video_capture_proxy.cc
+++ b/media/video/capture/video_capture_proxy.cc
@@ -69,7 +69,11 @@ void VideoCaptureHandlerProxy::OnError(VideoCapture* capture, int error_code) {
}
void VideoCaptureHandlerProxy::OnRemoved(VideoCapture* capture) {
- // TODO(vtl): add logic when this event handler is removed.
+ main_message_loop_->PostTask(FROM_HERE, NewRunnableMethod(
+ this,
+ &VideoCaptureHandlerProxy::OnRemovedOnMainThread,
+ capture,
+ GetState(capture)));
}
void VideoCaptureHandlerProxy::OnBufferReady(
@@ -123,6 +127,13 @@ void VideoCaptureHandlerProxy::OnErrorOnMainThread(
proxied_->OnError(capture, error_code);
}
+void VideoCaptureHandlerProxy::OnRemovedOnMainThread(
+ VideoCapture* capture,
+ const VideoCaptureState& state) {
+ state_ = state;
+ proxied_->OnRemoved(capture);
+}
+
void VideoCaptureHandlerProxy::OnBufferReadyOnMainThread(
VideoCapture* capture,
const VideoCaptureState& state,
diff --git a/media/video/capture/video_capture_proxy.h b/media/video/capture/video_capture_proxy.h
index 0594379..54fa666 100644
--- a/media/video/capture/video_capture_proxy.h
+++ b/media/video/capture/video_capture_proxy.h
@@ -74,6 +74,9 @@ class MEDIA_EXPORT VideoCaptureHandlerProxy
VideoCapture* capture,
const VideoCaptureState& state,
int error_code);
+ void OnRemovedOnMainThread(
+ VideoCapture* capture,
+ const VideoCaptureState& state);
void OnBufferReadyOnMainThread(
VideoCapture* capture,
const VideoCaptureState& state,