Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_H_ | 6 #define CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 class ContextProviderCommandBuffer; | 30 class ContextProviderCommandBuffer; |
| 31 class StreamTextureFactory; | 31 class StreamTextureFactory; |
| 32 | 32 |
| 33 // The proxy class for the gpu thread to notify the compositor thread | 33 // The proxy class for the gpu thread to notify the compositor thread |
| 34 // when a new video frame is available. | 34 // when a new video frame is available. |
| 35 class StreamTextureProxy : public StreamTextureHost::Listener { | 35 class StreamTextureProxy : public StreamTextureHost::Listener { |
| 36 public: | 36 public: |
| 37 ~StreamTextureProxy() override; | 37 ~StreamTextureProxy() override; |
| 38 | 38 |
| 39 // Initialize and bind to the loop, which becomes the thread that | 39 // Initialize and bind to the loop, which becomes the thread that |
| 40 // a connected client will receive callbacks on. This can be called | 40 // a connected client will receive callbacks on. This can be called |
|
watk
2016/07/29 19:03:16
update docs
tguilbert
2016/08/01 22:05:57
Done.
| |
| 41 // on any thread, but must be called with the same loop every time. | 41 // on any thread, but must be called with the same loop every time. |
| 42 void BindToLoop(int32_t stream_id, | 42 void BindToLoop(int32_t stream_id, |
|
watk
2016/07/29 19:03:16
tangential: we should rename this at some point to
tguilbert
2016/08/01 22:05:57
Done.
watk
2016/08/01 22:30:03
Thanks for doing it in this CL :)
| |
| 43 cc::VideoFrameProvider::Client* client, | 43 const base::Closure& received_frame_cb, |
| 44 scoped_refptr<base::SingleThreadTaskRunner> loop); | 44 scoped_refptr<base::SingleThreadTaskRunner> loop); |
|
watk
2016/08/01 22:30:03
s/loop/task_runner
tguilbert
2016/08/01 23:03:18
Done.
| |
| 45 | 45 |
| 46 // StreamTextureHost::Listener implementation: | 46 // StreamTextureHost::Listener implementation: |
| 47 void OnFrameAvailable() override; | 47 void OnFrameAvailable() override; |
| 48 | 48 |
| 49 struct Deleter { | 49 struct Deleter { |
| 50 inline void operator()(StreamTextureProxy* ptr) const { ptr->Release(); } | 50 inline void operator()(StreamTextureProxy* ptr) const { ptr->Release(); } |
| 51 }; | 51 }; |
| 52 private: | 52 private: |
| 53 friend class StreamTextureFactory; | 53 friend class StreamTextureFactory; |
| 54 explicit StreamTextureProxy(StreamTextureHost* host); | 54 explicit StreamTextureProxy(StreamTextureHost* host); |
| 55 | 55 |
| 56 void BindOnThread(int32_t stream_id); | 56 void BindOnThread(int32_t stream_id); |
| 57 void Release(); | 57 void Release(); |
| 58 | 58 |
| 59 const std::unique_ptr<StreamTextureHost> host_; | 59 const std::unique_ptr<StreamTextureHost> host_; |
| 60 | 60 |
| 61 // Protects access to |client_| and |loop_|. | 61 // Protects access to |received_frame_cb_| and |loop_|. |
| 62 base::Lock lock_; | 62 base::Lock lock_; |
| 63 cc::VideoFrameProvider::Client* client_; | 63 base::Closure received_frame_cb_; |
| 64 scoped_refptr<base::SingleThreadTaskRunner> loop_; | 64 scoped_refptr<base::SingleThreadTaskRunner> loop_; |
|
watk
2016/08/01 22:30:03
s/loop_/task_runner_/ (and docs above)
tguilbert
2016/08/01 23:03:18
Done.
| |
| 65 | 65 |
| 66 DISALLOW_IMPLICIT_CONSTRUCTORS(StreamTextureProxy); | 66 DISALLOW_IMPLICIT_CONSTRUCTORS(StreamTextureProxy); |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 typedef std::unique_ptr<StreamTextureProxy, StreamTextureProxy::Deleter> | 69 typedef std::unique_ptr<StreamTextureProxy, StreamTextureProxy::Deleter> |
| 70 ScopedStreamTextureProxy; | 70 ScopedStreamTextureProxy; |
| 71 | 71 |
| 72 // Factory class for managing stream textures. | 72 // Factory class for managing stream textures. |
| 73 class CONTENT_EXPORT StreamTextureFactory | 73 class CONTENT_EXPORT StreamTextureFactory |
| 74 : public base::RefCounted<StreamTextureFactory> { | 74 : public base::RefCounted<StreamTextureFactory> { |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 105 | 105 |
| 106 scoped_refptr<ContextProviderCommandBuffer> context_provider_; | 106 scoped_refptr<ContextProviderCommandBuffer> context_provider_; |
| 107 scoped_refptr<gpu::GpuChannelHost> channel_; | 107 scoped_refptr<gpu::GpuChannelHost> channel_; |
| 108 | 108 |
| 109 DISALLOW_IMPLICIT_CONSTRUCTORS(StreamTextureFactory); | 109 DISALLOW_IMPLICIT_CONSTRUCTORS(StreamTextureFactory); |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 } // namespace content | 112 } // namespace content |
| 113 | 113 |
| 114 #endif // CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_H_ | 114 #endif // CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_H_ |
| OLD | NEW |