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 10 matching lines...) Expand all Loading... |
21 } // namespace gpu | 21 } // namespace gpu |
22 | 22 |
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 int32 stream_id) = 0; |
32 | 32 |
33 virtual gpu::gles2::GLES2Interface* ContextGL() = 0; | 33 virtual gpu::gles2::GLES2Interface* ContextGL() = 0; |
34 | 34 |
35 virtual void AddObserver(StreamTextureFactoryContextObserver* obs) = 0; | 35 virtual void AddObserver(StreamTextureFactoryContextObserver* obs) = 0; |
36 virtual void RemoveObserver(StreamTextureFactoryContextObserver* obs) = 0; | 36 virtual void RemoveObserver(StreamTextureFactoryContextObserver* obs) = 0; |
37 | 37 |
38 protected: | 38 protected: |
39 friend class base::RefCountedThreadSafe<ContextProvider>; | 39 friend class base::RefCountedThreadSafe<ContextProvider>; |
40 virtual ~ContextProvider() {} | 40 virtual ~ContextProvider() {} |
41 }; | 41 }; |
42 | 42 |
43 typedef base::Callback<scoped_refptr<ContextProvider>(void)> | 43 typedef base::Callback<scoped_refptr<ContextProvider>(void)> |
44 CreateContextProviderCallback; | 44 CreateContextProviderCallback; |
45 | 45 |
46 static scoped_refptr<StreamTextureFactorySynchronousImpl> Create( | 46 static scoped_refptr<StreamTextureFactorySynchronousImpl> Create( |
47 const CreateContextProviderCallback& try_create_callback, | 47 const CreateContextProviderCallback& try_create_callback, |
48 int frame_id); | 48 int frame_id); |
49 | 49 |
50 StreamTextureProxy* CreateProxy() override; | 50 StreamTextureProxy* CreateProxy() override; |
51 void EstablishPeer(int32 stream_id, int player_id) override; | 51 void EstablishPeer(int32 stream_id, int player_id) override; |
52 unsigned CreateStreamTexture(unsigned texture_target, | 52 int32 CreateStreamTexture(unsigned texture_target, |
53 unsigned* texture_id, | 53 unsigned* texture_id, |
54 gpu::Mailbox* texture_mailbox) override; | 54 gpu::Mailbox* texture_mailbox) override; |
55 void SetStreamTextureSize(int32 stream_id, const gfx::Size& size) override; | |
56 gpu::gles2::GLES2Interface* ContextGL() override; | 55 gpu::gles2::GLES2Interface* ContextGL() override; |
57 void AddObserver(StreamTextureFactoryContextObserver* obs) override; | 56 void AddObserver(StreamTextureFactoryContextObserver* obs) override; |
58 void RemoveObserver(StreamTextureFactoryContextObserver* obs) override; | 57 void RemoveObserver(StreamTextureFactoryContextObserver* obs) override; |
59 | 58 |
60 private: | 59 private: |
61 friend class base::RefCounted<StreamTextureFactorySynchronousImpl>; | 60 friend class base::RefCounted<StreamTextureFactorySynchronousImpl>; |
62 StreamTextureFactorySynchronousImpl( | 61 StreamTextureFactorySynchronousImpl( |
63 const CreateContextProviderCallback& try_create_callback, | 62 const CreateContextProviderCallback& try_create_callback, |
64 int frame_id); | 63 int frame_id); |
65 ~StreamTextureFactorySynchronousImpl() override; | 64 ~StreamTextureFactorySynchronousImpl() override; |
66 | 65 |
67 CreateContextProviderCallback create_context_provider_callback_; | 66 CreateContextProviderCallback create_context_provider_callback_; |
68 scoped_refptr<ContextProvider> context_provider_; | 67 scoped_refptr<ContextProvider> context_provider_; |
69 int frame_id_; | 68 int frame_id_; |
70 StreamTextureFactoryContextObserver* observer_; | 69 StreamTextureFactoryContextObserver* observer_; |
71 | 70 |
72 DISALLOW_IMPLICIT_CONSTRUCTORS(StreamTextureFactorySynchronousImpl); | 71 DISALLOW_IMPLICIT_CONSTRUCTORS(StreamTextureFactorySynchronousImpl); |
73 }; | 72 }; |
74 | 73 |
75 } // namespace content | 74 } // namespace content |
76 | 75 |
77 #endif // CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_SYNCHRONOUS_IMP
L_H_ | 76 #endif // CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_SYNCHRONOUS_IMP
L_H_ |
OLD | NEW |