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 "gpu/ipc/common/android/surface_texture_manager.h" | |
9 | |
10 #include <memory> | |
11 | |
12 #include "base/containers/scoped_ptr_hash_map.h" | |
13 #include "base/macros.h" | |
14 #include "base/memory/singleton.h" | |
15 #include "base/synchronization/lock.h" | |
16 #include "content/common/content_export.h" | |
17 #include "gpu/ipc/common/android/surface_texture_peer.h" | |
18 #include "ui/gl/android/scoped_java_surface.h" | |
19 | |
20 namespace content { | |
21 | |
22 class CONTENT_EXPORT InProcessSurfaceTextureManager | |
23 : public gpu::SurfaceTextureManager, | |
24 public gpu::SurfaceTexturePeer { | |
25 public: | |
26 static InProcessSurfaceTextureManager* GetInstance(); | |
27 | |
28 // Overridden from SurfaceTextureManager: | |
29 void RegisterSurfaceTexture(int surface_texture_id, | |
30 int client_id, | |
31 gfx::SurfaceTexture* surface_texture) override; | |
32 void UnregisterSurfaceTexture(int surface_texture_id, int client_id) override; | |
33 gfx::AcceleratedWidget AcquireNativeWidgetForSurfaceTexture( | |
34 int surface_texture_id) override; | |
35 | |
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: | |
44 friend struct base::DefaultSingletonTraits<InProcessSurfaceTextureManager>; | |
45 | |
46 InProcessSurfaceTextureManager(); | |
47 ~InProcessSurfaceTextureManager() override; | |
48 | |
49 using SurfaceTextureMap = | |
50 base::ScopedPtrHashMap<int, std::unique_ptr<gfx::ScopedJavaSurface>>; | |
51 SurfaceTextureMap surface_textures_; | |
52 base::Lock lock_; | |
53 | |
54 DISALLOW_COPY_AND_ASSIGN(InProcessSurfaceTextureManager); | |
55 }; | |
56 | |
57 } // namespace content | |
58 | |
59 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SURFACE_TEXTURE_MANAGER_H_ | |
OLD | NEW |