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

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: 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..4d73964b107ab04bedc8f3b5cd05802062192f0f 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
@@ -259,17 +259,31 @@ public class ChildProcessLauncher {
@CalledByNative
private static void registerSurfaceTexture(
- int surfaceTextureId, int childProcessId, SurfaceTexture surfaceTexture) {
- Pair<Integer, Integer> key = new Pair<Integer, Integer>(surfaceTextureId, childProcessId);
+ int surfaceTextureId, int clientId, SurfaceTexture surfaceTexture) {
+ Pair<Integer, Integer> key = new Pair<Integer, Integer>(surfaceTextureId, clientId);
sSurfaceTextureSurfaceMap.put(key, new Surface(surfaceTexture));
}
@CalledByNative
- private static void unregisterSurfaceTexture(int surfaceTextureId, int childProcessId) {
- Pair<Integer, Integer> key = new Pair<Integer, Integer>(surfaceTextureId, childProcessId);
+ private static void unregisterSurfaceTexture(int surfaceTextureId, int clientId) {
+ Pair<Integer, Integer> key = new Pair<Integer, Integer>(surfaceTextureId, clientId);
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,20 +501,43 @@ 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;
+ }
+
+ Pair<Integer, Integer> key = new Pair<Integer, Integer>(surfaceTextureId, clientId);
+ sSurfaceTextureSurfaceMap.put(key, 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;
+ }
+
+ Pair<Integer, Integer> key = new Pair<Integer, Integer>(surfaceTextureId, clientId);
+ sSurfaceTextureSurfaceMap.remove(key);
+ }
+
+ @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);
+ Pair<Integer, Integer> key = new Pair<Integer, Integer>(surfaceTextureId, clientId);
no sievers 2014/10/06 22:28:27 nit: Can you call the methods above in ChildProces
reveman 2014/10/07 01:00:21 Done.
+ Surface surface = sSurfaceTextureSurfaceMap.get(key);
if (surface == null) {
Log.e(TAG, "Invalid Id for surface texture.");
return null;

Powered by Google App Engine
This is Rietveld 408576698