OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/child_process_launcher_android.h" | 5 #include "content/browser/android/child_process_launcher_android.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 } | 208 } |
209 | 209 |
210 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); | 210 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); |
211 | 211 |
212 ScopedJavaGlobalRef<jobject> jsurface; | 212 ScopedJavaGlobalRef<jobject> jsurface; |
213 jsurface.Reset(env, surface); | 213 jsurface.Reset(env, surface); |
214 ScopedSurfaceRequestManager::GetInstance()->FulfillScopedSurfaceRequest( | 214 ScopedSurfaceRequestManager::GetInstance()->FulfillScopedSurfaceRequest( |
215 requestToken, gl::ScopedJavaSurface(jsurface)); | 215 requestToken, gl::ScopedJavaSurface(jsurface)); |
216 } | 216 } |
217 | 217 |
218 void CreateSurfaceTextureSurface(int surface_texture_id, | |
219 int client_id, | |
220 gl::SurfaceTexture* surface_texture) { | |
221 JNIEnv* env = AttachCurrentThread(); | |
222 DCHECK(env); | |
223 Java_ChildProcessLauncher_createSurfaceTextureSurface( | |
224 env, surface_texture_id, client_id, surface_texture->j_surface_texture()); | |
225 } | |
226 | |
227 void DestroySurfaceTextureSurface(int surface_texture_id, int client_id) { | |
228 JNIEnv* env = AttachCurrentThread(); | |
229 DCHECK(env); | |
230 Java_ChildProcessLauncher_destroySurfaceTextureSurface( | |
231 env, surface_texture_id, client_id); | |
232 } | |
233 | |
234 gl::ScopedJavaSurface GetSurfaceTextureSurface(int surface_texture_id, | |
235 int client_id) { | |
236 JNIEnv* env = AttachCurrentThread(); | |
237 DCHECK(env); | |
238 return gl::ScopedJavaSurface::AcquireExternalSurface( | |
239 Java_ChildProcessLauncher_getSurfaceTextureSurface( | |
240 env, surface_texture_id, client_id) | |
241 .obj()); | |
242 } | |
243 | |
244 jboolean IsSingleProcess(JNIEnv* env, const JavaParamRef<jclass>& clazz) { | 218 jboolean IsSingleProcess(JNIEnv* env, const JavaParamRef<jclass>& clazz) { |
245 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 219 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
246 switches::kSingleProcess); | 220 switches::kSingleProcess); |
247 } | 221 } |
248 | 222 |
249 base::android::ScopedJavaLocalRef<jobject> GetViewSurface(JNIEnv* env, | 223 base::android::ScopedJavaLocalRef<jobject> GetViewSurface(JNIEnv* env, |
250 const base::android::JavaParamRef<jclass>& jcaller, | 224 const base::android::JavaParamRef<jclass>& jcaller, |
251 jint surface_id) { | 225 jint surface_id) { |
252 gl::ScopedJavaSurface surface_view = | 226 gl::ScopedJavaSurface surface_view = |
253 gpu::GpuSurfaceTracker::GetInstance()->AcquireJavaSurface(surface_id); | 227 gpu::GpuSurfaceTracker::GetInstance()->AcquireJavaSurface(surface_id); |
254 return base::android::ScopedJavaLocalRef<jobject>(surface_view.j_surface()); | 228 return base::android::ScopedJavaLocalRef<jobject>(surface_view.j_surface()); |
255 } | 229 } |
256 | 230 |
257 bool RegisterChildProcessLauncher(JNIEnv* env) { | 231 bool RegisterChildProcessLauncher(JNIEnv* env) { |
258 return RegisterNativesImpl(env); | 232 return RegisterNativesImpl(env); |
259 } | 233 } |
260 | 234 |
261 } // namespace content | 235 } // namespace content |
OLD | NEW |