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

Unified Diff: content/common/gpu/media/video_decode_accelerator_impl.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
Index: content/common/gpu/media/video_decode_accelerator_impl.h
diff --git a/content/common/gpu/media/video_decode_accelerator_impl.h b/content/common/gpu/media/video_decode_accelerator_impl.h
index 30abfa658e1ba42d7eb1cdf5d8c1a367b06207f8..c0762a09e7aa3784f6598473ac1e365ca266b6cc 100644
--- a/content/common/gpu/media/video_decode_accelerator_impl.h
+++ b/content/common/gpu/media/video_decode_accelerator_impl.h
@@ -14,7 +14,6 @@ class CONTENT_EXPORT VideoDecodeAcceleratorImpl
: public media::VideoDecodeAccelerator {
public:
VideoDecodeAcceleratorImpl();
- virtual ~VideoDecodeAcceleratorImpl();
// Returns true if VDA::Decode and VDA::Client callbacks can run on the IO
// thread. Otherwise they will run on the GPU child thread. The purpose of
@@ -23,8 +22,29 @@ class CONTENT_EXPORT VideoDecodeAcceleratorImpl
// PictureReady should be run on the child thread if a picture is delivered
// the first time so it can be cleared.
virtual bool CanDecodeOnIOThread();
+
+ protected:
+ virtual ~VideoDecodeAcceleratorImpl();
};
} // namespace content
+namespace base {
+
+template <class T>
+struct DefaultDeleter;
+
+// Specialize DefaultDeleter so that scoped_ptr<VideoDecodeAcceleratorImpl>
+// always uses "Destroy()" instead of trying to use the destructor.
+template <>
+struct DefaultDeleter<content::VideoDecodeAcceleratorImpl> {
+ public:
+ inline void operator()(void* video_decode_accelerator) const {
+ static_cast<content::VideoDecodeAcceleratorImpl*>(video_decode_accelerator)
+ ->Destroy();
+ }
+};
+
+} // namespace base
+
#endif // CONTENT_COMMON_GPU_MEDIA_VIDEO_DECODE_ACCELERATOR_IMPL_H_
« no previous file with comments | « content/common/gpu/media/gpu_video_encode_accelerator.cc ('k') | content/common/gpu/media/video_decode_accelerator_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698