OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 CONTENT_BROWSER_ANDROID_IN_PROCESS_SURFACE_TEXTURE_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_SURFACE_TEXTURE_MANAGER_H_ |
| 7 |
| 8 #include "content/common/android/surface_texture_manager.h" |
| 9 |
| 10 #include "base/containers/scoped_ptr_hash_map.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/singleton.h" |
| 13 #include "base/synchronization/lock.h" |
| 14 #include "content/common/android/surface_texture_peer.h" |
| 15 #include "ui/gl/android/scoped_java_surface.h" |
| 16 |
| 17 namespace content { |
| 18 |
| 19 class InProcessSurfaceTextureManager : public SurfaceTextureManager, |
| 20 public SurfaceTexturePeer { |
| 21 public: |
| 22 static InProcessSurfaceTextureManager* GetInstance(); |
| 23 |
| 24 // Overridden from SurfaceTextureManager: |
| 25 void RegisterSurfaceTexture(int surface_texture_id, |
| 26 int client_id, |
| 27 gfx::SurfaceTexture* surface_texture) override; |
| 28 void UnregisterSurfaceTexture(int surface_texture_id, int client_id) override; |
| 29 gfx::AcceleratedWidget AcquireNativeWidgetForSurfaceTexture( |
| 30 int surface_texture_id) override; |
| 31 |
| 32 // Overridden from SurfaceTexturePeer: |
| 33 void EstablishSurfaceTexturePeer( |
| 34 base::ProcessHandle render_process_handle, |
| 35 scoped_refptr<gfx::SurfaceTexture> surface_texture, |
| 36 int render_frame_id, |
| 37 int player_id) override; |
| 38 |
| 39 private: |
| 40 friend struct DefaultSingletonTraits<InProcessSurfaceTextureManager>; |
| 41 |
| 42 InProcessSurfaceTextureManager(); |
| 43 ~InProcessSurfaceTextureManager() override; |
| 44 |
| 45 using SurfaceTextureMap = |
| 46 base::ScopedPtrHashMap<int, scoped_ptr<gfx::ScopedJavaSurface>>; |
| 47 SurfaceTextureMap surface_textures_; |
| 48 base::Lock lock_; |
| 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(InProcessSurfaceTextureManager); |
| 51 }; |
| 52 |
| 53 } // namespace content |
| 54 |
| 55 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SURFACE_TEXTURE_MANAGER_H_ |
OLD | NEW |