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 #include "content/browser/android/in_process_surface_texture_manager.h" | 5 #include "content/browser/android/in_process_surface_texture_manager.h" |
6 | 6 |
7 #include <android/native_window.h> | 7 #include <android/native_window.h> |
8 #include <android/native_window_jni.h> | 8 #include <android/native_window_jni.h> |
9 | 9 |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
11 #include "base/containers/scoped_ptr_hash_map.h" | 11 #include "base/containers/scoped_ptr_hash_map.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/ptr_util.h" |
13 #include "content/browser/media/android/browser_media_player_manager.h" | 14 #include "content/browser/media/android/browser_media_player_manager.h" |
14 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 | 18 |
18 // static | 19 // static |
19 InProcessSurfaceTextureManager* InProcessSurfaceTextureManager::GetInstance() { | 20 InProcessSurfaceTextureManager* InProcessSurfaceTextureManager::GetInstance() { |
20 return base::Singleton< | 21 return base::Singleton< |
21 InProcessSurfaceTextureManager, | 22 InProcessSurfaceTextureManager, |
22 base::LeakySingletonTraits<InProcessSurfaceTextureManager>>::get(); | 23 base::LeakySingletonTraits<InProcessSurfaceTextureManager>>::get(); |
23 } | 24 } |
24 | 25 |
25 void InProcessSurfaceTextureManager::RegisterSurfaceTexture( | 26 void InProcessSurfaceTextureManager::RegisterSurfaceTexture( |
26 int surface_texture_id, | 27 int surface_texture_id, |
27 int client_id, | 28 int client_id, |
28 gfx::SurfaceTexture* surface_texture) { | 29 gfx::SurfaceTexture* surface_texture) { |
29 base::AutoLock lock(lock_); | 30 base::AutoLock lock(lock_); |
30 | 31 |
31 DCHECK(surface_textures_.find(surface_texture_id) == surface_textures_.end()); | 32 DCHECK(surface_textures_.find(surface_texture_id) == surface_textures_.end()); |
32 surface_textures_.add( | 33 surface_textures_.add( |
33 surface_texture_id, | 34 surface_texture_id, |
34 make_scoped_ptr(new gfx::ScopedJavaSurface(surface_texture))); | 35 base::WrapUnique(new gfx::ScopedJavaSurface(surface_texture))); |
35 } | 36 } |
36 | 37 |
37 void InProcessSurfaceTextureManager::UnregisterSurfaceTexture( | 38 void InProcessSurfaceTextureManager::UnregisterSurfaceTexture( |
38 int surface_texture_id, | 39 int surface_texture_id, |
39 int client_id) { | 40 int client_id) { |
40 base::AutoLock lock(lock_); | 41 base::AutoLock lock(lock_); |
41 | 42 |
42 DCHECK(surface_textures_.find(surface_texture_id) != surface_textures_.end()); | 43 DCHECK(surface_textures_.find(surface_texture_id) != surface_textures_.end()); |
43 surface_textures_.erase(surface_texture_id); | 44 surface_textures_.erase(surface_texture_id); |
44 } | 45 } |
(...skipping 25 matching lines...) Expand all Loading... |
70 | 71 |
71 InProcessSurfaceTextureManager::InProcessSurfaceTextureManager() { | 72 InProcessSurfaceTextureManager::InProcessSurfaceTextureManager() { |
72 SurfaceTexturePeer::InitInstance(this); | 73 SurfaceTexturePeer::InitInstance(this); |
73 } | 74 } |
74 | 75 |
75 InProcessSurfaceTextureManager::~InProcessSurfaceTextureManager() { | 76 InProcessSurfaceTextureManager::~InProcessSurfaceTextureManager() { |
76 SurfaceTexturePeer::InitInstance(nullptr); | 77 SurfaceTexturePeer::InitInstance(nullptr); |
77 } | 78 } |
78 | 79 |
79 } // namespace content | 80 } // namespace content |
OLD | NEW |