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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java

Issue 634643002: content: Out-of-process GPU service support for SurfaceTexture backed GpuMemoryBuffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and address some review feedback Created 6 years, 2 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/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java b/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java
index 286afbca7d4a2eef71388924b3238c1e225a8bab..1447725063f76cf91d0ebf90e4c0cfe161ccdc0f 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java
@@ -5,7 +5,6 @@
package org.chromium.content.browser;
import android.content.Context;
-import android.graphics.SurfaceTexture;
import android.os.RemoteException;
import android.util.Log;
import android.util.Pair;
@@ -258,18 +257,32 @@ public class ChildProcessLauncher {
}
@CalledByNative
- private static void registerSurfaceTexture(
- int surfaceTextureId, int childProcessId, SurfaceTexture surfaceTexture) {
- Pair<Integer, Integer> key = new Pair<Integer, Integer>(surfaceTextureId, childProcessId);
- sSurfaceTextureSurfaceMap.put(key, new Surface(surfaceTexture));
+ private static void registerSurfaceTextureSurface(
+ int surfaceTextureId, int clientId, Surface surface) {
+ Pair<Integer, Integer> key = new Pair<Integer, Integer>(surfaceTextureId, clientId);
+ sSurfaceTextureSurfaceMap.put(key, surface);
}
@CalledByNative
- private static void unregisterSurfaceTexture(int surfaceTextureId, int childProcessId) {
- Pair<Integer, Integer> key = new Pair<Integer, Integer>(surfaceTextureId, childProcessId);
+ private static void unregisterSurfaceTextureSurface(int surfaceTextureId, int clientId) {
+ Pair<Integer, Integer> key = new Pair<Integer, Integer>(surfaceTextureId, clientId);
no sievers 2014/10/07 22:23:25 Also here I think you should call release() on the
reveman 2014/10/08 15:56:39 Done.
sSurfaceTextureSurfaceMap.remove(key);
}
+ @CalledByNative
+ private static SurfaceWrapper getSurfaceTextureSurface(
+ int surfaceTextureId, int clientId) {
+ Pair<Integer, Integer> key = new Pair<Integer, Integer>(surfaceTextureId, clientId);
+
+ Surface surface = sSurfaceTextureSurfaceMap.get(key);
+ if (surface == null) {
+ Log.e(TAG, "Invalid Id for surface texture.");
+ return null;
+ }
+ assert surface.isValid();
+ return new SurfaceWrapper(surface);
+ }
+
/**
* Sets the visibility of the child process when it changes or when it is determined for the
* first time.
@@ -487,26 +500,41 @@ public class ChildProcessLauncher {
}
@Override
- public SurfaceWrapper getSurfaceTextureSurface(int primaryId, int secondaryId) {
+ public void registerSurfaceTextureSurface(
+ int surfaceTextureId, int clientId, Surface surface) {
+ if (callbackType != CALLBACK_FOR_GPU_PROCESS) {
+ Log.e(TAG, "Illegal callback for non-GPU process.");
+ return;
+ }
+
+ ChildProcessLauncher.registerSurfaceTextureSurface(surfaceTextureId, clientId,
+ surface);
+ }
+
+ @Override
+ public void unregisterSurfaceTextureSurface(
+ int surfaceTextureId, int clientId) {
+ if (callbackType != CALLBACK_FOR_GPU_PROCESS) {
+ Log.e(TAG, "Illegal callback for non-GPU process.");
+ return;
+ }
+
+ ChildProcessLauncher.unregisterSurfaceTextureSurface(surfaceTextureId, clientId);
+ }
+
+ @Override
+ public SurfaceWrapper getSurfaceTextureSurface(int surfaceTextureId, int clientId) {
if (callbackType != CALLBACK_FOR_RENDERER_PROCESS) {
Log.e(TAG, "Illegal callback for non-renderer process.");
return null;
}
- if (secondaryId != childProcessId) {
+ if (clientId != childProcessId) {
Log.e(TAG, "Illegal secondaryId for renderer process.");
return null;
}
- Pair<Integer, Integer> key = new Pair<Integer, Integer>(primaryId, secondaryId);
- // Note: This removes the surface and passes the ownership to the caller.
- Surface surface = sSurfaceTextureSurfaceMap.remove(key);
- if (surface == null) {
- Log.e(TAG, "Invalid Id for surface texture.");
- return null;
- }
- assert surface.isValid();
- return new SurfaceWrapper(surface);
+ return ChildProcessLauncher.getSurfaceTextureSurface(surfaceTextureId, clientId);
}
};
}

Powered by Google App Engine
This is Rietveld 408576698