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

Unified Diff: media/video/video_decode_accelerator.h

Issue 10749019: VideoDecodeAccelerator now SupportsWeakPtr instead of being RefCountedThreadSafe. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 5 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: media/video/video_decode_accelerator.h
diff --git a/media/video/video_decode_accelerator.h b/media/video/video_decode_accelerator.h
index 83d0b95631ca775fdfcb9ec34ef515568481f7dc..b7297ac056816a4dc532f61e9cadc97799635c33 100644
--- a/media/video/video_decode_accelerator.h
+++ b/media/video/video_decode_accelerator.h
@@ -8,6 +8,7 @@
#include <vector>
#include "base/basictypes.h"
+#include "base/memory/weak_ptr.h"
#include "media/base/bitstream_buffer.h"
#include "media/base/video_decoder_config.h"
#include "media/video/picture.h"
@@ -18,12 +19,11 @@ namespace media {
// Video decoder interface.
// This interface is extended by the various components that ultimately
// implement the backend of PPB_VideoDecode_Dev.
-//
-// No thread-safety guarantees are implied by the use of RefCountedThreadSafe
-// below.
class MEDIA_EXPORT VideoDecodeAccelerator
- : public base::RefCountedThreadSafe<VideoDecodeAccelerator> {
+ : public base::SupportsWeakPtr<VideoDecodeAccelerator> {
public:
+ virtual ~VideoDecodeAccelerator();
+
// Enumeration of potential errors generated by the API.
// Note: Keep these in sync with PP_VideoDecodeError_Dev.
enum Error {
@@ -127,11 +127,11 @@ class MEDIA_EXPORT VideoDecodeAccelerator
// component is freed. This call may asynchornously free system resources,
// but its client-visible effects are synchronous. After this method returns
// no more callbacks will be made on the client.
- virtual void Destroy() = 0;
-
- protected:
- friend class base::RefCountedThreadSafe<VideoDecodeAccelerator>;
- virtual ~VideoDecodeAccelerator();
+ // Because the client interface is synchronous but implementations may be
+ // asynchronous, the caller (who may own |this|) can pass ownership of the VDA
+ // *to* the VDA for hidden shenaniganary. |self| may be NULL if ownership
+ // doesn't need to transfer.
+ virtual void Destroy(scoped_ptr<VideoDecodeAccelerator> self) = 0;
};
} // namespace media

Powered by Google App Engine
This is Rietveld 408576698