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 WebKit { | 16 namespace blink { |
17 class WebGraphicsContext3D; | 17 class WebGraphicsContext3D; |
18 } | 18 } |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 | 21 |
22 // Factory for when using synchronous compositor in Android WebView. | 22 // Factory for when using synchronous compositor in Android WebView. |
23 class StreamTextureFactorySynchronousImpl : public StreamTextureFactory { | 23 class StreamTextureFactorySynchronousImpl : public StreamTextureFactory { |
24 public: | 24 public: |
25 class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> { | 25 class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> { |
26 public: | 26 public: |
27 virtual scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( | 27 virtual scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( |
28 uint32 stream_id) = 0; | 28 uint32 stream_id) = 0; |
29 | 29 |
30 virtual WebKit::WebGraphicsContext3D* Context3d() = 0; | 30 virtual blink::WebGraphicsContext3D* Context3d() = 0; |
31 | 31 |
32 protected: | 32 protected: |
33 friend class base::RefCountedThreadSafe<ContextProvider>; | 33 friend class base::RefCountedThreadSafe<ContextProvider>; |
34 virtual ~ContextProvider() {} | 34 virtual ~ContextProvider() {} |
35 }; | 35 }; |
36 | 36 |
37 typedef base::Callback<scoped_refptr<ContextProvider>(void)> | 37 typedef base::Callback<scoped_refptr<ContextProvider>(void)> |
38 CreateContextProviderCallback; | 38 CreateContextProviderCallback; |
39 | 39 |
40 StreamTextureFactorySynchronousImpl( | 40 StreamTextureFactorySynchronousImpl( |
41 const CreateContextProviderCallback& try_create_callback, | 41 const CreateContextProviderCallback& try_create_callback, |
42 int view_id); | 42 int view_id); |
43 virtual ~StreamTextureFactorySynchronousImpl(); | 43 virtual ~StreamTextureFactorySynchronousImpl(); |
44 | 44 |
45 virtual StreamTextureProxy* CreateProxy() OVERRIDE; | 45 virtual StreamTextureProxy* CreateProxy() OVERRIDE; |
46 virtual void EstablishPeer(int32 stream_id, int player_id) OVERRIDE; | 46 virtual void EstablishPeer(int32 stream_id, int player_id) OVERRIDE; |
47 virtual unsigned CreateStreamTexture( | 47 virtual unsigned CreateStreamTexture( |
48 unsigned texture_target, | 48 unsigned texture_target, |
49 unsigned* texture_id, | 49 unsigned* texture_id, |
50 gpu::Mailbox* texture_mailbox, | 50 gpu::Mailbox* texture_mailbox, |
51 unsigned* texture_mailbox_sync_point) OVERRIDE; | 51 unsigned* texture_mailbox_sync_point) OVERRIDE; |
52 virtual void DestroyStreamTexture(unsigned texture_id) OVERRIDE; | 52 virtual void DestroyStreamTexture(unsigned texture_id) OVERRIDE; |
53 virtual void SetStreamTextureSize(int32 stream_id, | 53 virtual void SetStreamTextureSize(int32 stream_id, |
54 const gfx::Size& size) OVERRIDE; | 54 const gfx::Size& size) OVERRIDE; |
55 virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE; | 55 virtual blink::WebGraphicsContext3D* Context3d() OVERRIDE; |
56 | 56 |
57 private: | 57 private: |
58 CreateContextProviderCallback create_context_provider_callback_; | 58 CreateContextProviderCallback create_context_provider_callback_; |
59 scoped_refptr<ContextProvider> context_provider_; | 59 scoped_refptr<ContextProvider> context_provider_; |
60 int view_id_; | 60 int view_id_; |
61 | 61 |
62 DISALLOW_COPY_AND_ASSIGN(StreamTextureFactorySynchronousImpl); | 62 DISALLOW_COPY_AND_ASSIGN(StreamTextureFactorySynchronousImpl); |
63 }; | 63 }; |
64 | 64 |
65 } // namespace content | 65 } // namespace content |
66 | 66 |
67 #endif // CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_ANDROID_SYNCHRO
NOUS_IMPL_H_ | 67 #endif // CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_ANDROID_SYNCHRO
NOUS_IMPL_H_ |
OLD | NEW |