Index: media/video/video_decode_accelerator.h |
diff --git a/media/video/video_decode_accelerator.h b/media/video/video_decode_accelerator.h |
index 950ac8d143e633b87aecfe666395ea1ee8174dad..7025a51cc82ae5db83b9befcc17fb0284005e5ff 100644 |
--- a/media/video/video_decode_accelerator.h |
+++ b/media/video/video_decode_accelerator.h |
@@ -20,8 +20,6 @@ namespace media { |
// implement the backend of PPB_VideoDecode_Dev. |
class MEDIA_EXPORT VideoDecodeAccelerator { |
public: |
- virtual ~VideoDecodeAccelerator(); |
- |
// Enumeration of potential errors generated by the API. |
// Note: Keep these in sync with PP_VideoDecodeError_Dev. Also do not |
// rearrange, reuse or remove values as they are used for gathering UMA |
@@ -133,8 +131,28 @@ class MEDIA_EXPORT VideoDecodeAccelerator { |
// 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 Destroy() it properly by default. |
+ virtual ~VideoDecodeAccelerator(); |
}; |
} // namespace media |
+namespace base { |
+ |
+template <class T> |
+struct DefaultDeleter; |
+ |
+// Specialize DefaultDeleter so that scoped_ptr<VideoDecodeAccelerator> always |
+// uses "Destroy()" instead of trying to use the destructor. |
+template <> |
+struct MEDIA_EXPORT DefaultDeleter<media::VideoDecodeAccelerator> { |
+ public: |
+ void operator()(void* video_decode_accelerator) const; |
+}; |
+ |
+} // namespace base |
+ |
#endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ |