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