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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 surface_texture_id, client_id, surface_texture); | 88 surface_texture_id, client_id, surface_texture); |
89 } | 89 } |
90 | 90 |
91 void BrowserSurfaceTextureManager::UnregisterSurfaceTexture( | 91 void BrowserSurfaceTextureManager::UnregisterSurfaceTexture( |
92 int surface_texture_id, | 92 int surface_texture_id, |
93 int client_id) { | 93 int client_id) { |
94 content::DestroySurfaceTextureSurface(surface_texture_id, client_id); | 94 content::DestroySurfaceTextureSurface(surface_texture_id, client_id); |
95 } | 95 } |
96 | 96 |
97 gfx::AcceleratedWidget BrowserSurfaceTextureManager::AcquireNativeWidget( | 97 gfx::AcceleratedWidget BrowserSurfaceTextureManager::AcquireNativeWidget( |
98 int surface_texture_id, | 98 int surface_texture_id) { |
99 int client_id) { | 99 const int kBrowserClientId = 0; |
piman
2014/11/04 01:07:26
Why 0, where does it come from?
Can RegisterSurfac
piman
2014/11/04 01:22:46
Double-checked: this should be BrowserGpuChannelHo
reveman
2014/11/04 06:20:46
Thanks. Fixed in latest patch.
| |
100 gfx::ScopedJavaSurface surface( | 100 gfx::ScopedJavaSurface surface( |
101 content::GetSurfaceTextureSurface(surface_texture_id, client_id)); | 101 content::GetSurfaceTextureSurface(surface_texture_id, kBrowserClientId)); |
102 if (surface.j_surface().is_null()) | 102 if (surface.j_surface().is_null()) |
103 return NULL; | 103 return NULL; |
104 | 104 |
105 JNIEnv* env = base::android::AttachCurrentThread(); | 105 JNIEnv* env = base::android::AttachCurrentThread(); |
106 // Note: This ensures that any local references used by | 106 // Note: This ensures that any local references used by |
107 // ANativeWindow_fromSurface are released immediately. This is needed as a | 107 // ANativeWindow_fromSurface are released immediately. This is needed as a |
108 // workaround for https://code.google.com/p/android/issues/detail?id=68174 | 108 // workaround for https://code.google.com/p/android/issues/detail?id=68174 |
109 base::android::ScopedJavaLocalFrame scoped_local_reference_frame(env); | 109 base::android::ScopedJavaLocalFrame scoped_local_reference_frame(env); |
110 ANativeWindow* native_window = | 110 ANativeWindow* native_window = |
111 ANativeWindow_fromSurface(env, surface.j_surface().obj()); | 111 ANativeWindow_fromSurface(env, surface.j_surface().obj()); |
(...skipping 12 matching lines...) Expand all Loading... | |
124 BrowserThread::PostTask(BrowserThread::UI, | 124 BrowserThread::PostTask(BrowserThread::UI, |
125 FROM_HERE, | 125 FROM_HERE, |
126 base::Bind(&SetSurfacePeer, | 126 base::Bind(&SetSurfacePeer, |
127 surface_texture, | 127 surface_texture, |
128 render_process_handle, | 128 render_process_handle, |
129 render_frame_id, | 129 render_frame_id, |
130 player_id)); | 130 player_id)); |
131 } | 131 } |
132 | 132 |
133 } // namespace content | 133 } // namespace content |
OLD | NEW |