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

Unified Diff: content/browser/android/child_process_launcher_android.cc

Issue 2285593002: Add ScopedSurfaceRequestManager (Closed)
Patch Set: Fixed signed/unsigned in UTs Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698