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