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