| 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 3088b167aa357309421fb6efa99c398c2927aa46..d80b495a94f8f151b05a94e1af0c8afb8bc90a24 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
|
| @@ -502,6 +502,10 @@ public class ChildProcessLauncher {
|
| private static Map<Pair<Integer, Integer>, Surface> sSurfaceTextureSurfaceMap =
|
| new ConcurrentHashMap<Pair<Integer, Integer>, Surface>();
|
|
|
| + // Map from browser surface texture id to Surface.
|
| + private static Map<Integer, Surface> sBrowserSurfaceTextureSurfaceMap =
|
| + new ConcurrentHashMap<Integer, Surface>();
|
| +
|
| // Whether the main application is currently brought to the foreground.
|
| private static boolean sApplicationInForeground = true;
|
|
|
| @@ -557,6 +561,19 @@ public class ChildProcessLauncher {
|
| surface.release();
|
| }
|
|
|
| + private static void registerBrowserSurfaceTextureSurface(
|
| + int surfaceTextureId, Surface surface) {
|
| + sBrowserSurfaceTextureSurfaceMap.put(surfaceTextureId, surface);
|
| + }
|
| +
|
| + private static void unregisterBrowserSurfaceTextureSurface(int surfaceTextureId) {
|
| + Surface surface = sBrowserSurfaceTextureSurfaceMap.remove(surfaceTextureId);
|
| + if (surface == null) return;
|
| +
|
| + assert surface.isValid();
|
| + surface.release();
|
| + }
|
| +
|
| @CalledByNative
|
| private static void createSurfaceTextureSurface(
|
| int surfaceTextureId, int clientId, SurfaceTexture surfaceTexture) {
|
| @@ -582,6 +599,17 @@ public class ChildProcessLauncher {
|
| return new SurfaceWrapper(surface);
|
| }
|
|
|
| + @CalledByNative
|
| + private static Surface getBrowserSurfaceTextureSurface(int surfaceTextureId) {
|
| + Surface surface = sBrowserSurfaceTextureSurfaceMap.get(surfaceTextureId);
|
| + if (surface == null) {
|
| + Log.e(TAG, "Invalid Id for browser surface texture.");
|
| + return null;
|
| + }
|
| + assert surface.isValid();
|
| + return surface;
|
| + }
|
| +
|
| /**
|
| * Sets the visibility of the child process when it changes or when it is determined for the
|
| * first time.
|
| @@ -938,8 +966,19 @@ public class ChildProcessLauncher {
|
| }
|
|
|
| @Override
|
| - public void unregisterSurfaceTextureSurface(
|
| - int surfaceTextureId, int clientId) {
|
| + public void registerBrowserSurfaceTextureSurface(
|
| + int surfaceTextureId, Surface surface) {
|
| + if (callbackType != CALLBACK_FOR_GPU_PROCESS) {
|
| + Log.e(TAG, "Illegal callback for non-GPU process.");
|
| + return;
|
| + }
|
| +
|
| + ChildProcessLauncher.registerBrowserSurfaceTextureSurface(
|
| + surfaceTextureId, 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;
|
| @@ -949,6 +988,16 @@ public class ChildProcessLauncher {
|
| }
|
|
|
| @Override
|
| + public void unregisterBrowserSurfaceTextureSurface(int surfaceTextureId) {
|
| + if (callbackType != CALLBACK_FOR_GPU_PROCESS) {
|
| + Log.e(TAG, "Illegal callback for non-GPU process.");
|
| + return;
|
| + }
|
| +
|
| + ChildProcessLauncher.unregisterBrowserSurfaceTextureSurface(surfaceTextureId);
|
| + }
|
| +
|
| + @Override
|
| public SurfaceWrapper getSurfaceTextureSurface(int surfaceTextureId) {
|
| if (callbackType != CALLBACK_FOR_RENDERER_PROCESS) {
|
| Log.e(TAG, "Illegal callback for non-renderer process.");
|
|
|