Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Unified Diff: media/video/video_encode_accelerator.h

Issue 292183011: Make DefaultDeleter for Video{De|En}codeAccelerator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: out-of-line DefaultDeleter::operator() Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/video/video_decode_accelerator.cc ('k') | media/video/video_encode_accelerator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..891204bcae1de04746d10f9dffdddbb20ce608c6 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,28 @@ 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 Destroy() it properly by default.
+ 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 MEDIA_EXPORT DefaultDeleter<media::VideoEncodeAccelerator> {
+ public:
+ void operator()(void* video_encode_accelerator) const;
+};
+
+} // namespace base
+
#endif // MEDIA_VIDEO_VIDEO_ENCODE_ACCELERATOR_H_
« no previous file with comments | « media/video/video_decode_accelerator.cc ('k') | media/video/video_encode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698