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