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

Unified Diff: media/filters/gpu_video_decoder.h

Issue 14348007: Reland: Remove reference counting from media::VideoDecoder and friends. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 7 years, 8 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/ffmpeg_video_decoder_unittest.cc ('k') | media/filters/gpu_video_decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/gpu_video_decoder.h
diff --git a/media/filters/gpu_video_decoder.h b/media/filters/gpu_video_decoder.h
index 6acc2ded0b6719d6533c253696c5d7ac467ff389..c2defb3aa4fd1eff11abf0196751cd7d0bf64e4f 100644
--- a/media/filters/gpu_video_decoder.h
+++ b/media/filters/gpu_video_decoder.h
@@ -10,6 +10,7 @@
#include <utility>
#include <vector>
+#include "base/memory/weak_ptr.h"
#include "media/base/pipeline_status.h"
#include "media/base/demuxer_stream.h"
#include "media/base/video_decoder.h"
@@ -27,6 +28,7 @@ class SkBitmap;
namespace media {
class DecoderBuffer;
+class VDAClientProxy;
// GPU-accelerated video decoder implementation. Relies on
// AcceleratedVideoDecoderMsg_Decode and friends.
@@ -64,7 +66,7 @@ class MEDIA_EXPORT GpuVideoDecoder
// attempts at factory operations
virtual void Abort() = 0;
- // Returns true if Abort has been called.
+ // Returns true if Abort() has been called.
virtual bool IsAborted() = 0;
protected:
@@ -134,9 +136,10 @@ class MEDIA_EXPORT GpuVideoDecoder
void GetBufferData(int32 id, base::TimeDelta* timetamp,
gfx::Rect* visible_rect, gfx::Size* natural_size);
- // Set |vda_| and |weak_vda_| on the VDA thread (in practice the render
- // thread).
- void SetVDA(VideoDecodeAccelerator* vda);
+ // Sets |vda_| and |weak_vda_| on the GVD thread and runs |status_cb|.
+ void SetVDA(const PipelineStatusCB& status_cb,
+ VideoDecodeAccelerator* vda,
+ base::WeakPtr<VideoDecodeAccelerator> weak_vda);
// Call VDA::Destroy() on |vda_loop_proxy_| ensuring that |this| outlives the
// Destroy() call.
@@ -167,6 +170,8 @@ class MEDIA_EXPORT GpuVideoDecoder
// MessageLoop on which to fire callbacks and trampoline calls to this class
// if they arrive on other loops.
scoped_refptr<base::MessageLoopProxy> gvd_loop_proxy_;
+ base::WeakPtrFactory<GpuVideoDecoder> weak_factory_;
+ base::WeakPtr<GpuVideoDecoder> weak_this_;
// Message loop on which to makes all calls to vda_. (beware this loop may be
// paused during the Pause/Flush/Stop dance PipelineImpl::Stop() goes
@@ -175,8 +180,12 @@ class MEDIA_EXPORT GpuVideoDecoder
scoped_refptr<Factories> factories_;
+ // Proxies calls from |vda_| to |gvd_loop_proxy_| and used to safely detach
+ // during shutdown.
+ scoped_refptr<VDAClientProxy> client_proxy_;
+
// Populated during Initialize() via SetVDA() (on success) and unchanged
- // until an error occurs
+ // until an error occurs.
scoped_ptr<VideoDecodeAccelerator> vda_;
// Used to post tasks from the GVD thread to the VDA thread safely.
base::WeakPtr<VideoDecodeAccelerator> weak_vda_;
« no previous file with comments | « media/filters/ffmpeg_video_decoder_unittest.cc ('k') | media/filters/gpu_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698