Chromium Code Reviews| Index: media/video/video_encode_accelerator.h |
| diff --git a/media/video/video_encode_accelerator.h b/media/video/video_encode_accelerator.h |
| index fd934dde447c6fe2c9e347c960a48d999cdfa4cd..011248ff7710f2c51cf72a429139f3aa8ce11deb 100644 |
| --- a/media/video/video_encode_accelerator.h |
| +++ b/media/video/video_encode_accelerator.h |
| @@ -22,8 +22,6 @@ class VideoFrame; |
| // Video encoder interface. |
| class MEDIA_EXPORT VideoEncodeAccelerator { |
| public: |
| - virtual ~VideoEncodeAccelerator(); |
| - |
| // Specification of an encoding profile supported by an encoder. |
| struct SupportedProfile { |
| VideoCodecProfile profile; |
| @@ -143,8 +141,31 @@ class MEDIA_EXPORT VideoEncodeAccelerator { |
| // this method returns no more callbacks will be made on the client. Deletes |
| // |this| unconditionally, so make sure to drop all pointers to it! |
| virtual void Destroy() = 0; |
| + |
| + protected: |
| + // Do not delete directly; use Destroy() or own it with a scoped_ptr, which |
| + // will delete it properly by default. |
|
Ami GONE FROM CHROMIUM
2014/05/27 20:06:02
s/delete/Destroy()/
dmichael (off chromium)
2014/05/28 22:31:25
Done.
|
| + virtual ~VideoEncodeAccelerator(); |
| }; |
| } // namespace media |
| +namespace base { |
| + |
| +template <class T> |
| +struct DefaultDeleter; |
| + |
| +// Specialize DefaultDeleter so that scoped_ptr<VideoEncodeAccelerator> always |
| +// uses "Destroy()" instead of trying to use the destructor. |
| +template <> |
| +struct DefaultDeleter<media::VideoEncodeAccelerator> { |
| + public: |
| + inline void operator()(void* video_encode_accelerator) const { |
| + static_cast<media::VideoEncodeAccelerator*>(video_encode_accelerator) |
|
Ami GONE FROM CHROMIUM
2014/05/27 20:06:02
can this be not inline?
dmichael (off chromium)
2014/05/28 22:31:25
operator()'s implementation is inline... do you m
|
| + ->Destroy(); |
| + } |
| +}; |
| + |
| +} // namespace base |
| + |
| #endif // MEDIA_VIDEO_VIDEO_ENCODE_ACCELERATOR_H_ |