Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: content/browser/android/gpu_process_callback.cc

Issue 2760093002: Making callbacks in Android ChildProcessLauncher generic. (Closed)
Patch Set: Synced Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/android/gpu_process_callback.h"
6
7 #include "base/android/scoped_java_ref.h"
8 #include "base/android/unguessable_token_android.h"
9 #include "content/browser/android/scoped_surface_request_manager.h"
10 #include "content/public/browser/browser_thread.h"
11 #include "gpu/ipc/common/gpu_surface_tracker.h"
12
13 #include "jni/GpuProcessCallback_jni.h"
14
15 namespace content {
16
17 void CompleteScopedSurfaceRequest(
18 JNIEnv* env,
19 const base::android::JavaParamRef<jclass>& clazz,
20 const base::android::JavaParamRef<jobject>& token,
21 const base::android::JavaParamRef<jobject>& surface) {
22 base::UnguessableToken requestToken =
23 base::android::UnguessableTokenAndroid::FromJavaUnguessableToken(env,
24 token);
25 if (!requestToken) {
26 DLOG(ERROR) << "Received invalid surface request token.";
27 return;
28 }
29
30 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI));
31
32 base::android::ScopedJavaGlobalRef<jobject> jsurface;
33 jsurface.Reset(env, surface);
34 ScopedSurfaceRequestManager::GetInstance()->FulfillScopedSurfaceRequest(
35 requestToken, gl::ScopedJavaSurface(jsurface));
36 }
37
38 base::android::ScopedJavaLocalRef<jobject> GetViewSurface(
39 JNIEnv* env,
40 const base::android::JavaParamRef<jclass>& jcaller,
41 jint surface_id) {
42 gl::ScopedJavaSurface surface_view =
43 gpu::GpuSurfaceTracker::GetInstance()->AcquireJavaSurface(surface_id);
44 return base::android::ScopedJavaLocalRef<jobject>(surface_view.j_surface());
45 }
46
47 bool RegisterGpuProcessCallback(JNIEnv* env) {
48 return RegisterNativesImpl(env);
49 }
50
51 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/gpu_process_callback.h ('k') | content/browser/child_process_launcher_helper_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698