OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser_surface_texture_manager.h" | 5 #include "content/browser/android/browser_surface_texture_manager.h" |
6 | 6 |
7 #include <android/native_window_jni.h> | 7 #include <android/native_window_jni.h> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "content/browser/android/child_process_launcher_android.h" | 10 #include "content/browser/android/child_process_launcher_android.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } | 66 } |
67 | 67 |
68 if (player != player_manager->GetFullscreenPlayer()) { | 68 if (player != player_manager->GetFullscreenPlayer()) { |
69 gfx::ScopedJavaSurface scoped_surface(surface_texture.get()); | 69 gfx::ScopedJavaSurface scoped_surface(surface_texture.get()); |
70 player->SetVideoSurface(scoped_surface.Pass()); | 70 player->SetVideoSurface(scoped_surface.Pass()); |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 } // namespace | 74 } // namespace |
75 | 75 |
76 BrowserSurfaceTextureManager::BrowserSurfaceTextureManager() { | 76 // static |
77 SurfaceTexturePeer::InitInstance(this); | 77 BrowserSurfaceTextureManager* BrowserSurfaceTextureManager::GetInstance() { |
78 } | 78 return Singleton<BrowserSurfaceTextureManager, |
79 | 79 LeakySingletonTraits<BrowserSurfaceTextureManager>>::get(); |
80 BrowserSurfaceTextureManager::~BrowserSurfaceTextureManager() { | |
81 SurfaceTexturePeer::InitInstance(NULL); | |
82 } | 80 } |
83 | 81 |
84 void BrowserSurfaceTextureManager::RegisterSurfaceTexture( | 82 void BrowserSurfaceTextureManager::RegisterSurfaceTexture( |
85 int surface_texture_id, | 83 int surface_texture_id, |
86 int client_id, | 84 int client_id, |
87 gfx::SurfaceTexture* surface_texture) { | 85 gfx::SurfaceTexture* surface_texture) { |
88 content::CreateSurfaceTextureSurface( | 86 content::CreateSurfaceTextureSurface( |
89 surface_texture_id, client_id, surface_texture); | 87 surface_texture_id, client_id, surface_texture); |
90 } | 88 } |
91 | 89 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 124 |
127 BrowserThread::PostTask(BrowserThread::UI, | 125 BrowserThread::PostTask(BrowserThread::UI, |
128 FROM_HERE, | 126 FROM_HERE, |
129 base::Bind(&SetSurfacePeer, | 127 base::Bind(&SetSurfacePeer, |
130 surface_texture, | 128 surface_texture, |
131 render_process_handle, | 129 render_process_handle, |
132 render_frame_id, | 130 render_frame_id, |
133 player_id)); | 131 player_id)); |
134 } | 132 } |
135 | 133 |
| 134 BrowserSurfaceTextureManager::BrowserSurfaceTextureManager() { |
| 135 SurfaceTexturePeer::InitInstance(this); |
| 136 } |
| 137 |
| 138 BrowserSurfaceTextureManager::~BrowserSurfaceTextureManager() { |
| 139 SurfaceTexturePeer::InitInstance(nullptr); |
| 140 } |
| 141 |
136 } // namespace content | 142 } // namespace content |
OLD | NEW |