summaryrefslogtreecommitdiffstats
path: root/media/video
diff options
context:
space:
mode:
authorrsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-26 01:06:06 +0000
committerrsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-26 01:06:06 +0000
commit512d03f78c442cf31bae077d93ecc4882a46b286 (patch)
tree428c50889d8a1ded265b3dd90775cb300f12e2ae /media/video
parent8c672de7d601eba2b337446bb869f08dece73633 (diff)
downloadchromium_src-512d03f78c442cf31bae077d93ecc4882a46b286.zip
chromium_src-512d03f78c442cf31bae077d93ecc4882a46b286.tar.gz
chromium_src-512d03f78c442cf31bae077d93ecc4882a46b286.tar.bz2
RefCounted types should not have public destructors, delegate cleanup
For Delegate/Observer-type classes that specify an interface but do not have any particular lifetime requirements, make their destructors protected. This is to allow their interfaces to be implemented safely by RefCounted types. With public destructors, it's possible to do "scoped_ptr<Delegate> foo", and then assign a RefCountedDelegateImpl, which would lead to a double free. As none of these Delegates actually need public destructors (ownership of the Delegate* is not transferred during a function call / class constructor), mark the destructors protected so that it becomes a compile warning to try to delete them via the Delegate*. BUG=123295 TEST=it compiles Review URL: https://chromiumcodereview.appspot.com/10383262 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144086 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/video')
-rw-r--r--media/video/capture/video_capture.h9
-rw-r--r--media/video/video_decode_accelerator.h5
2 files changed, 10 insertions, 4 deletions
diff --git a/media/video/capture/video_capture.h b/media/video/capture/video_capture.h
index b825dff..d0aef98 100644
--- a/media/video/capture/video_capture.h
+++ b/media/video/capture/video_capture.h
@@ -44,7 +44,7 @@ class MEDIA_EXPORT VideoCapture {
// TODO(wjia): add error codes.
// Callbacks provided by client for notification of events.
- class EventHandler {
+ class MEDIA_EXPORT EventHandler {
public:
// Notify client that video capture has been started.
virtual void OnStarted(VideoCapture* capture) = 0;
@@ -70,10 +70,12 @@ class MEDIA_EXPORT VideoCapture {
virtual void OnDeviceInfoReceived(
VideoCapture* capture,
const VideoCaptureParams& device_info) = 0;
+
+ protected:
+ virtual ~EventHandler() {}
};
VideoCapture() {}
- virtual ~VideoCapture() {}
// Request video capture to start capturing with |capability|.
// Also register |handler| with video capture for event handling.
@@ -93,6 +95,9 @@ class MEDIA_EXPORT VideoCapture {
virtual int CaptureHeight() = 0;
virtual int CaptureFrameRate() = 0;
+ protected:
+ virtual ~VideoCapture() {}
+
private:
DISALLOW_COPY_AND_ASSIGN(VideoCapture);
};
diff --git a/media/video/video_decode_accelerator.h b/media/video/video_decode_accelerator.h
index c04d8dc..83d0b95 100644
--- a/media/video/video_decode_accelerator.h
+++ b/media/video/video_decode_accelerator.h
@@ -46,8 +46,6 @@ class MEDIA_EXPORT VideoDecodeAccelerator
// implements.
class MEDIA_EXPORT Client {
public:
- virtual ~Client() {}
-
// Callback to notify client that decoder has been initialized.
virtual void NotifyInitializeDone() = 0;
@@ -74,6 +72,9 @@ class MEDIA_EXPORT VideoDecodeAccelerator
// Callback to notify about decoding errors.
virtual void NotifyError(Error error) = 0;
+
+ protected:
+ virtual ~Client() {}
};
// Video decoder functions.