OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_ANDROID_SYNCHRONOU
S_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_ANDROID_SYNCHRONOU
S_IMPL_H_ |
6 #define CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_ANDROID_SYNCHRONOU
S_IMPL_H_ | 6 #define CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_ANDROID_SYNCHRONOU
S_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 "content/renderer/media/android/stream_texture_factory_android.h" | 10 #include "content/renderer/media/android/stream_texture_factory_android.h" |
11 | 11 |
12 namespace gfx { | 12 namespace gfx { |
13 class SurfaceTexture; | 13 class SurfaceTexture; |
14 } | 14 } |
15 | 15 |
16 namespace blink { | 16 namespace gpu { |
17 class WebGraphicsContext3D; | 17 namespace gles2 { |
18 } | 18 class GLES2Interface; |
| 19 } // namespace gles2 |
| 20 } // namespace gpu |
19 | 21 |
20 namespace content { | 22 namespace content { |
21 | 23 |
22 // Factory for when using synchronous compositor in Android WebView. | 24 // Factory for when using synchronous compositor in Android WebView. |
23 class StreamTextureFactorySynchronousImpl : public StreamTextureFactory { | 25 class StreamTextureFactorySynchronousImpl : public StreamTextureFactory { |
24 public: | 26 public: |
25 class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> { | 27 class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> { |
26 public: | 28 public: |
27 virtual scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( | 29 virtual scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( |
28 uint32 stream_id) = 0; | 30 uint32 stream_id) = 0; |
29 | 31 |
30 virtual blink::WebGraphicsContext3D* Context3d() = 0; | 32 virtual gpu::gles2::GLES2Interface* ContextGL() = 0; |
31 | 33 |
32 protected: | 34 protected: |
33 friend class base::RefCountedThreadSafe<ContextProvider>; | 35 friend class base::RefCountedThreadSafe<ContextProvider>; |
34 virtual ~ContextProvider() {} | 36 virtual ~ContextProvider() {} |
35 }; | 37 }; |
36 | 38 |
37 typedef base::Callback<scoped_refptr<ContextProvider>(void)> | 39 typedef base::Callback<scoped_refptr<ContextProvider>(void)> |
38 CreateContextProviderCallback; | 40 CreateContextProviderCallback; |
39 | 41 |
40 StreamTextureFactorySynchronousImpl( | 42 StreamTextureFactorySynchronousImpl( |
41 const CreateContextProviderCallback& try_create_callback, | 43 const CreateContextProviderCallback& try_create_callback, |
42 int view_id); | 44 int view_id); |
43 virtual ~StreamTextureFactorySynchronousImpl(); | 45 virtual ~StreamTextureFactorySynchronousImpl(); |
44 | 46 |
45 virtual StreamTextureProxy* CreateProxy() OVERRIDE; | 47 virtual StreamTextureProxy* CreateProxy() OVERRIDE; |
46 virtual void EstablishPeer(int32 stream_id, int player_id) OVERRIDE; | 48 virtual void EstablishPeer(int32 stream_id, int player_id) OVERRIDE; |
47 virtual unsigned CreateStreamTexture( | 49 virtual unsigned CreateStreamTexture( |
48 unsigned texture_target, | 50 unsigned texture_target, |
49 unsigned* texture_id, | 51 unsigned* texture_id, |
50 gpu::Mailbox* texture_mailbox, | 52 gpu::Mailbox* texture_mailbox, |
51 unsigned* texture_mailbox_sync_point) OVERRIDE; | 53 unsigned* texture_mailbox_sync_point) OVERRIDE; |
52 virtual void DestroyStreamTexture(unsigned texture_id) OVERRIDE; | 54 virtual void DestroyStreamTexture(unsigned texture_id) OVERRIDE; |
53 virtual void SetStreamTextureSize(int32 stream_id, | 55 virtual void SetStreamTextureSize(int32 stream_id, |
54 const gfx::Size& size) OVERRIDE; | 56 const gfx::Size& size) OVERRIDE; |
55 virtual blink::WebGraphicsContext3D* Context3d() OVERRIDE; | 57 virtual gpu::gles2::GLES2Interface* ContextGL() OVERRIDE; |
56 | 58 |
57 private: | 59 private: |
58 CreateContextProviderCallback create_context_provider_callback_; | 60 CreateContextProviderCallback create_context_provider_callback_; |
59 scoped_refptr<ContextProvider> context_provider_; | 61 scoped_refptr<ContextProvider> context_provider_; |
60 int view_id_; | 62 int view_id_; |
61 | 63 |
62 DISALLOW_COPY_AND_ASSIGN(StreamTextureFactorySynchronousImpl); | 64 DISALLOW_COPY_AND_ASSIGN(StreamTextureFactorySynchronousImpl); |
63 }; | 65 }; |
64 | 66 |
65 } // namespace content | 67 } // namespace content |
66 | 68 |
67 #endif // CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_ANDROID_SYNCHRO
NOUS_IMPL_H_ | 69 #endif // CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_ANDROID_SYNCHRO
NOUS_IMPL_H_ |
OLD | NEW |