Chromium Code Reviews| 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); |
| } |
| }; |
| } |