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

Unified Diff: media/video/video_decode_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/filters/gpu_video_decoder.cc ('k') | media/video/video_decode_accelerator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « media/filters/gpu_video_decoder.cc ('k') | media/video/video_decode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698