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 // static | 76 BrowserSurfaceTextureManager::BrowserSurfaceTextureManager() { |
77 BrowserSurfaceTextureManager* BrowserSurfaceTextureManager::GetInstance() { | 77 SurfaceTexturePeer::InitInstance(this); |
78 return Singleton<BrowserSurfaceTextureManager, | 78 } |
79 LeakySingletonTraits<BrowserSurfaceTextureManager>>::get(); | 79 |
| 80 BrowserSurfaceTextureManager::~BrowserSurfaceTextureManager() { |
| 81 SurfaceTexturePeer::InitInstance(NULL); |
80 } | 82 } |
81 | 83 |
82 void BrowserSurfaceTextureManager::RegisterSurfaceTexture( | 84 void BrowserSurfaceTextureManager::RegisterSurfaceTexture( |
83 int surface_texture_id, | 85 int surface_texture_id, |
84 int client_id, | 86 int client_id, |
85 gfx::SurfaceTexture* surface_texture) { | 87 gfx::SurfaceTexture* surface_texture) { |
86 content::CreateSurfaceTextureSurface( | 88 content::CreateSurfaceTextureSurface( |
87 surface_texture_id, client_id, surface_texture); | 89 surface_texture_id, client_id, surface_texture); |
88 } | 90 } |
89 | 91 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 126 |
125 BrowserThread::PostTask(BrowserThread::UI, | 127 BrowserThread::PostTask(BrowserThread::UI, |
126 FROM_HERE, | 128 FROM_HERE, |
127 base::Bind(&SetSurfacePeer, | 129 base::Bind(&SetSurfacePeer, |
128 surface_texture, | 130 surface_texture, |
129 render_process_handle, | 131 render_process_handle, |
130 render_frame_id, | 132 render_frame_id, |
131 player_id)); | 133 player_id)); |
132 } | 134 } |
133 | 135 |
134 BrowserSurfaceTextureManager::BrowserSurfaceTextureManager() { | |
135 SurfaceTexturePeer::InitInstance(this); | |
136 } | |
137 | |
138 BrowserSurfaceTextureManager::~BrowserSurfaceTextureManager() { | |
139 SurfaceTexturePeer::InitInstance(nullptr); | |
140 } | |
141 | |
142 } // namespace content | 136 } // namespace content |
OLD | NEW |