OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef GPU_STREAM_TEXTURE_MANAGER_IN_PROCESS_ANDROID_H_ |
| 6 #define GPU_STREAM_TEXTURE_MANAGER_IN_PROCESS_ANDROID_H_ |
| 7 |
| 8 #include <map> |
| 9 |
| 10 #include "base/memory/linked_ptr.h" |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/synchronization/lock.h" |
| 13 #include "gpu/command_buffer/service/stream_texture.h" |
| 14 #include "gpu/command_buffer/service/stream_texture_manager.h" |
| 15 |
| 16 namespace gfx { |
| 17 class Size; |
| 18 class SurfaceTextureBridge; |
| 19 } |
| 20 |
| 21 namespace gpu { |
| 22 |
| 23 class StreamTextureManagerInProcess |
| 24 : public gpu::StreamTextureManager, |
| 25 public base::RefCountedThreadSafe<StreamTextureManagerInProcess> { |
| 26 public: |
| 27 StreamTextureManagerInProcess(); |
| 28 virtual ~StreamTextureManagerInProcess(); |
| 29 |
| 30 // implement gpu::StreamTextureManager: |
| 31 virtual uint32 CreateStreamTexture(uint32 service_id, |
| 32 uint32 client_id) OVERRIDE; |
| 33 virtual void DestroyStreamTexture(uint32 service_id) OVERRIDE; |
| 34 virtual gpu::StreamTexture* LookupStreamTexture(uint32 service_id) OVERRIDE; |
| 35 |
| 36 scoped_refptr<gfx::SurfaceTextureBridge> GetSurfaceTexture(uint32 stream_id); |
| 37 |
| 38 private: |
| 39 class StreamTextureImpl : public gpu::StreamTexture { |
| 40 public: |
| 41 StreamTextureImpl(uint32 service_id, uint32 stream_id); |
| 42 virtual ~StreamTextureImpl(); |
| 43 |
| 44 // implement gpu::StreamTexture |
| 45 virtual void Update() OVERRIDE; |
| 46 virtual gfx::Size GetSize() OVERRIDE; |
| 47 |
| 48 void SetSize(gfx::Size size); |
| 49 |
| 50 scoped_refptr<gfx::SurfaceTextureBridge> GetSurfaceTexture(); |
| 51 uint32 stream_id() { return stream_id_; } |
| 52 |
| 53 private: |
| 54 scoped_refptr<gfx::SurfaceTextureBridge> surface_texture_bridge_; |
| 55 uint32 stream_id_; |
| 56 gfx::Size size_; |
| 57 |
| 58 DISALLOW_COPY_AND_ASSIGN(StreamTextureImpl); |
| 59 }; |
| 60 |
| 61 typedef std::map<uint32, linked_ptr<StreamTextureImpl> > TextureMap; |
| 62 TextureMap textures_; |
| 63 |
| 64 uint32 next_id_; |
| 65 |
| 66 base::Lock map_lock_; |
| 67 |
| 68 DISALLOW_COPY_AND_ASSIGN(StreamTextureManagerInProcess); |
| 69 }; |
| 70 |
| 71 } // gpu |
| 72 |
| 73 #endif // GPU_STREAM_TEXTURE_MANAGER_IN_PROCESS_ANDROID_H_ |
OLD | NEW |