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_SYNCHRONOUS_IMPL_H
_ | 5 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_SYNCHRONOUS_IMPL_H
_ |
6 #define CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_SYNCHRONOUS_IMPL_H
_ | 6 #define CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_SYNCHRONOUS_IMPL_H
_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 namespace content { | 23 namespace content { |
24 | 24 |
25 // Factory for when using synchronous compositor in Android WebView. | 25 // Factory for when using synchronous compositor in Android WebView. |
26 class StreamTextureFactorySynchronousImpl : public StreamTextureFactory { | 26 class StreamTextureFactorySynchronousImpl : public StreamTextureFactory { |
27 public: | 27 public: |
28 class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> { | 28 class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> { |
29 public: | 29 public: |
30 virtual scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( | 30 virtual scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( |
31 uint32 stream_id) = 0; | 31 uint32 stream_id) = 0; |
32 | 32 |
| 33 virtual uint32 CreateStreamTexture(uint32 texture_id) = 0; |
| 34 |
33 virtual gpu::gles2::GLES2Interface* ContextGL() = 0; | 35 virtual gpu::gles2::GLES2Interface* ContextGL() = 0; |
34 | 36 |
35 virtual void AddObserver(StreamTextureFactoryContextObserver* obs) = 0; | 37 virtual void AddObserver(StreamTextureFactoryContextObserver* obs) = 0; |
36 virtual void RemoveObserver(StreamTextureFactoryContextObserver* obs) = 0; | 38 virtual void RemoveObserver(StreamTextureFactoryContextObserver* obs) = 0; |
37 | 39 |
38 protected: | 40 protected: |
39 friend class base::RefCountedThreadSafe<ContextProvider>; | 41 friend class base::RefCountedThreadSafe<ContextProvider>; |
40 virtual ~ContextProvider() {} | 42 virtual ~ContextProvider() {} |
41 }; | 43 }; |
42 | 44 |
43 typedef base::Callback<scoped_refptr<ContextProvider>(void)> | 45 typedef base::Callback<scoped_refptr<ContextProvider>(void)> |
44 CreateContextProviderCallback; | 46 CreateContextProviderCallback; |
45 | 47 |
46 static scoped_refptr<StreamTextureFactorySynchronousImpl> Create( | 48 static scoped_refptr<StreamTextureFactorySynchronousImpl> Create( |
47 const CreateContextProviderCallback& try_create_callback, | 49 const CreateContextProviderCallback& try_create_callback, |
48 int frame_id); | 50 int frame_id); |
49 | 51 |
50 StreamTextureProxy* CreateProxy() override; | 52 StreamTextureProxy* CreateProxy() override; |
51 void EstablishPeer(int32 stream_id, int player_id) override; | 53 void EstablishPeer(int32 stream_id, int player_id, int frame_id) override; |
52 unsigned CreateStreamTexture(unsigned texture_target, | 54 unsigned CreateStreamTexture(unsigned texture_target, |
53 unsigned* texture_id, | 55 unsigned* texture_id, |
54 gpu::Mailbox* texture_mailbox) override; | 56 gpu::Mailbox* texture_mailbox) override; |
55 void SetStreamTextureSize(int32 stream_id, const gfx::Size& size) override; | 57 void SetStreamTextureSize(int32 stream_id, const gfx::Size& size) override; |
56 gpu::gles2::GLES2Interface* ContextGL() override; | 58 gpu::gles2::GLES2Interface* ContextGL() override; |
57 void AddObserver(StreamTextureFactoryContextObserver* obs) override; | 59 void AddObserver(StreamTextureFactoryContextObserver* obs) override; |
58 void RemoveObserver(StreamTextureFactoryContextObserver* obs) override; | 60 void RemoveObserver(StreamTextureFactoryContextObserver* obs) override; |
59 | 61 |
60 private: | 62 private: |
61 friend class base::RefCounted<StreamTextureFactorySynchronousImpl>; | 63 friend class base::RefCounted<StreamTextureFactorySynchronousImpl>; |
62 StreamTextureFactorySynchronousImpl( | 64 StreamTextureFactorySynchronousImpl( |
63 const CreateContextProviderCallback& try_create_callback, | 65 const CreateContextProviderCallback& try_create_callback, |
64 int frame_id); | 66 int frame_id); |
65 ~StreamTextureFactorySynchronousImpl() override; | 67 ~StreamTextureFactorySynchronousImpl() override; |
66 | 68 |
67 CreateContextProviderCallback create_context_provider_callback_; | 69 CreateContextProviderCallback create_context_provider_callback_; |
68 scoped_refptr<ContextProvider> context_provider_; | 70 scoped_refptr<ContextProvider> context_provider_; |
69 int frame_id_; | 71 int frame_id_; |
70 StreamTextureFactoryContextObserver* observer_; | 72 StreamTextureFactoryContextObserver* observer_; |
71 | 73 |
72 DISALLOW_IMPLICIT_CONSTRUCTORS(StreamTextureFactorySynchronousImpl); | 74 DISALLOW_IMPLICIT_CONSTRUCTORS(StreamTextureFactorySynchronousImpl); |
73 }; | 75 }; |
74 | 76 |
75 } // namespace content | 77 } // namespace content |
76 | 78 |
77 #endif // CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_SYNCHRONOUS_IMP
L_H_ | 79 #endif // CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_SYNCHRONOUS_IMP
L_H_ |
OLD | NEW |