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

Side by Side Diff: content/renderer/media/android/stream_texture_factory.h

Issue 2192823004: Update StreamTextureProxy to accept a base::Closure (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/renderer/media/android/stream_texture_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 18 matching lines...) Expand all
29 29
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 the provided
40 // a connected client will receive callbacks on. This can be called 40 // callback will be run on. This can be called on any thread, but must be
41 // on any thread, but must be called with the same loop every time. 41 // called with the same loop every time.
42 void BindToLoop(int32_t stream_id, 42 void BindToTaskRunner(int32_t stream_id,
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_;
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
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/android/stream_texture_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698