Index: content/browser/android/child_process_launcher_android.cc |
diff --git a/content/browser/android/child_process_launcher_android.cc b/content/browser/android/child_process_launcher_android.cc |
index d3e8ee589ef18186b95e8061c41e73e07cb11a59..9ca5a6aa9428b8a3f63402e467b4b9f20f458afd 100644 |
--- a/content/browser/android/child_process_launcher_android.cc |
+++ b/content/browser/android/child_process_launcher_android.cc |
@@ -25,6 +25,7 @@ |
#include "content/public/browser/render_process_host.h" |
#include "content/public/common/content_client.h" |
#include "content/public/common/content_switches.h" |
+#include "gpu/ipc/common/android/scoped_surface_request_manager.h" |
#include "jni/ChildProcessLauncher_jni.h" |
#include "media/base/android/media_player_android.h" |
#include "ui/gl/android/surface_texture.h" |
@@ -90,6 +91,19 @@ static void SetSurfacePeer( |
} |
} |
+static void GetAndCompleteScopedSurfaceRequest( |
+ const base::android::JavaRef<jobject>& surface, |
+ uint64_t request_id) { |
+ gpu::ScopedSurfaceRequestManager::ScopedSurfaceRequestCB surface_request = |
+ gpu::ScopedSurfaceRequestManager::GetInstance() |
+ ->GetAndUnregisterScopedSurfaceRequest(request_id); |
+ |
+ if (!surface_request.is_null()) { |
+ gl::ScopedJavaSurface scoped_surface(surface); |
+ surface_request.Run(std::move(scoped_surface)); |
+ } |
+} |
+ |
void LaunchDownloadProcess(base::CommandLine* cmd_line) { |
std::unique_ptr<base::CommandLine> cmd_line_deleter(cmd_line); |
@@ -236,6 +250,21 @@ void EstablishSurfacePeer(JNIEnv* env, |
&SetSurfacePeer, jsurface, pid, primary_id, secondary_id)); |
} |
+void CompleteScopedSurfaceRequest(JNIEnv* env, |
+ const JavaParamRef<jclass>& clazz, |
+ jlong request_id, |
+ const JavaParamRef<jobject>& surface) { |
+ ScopedJavaGlobalRef<jobject> jsurface; |
+ jsurface.Reset(env, surface); |
+ if (jsurface.is_null()) |
+ return; |
+ |
+ DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ BrowserThread::PostTask( |
+ BrowserThread::UI, FROM_HERE, |
+ base::Bind(&GetAndCompleteScopedSurfaceRequest, jsurface, request_id)); |
+} |
+ |
void RegisterViewSurface(int surface_id, jobject j_surface) { |
JNIEnv* env = AttachCurrentThread(); |
DCHECK(env); |