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