| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // Note: This ensures that any local references used by | 52 // Note: This ensures that any local references used by |
| 53 // ANativeWindow_fromSurface are released immediately. This is needed as a | 53 // ANativeWindow_fromSurface are released immediately. This is needed as a |
| 54 // workaround for https://code.google.com/p/android/issues/detail?id=68174 | 54 // workaround for https://code.google.com/p/android/issues/detail?id=68174 |
| 55 base::android::ScopedJavaLocalFrame scoped_local_reference_frame(env); | 55 base::android::ScopedJavaLocalFrame scoped_local_reference_frame(env); |
| 56 ANativeWindow* native_window = | 56 ANativeWindow* native_window = |
| 57 ANativeWindow_fromSurface(env, surface.j_surface().obj()); | 57 ANativeWindow_fromSurface(env, surface.j_surface().obj()); |
| 58 | 58 |
| 59 return native_window; | 59 return native_window; |
| 60 } | 60 } |
| 61 | 61 |
| 62 void BrowserSurfaceTextureManager::EstablishSurfaceTexturePeer( | |
| 63 base::ProcessHandle render_process_handle, | |
| 64 scoped_refptr<gfx::SurfaceTexture> surface_texture, | |
| 65 int render_frame_id, | |
| 66 int player_id) { | |
| 67 if (!surface_texture.get()) | |
| 68 return; | |
| 69 | |
| 70 BrowserThread::PostTask( | |
| 71 BrowserThread::UI, FROM_HERE, | |
| 72 base::Bind(&BrowserMediaPlayerManager::SetSurfacePeer, surface_texture, | |
| 73 render_process_handle, render_frame_id, player_id)); | |
| 74 } | |
| 75 | |
| 76 BrowserSurfaceTextureManager::BrowserSurfaceTextureManager() { | 62 BrowserSurfaceTextureManager::BrowserSurfaceTextureManager() { |
| 77 SurfaceTexturePeer::InitInstance(this); | |
| 78 } | 63 } |
| 79 | 64 |
| 80 BrowserSurfaceTextureManager::~BrowserSurfaceTextureManager() { | 65 BrowserSurfaceTextureManager::~BrowserSurfaceTextureManager() { |
| 81 SurfaceTexturePeer::InitInstance(nullptr); | |
| 82 } | 66 } |
| 83 | 67 |
| 84 } // namespace content | 68 } // namespace content |
| OLD | NEW |