Chromium Code Reviews| Index: cc/layers/video_frame_provider_client_impl.h |
| diff --git a/cc/layers/video_frame_provider_client_impl.h b/cc/layers/video_frame_provider_client_impl.h |
| index 39f66fb009db00e81960b3099c243495f8f58f02..e87c4492ec17ee2864ead9ecbb34f9b124378f76 100644 |
| --- a/cc/layers/video_frame_provider_client_impl.h |
| +++ b/cc/layers/video_frame_provider_client_impl.h |
| @@ -8,6 +8,7 @@ |
| #include "base/memory/ref_counted.h" |
| #include "base/synchronization/lock.h" |
| #include "base/threading/thread_checker.h" |
| +#include "cc/base/cc_export.h" |
| #include "cc/layers/video_frame_provider.h" |
| #include "ui/gfx/transform.h" |
| @@ -16,42 +17,53 @@ namespace media { class VideoFrame; } |
| namespace cc { |
| class VideoLayerImpl; |
| -class VideoFrameProviderClientImpl |
| +// VideoFrameProviderClientImpl liasons with the VideoFrameProvider and the |
| +// VideoLayer. It receives updates from the provider and updates the layer as a |
| +// result. It also allows the layer to access the video frame that the provider |
| +// has. |
| +class CC_EXPORT VideoFrameProviderClientImpl |
| : public VideoFrameProvider::Client, |
| public base::RefCounted<VideoFrameProviderClientImpl> { |
| public: |
| + // Must be created on the impl thread while the main thread is blocked. |
| static scoped_refptr<VideoFrameProviderClientImpl> Create( |
| VideoFrameProvider* provider); |
| - VideoLayerImpl* active_video_layer() { return active_video_layer_; } |
| + VideoLayerImpl* ActiveVideoLayer() const; |
| void SetActiveVideoLayer(VideoLayerImpl* video_layer); |
| - void Stop(); |
| - bool Stopped(); |
| + bool Destroyed() const; |
| + // Must be called on the impl thread while the main thread is blocked. |
| + void Destroy(); |
| scoped_refptr<media::VideoFrame> AcquireLockAndCurrentFrame(); |
| void PutCurrentFrame(const scoped_refptr<media::VideoFrame>& frame); |
| void ReleaseLock(); |
| - const gfx::Transform& stream_texture_matrix() const { |
| - return stream_texture_matrix_; |
| - } |
| - // VideoFrameProvider::Client implementation. These methods are all callable |
| - // on any thread. |
| + const gfx::Transform& StreamTextureMatrix() const; |
| + |
| + // VideoFrameProvider::Client implementation. |
| + // Called on the main thread. |
| void StopUsingProvider() override; |
| + // Called on the impl thread. |
| void DidReceiveFrame() override; |
| void DidUpdateMatrix(const float* matrix) override; |
| private: |
| - explicit VideoFrameProviderClientImpl(VideoFrameProvider* provider); |
| friend class base::RefCounted<VideoFrameProviderClientImpl>; |
| + |
| + explicit VideoFrameProviderClientImpl(VideoFrameProvider* provider); |
| ~VideoFrameProviderClientImpl() override; |
| + VideoFrameProvider* provider_; |
| VideoLayerImpl* active_video_layer_; |
| + bool destroyed_; |
| - // Guards the destruction of provider_ and the frame that it provides |
| + // Since the provider lives on another thread, it can be destroyed while the |
| + // frame controller are accessing it's frame. Before being destroyed the |
|
danakj
2015/03/26 22:38:35
"is accessing"
sunnyps
2015/03/27 00:38:46
Done.
|
| + // provider calls StopUsingProvider. provider_lock_ blocks StopUsingProvider |
| + // from returning till the frame controller is done using the frame. |
|
danakj
2015/03/26 22:38:35
"until"
sunnyps
2015/03/27 00:38:46
Done.
|
| base::Lock provider_lock_; |
| - VideoFrameProvider* provider_; |
| base::ThreadChecker thread_checker_; |
| gfx::Transform stream_texture_matrix_; |