| 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 GPU_STREAM_TEXTURE_MANAGER_IN_PROCESS_ANDROID_H_ | 5 #ifndef GPU_STREAM_TEXTURE_MANAGER_IN_PROCESS_ANDROID_H_ |
| 6 #define GPU_STREAM_TEXTURE_MANAGER_IN_PROCESS_ANDROID_H_ | 6 #define GPU_STREAM_TEXTURE_MANAGER_IN_PROCESS_ANDROID_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/atomic_sequence_num.h" |
| 10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 12 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
| 13 #include "base/threading/non_thread_safe.h" | 14 #include "base/threading/non_thread_safe.h" |
| 14 | 15 |
| 15 namespace gfx { | 16 namespace gfx { |
| 16 class SurfaceTexture; | 17 class SurfaceTexture; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace gpu { | 20 namespace gpu { |
| 20 | 21 |
| 21 namespace gles2 { | 22 namespace gles2 { |
| 22 class TextureManager; | 23 class TextureManager; |
| 23 } | 24 } |
| 24 | 25 |
| 25 class StreamTextureManagerInProcess : public base::NonThreadSafe { | 26 class StreamTextureManagerInProcess : public base::NonThreadSafe { |
| 26 public: | 27 public: |
| 27 StreamTextureManagerInProcess(); | 28 StreamTextureManagerInProcess(); |
| 28 ~StreamTextureManagerInProcess(); | 29 ~StreamTextureManagerInProcess(); |
| 29 | 30 |
| 30 uint32 CreateStreamTexture(uint32 client_texture_id, | 31 int32 CreateStreamTexture(uint32 client_texture_id, |
| 31 gles2::TextureManager* texture_manager); | 32 gles2::TextureManager* texture_manager); |
| 33 void SetStreamTextureSize(uint32 client_texture_id, |
| 34 int32 stream_id, |
| 35 size_t width, |
| 36 size_t height, |
| 37 gles2::TextureManager* texture_manager); |
| 32 | 38 |
| 33 // This method can be called from any thread. | 39 // This method can be called from any thread. |
| 34 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture(uint32 stream_id); | 40 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture(int32 stream_id); |
| 35 | 41 |
| 36 private: | 42 private: |
| 37 void OnReleaseStreamTexture(uint32 stream_id); | 43 void OnReleaseStreamTexture(int32 stream_id); |
| 38 | 44 |
| 39 typedef std::map<uint32, scoped_refptr<gfx::SurfaceTexture> > TextureMap; | 45 class GLImage; |
| 40 TextureMap textures_; | 46 typedef std::map<int32, GLImage*> ImageMap; |
| 47 ImageMap images_; |
| 41 base::Lock map_lock_; | 48 base::Lock map_lock_; |
| 42 uint32 next_id_; | 49 base::AtomicSequenceNumber next_id_; |
| 43 | 50 |
| 44 base::WeakPtrFactory<StreamTextureManagerInProcess> weak_factory_; | 51 base::WeakPtrFactory<StreamTextureManagerInProcess> weak_factory_; |
| 45 DISALLOW_COPY_AND_ASSIGN(StreamTextureManagerInProcess); | 52 DISALLOW_COPY_AND_ASSIGN(StreamTextureManagerInProcess); |
| 46 }; | 53 }; |
| 47 | 54 |
| 48 } // gpu | 55 } // gpu |
| 49 | 56 |
| 50 #endif // GPU_STREAM_TEXTURE_MANAGER_IN_PROCESS_ANDROID_H_ | 57 #endif // GPU_STREAM_TEXTURE_MANAGER_IN_PROCESS_ANDROID_H_ |
| OLD | NEW |