| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
| 6 | 6 |
| 7 import android.content.ComponentName; | 7 import android.content.ComponentName; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.content.pm.ApplicationInfo; | 9 import android.content.pm.ApplicationInfo; |
| 10 import android.content.pm.PackageManager; | 10 import android.content.pm.PackageManager; |
| 11 import android.graphics.SurfaceTexture; | 11 import android.graphics.SurfaceTexture; |
| 12 import android.os.Bundle; | 12 import android.os.Bundle; |
| 13 import android.os.IBinder; |
| 13 import android.os.ParcelFileDescriptor; | 14 import android.os.ParcelFileDescriptor; |
| 14 import android.os.RemoteException; | 15 import android.os.RemoteException; |
| 15 import android.text.TextUtils; | 16 import android.text.TextUtils; |
| 16 import android.util.Pair; | 17 import android.util.Pair; |
| 17 import android.view.Surface; | 18 import android.view.Surface; |
| 18 | 19 |
| 19 import org.chromium.base.CommandLine; | 20 import org.chromium.base.CommandLine; |
| 20 import org.chromium.base.CpuFeatures; | 21 import org.chromium.base.CpuFeatures; |
| 21 import org.chromium.base.Log; | 22 import org.chromium.base.Log; |
| 22 import org.chromium.base.ThreadUtils; | 23 import org.chromium.base.ThreadUtils; |
| 23 import org.chromium.base.TraceEvent; | 24 import org.chromium.base.TraceEvent; |
| 24 import org.chromium.base.VisibleForTesting; | 25 import org.chromium.base.VisibleForTesting; |
| 25 import org.chromium.base.annotations.CalledByNative; | 26 import org.chromium.base.annotations.CalledByNative; |
| 26 import org.chromium.base.annotations.JNINamespace; | 27 import org.chromium.base.annotations.JNINamespace; |
| 27 import org.chromium.base.library_loader.Linker; | 28 import org.chromium.base.library_loader.Linker; |
| 28 import org.chromium.content.app.ChromiumLinkerParams; | 29 import org.chromium.content.app.ChromiumLinkerParams; |
| 29 import org.chromium.content.app.PrivilegedProcessService; | 30 import org.chromium.content.app.PrivilegedProcessService; |
| 30 import org.chromium.content.app.SandboxedProcessService; | 31 import org.chromium.content.app.SandboxedProcessService; |
| 31 import org.chromium.content.common.ContentSwitches; | 32 import org.chromium.content.common.ContentSwitches; |
| 32 import org.chromium.content.common.FileDescriptorInfo; | 33 import org.chromium.content.common.FileDescriptorInfo; |
| 33 import org.chromium.content.common.IChildProcessCallback; | 34 import org.chromium.content.common.IChildProcessCallback; |
| 34 import org.chromium.content.common.SurfaceWrapper; | 35 import org.chromium.content.common.SurfaceWrapper; |
| 36 import org.chromium.media.DialogSurfaceManagerImpl; |
| 35 | 37 |
| 36 import java.io.IOException; | 38 import java.io.IOException; |
| 37 import java.util.ArrayList; | 39 import java.util.ArrayList; |
| 38 import java.util.LinkedList; | 40 import java.util.LinkedList; |
| 39 import java.util.Map; | 41 import java.util.Map; |
| 40 import java.util.Queue; | 42 import java.util.Queue; |
| 41 import java.util.concurrent.ConcurrentHashMap; | 43 import java.util.concurrent.ConcurrentHashMap; |
| 42 | 44 |
| 43 /** | 45 /** |
| 44 * This class provides the method to start/stop ChildProcess called by native. | 46 * This class provides the method to start/stop ChildProcess called by native. |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 @Override | 897 @Override |
| 896 public SurfaceWrapper getSurfaceTextureSurface(int surfaceTextureId)
{ | 898 public SurfaceWrapper getSurfaceTextureSurface(int surfaceTextureId)
{ |
| 897 if (callbackType != CALLBACK_FOR_RENDERER_PROCESS) { | 899 if (callbackType != CALLBACK_FOR_RENDERER_PROCESS) { |
| 898 Log.e(TAG, "Illegal callback for non-renderer process."); | 900 Log.e(TAG, "Illegal callback for non-renderer process."); |
| 899 return null; | 901 return null; |
| 900 } | 902 } |
| 901 | 903 |
| 902 return ChildProcessLauncher.getSurfaceTextureSurface(surfaceText
ureId, | 904 return ChildProcessLauncher.getSurfaceTextureSurface(surfaceText
ureId, |
| 903 childProcessId); | 905 childProcessId); |
| 904 } | 906 } |
| 907 |
| 908 @Override |
| 909 public IBinder getDialogSurfaceManager() { |
| 910 if (callbackType != CALLBACK_FOR_GPU_PROCESS) { |
| 911 Log.e(TAG, "Illegal callback for non-GPU process."); |
| 912 return null; |
| 913 } |
| 914 // We create a new one of these every time, but it's only |
| 915 // retained if DialogSurfaceManager really needs it. Also, it's |
| 916 // likely that we're only called once anyway. |
| 917 return DialogSurfaceManagerImpl.instance(new DialogSurfaceActivi
tyMapper()); |
| 918 } |
| 905 }; | 919 }; |
| 906 } | 920 } |
| 907 | 921 |
| 908 static void logPidWarning(int pid, String message) { | 922 static void logPidWarning(int pid, String message) { |
| 909 // This class is effectively a no-op in single process mode, so don't lo
g warnings there. | 923 // This class is effectively a no-op in single process mode, so don't lo
g warnings there. |
| 910 if (pid > 0 && !nativeIsSingleProcess()) { | 924 if (pid > 0 && !nativeIsSingleProcess()) { |
| 911 Log.w(TAG, "%s, pid=%d", message, pid); | 925 Log.w(TAG, "%s, pid=%d", message, pid); |
| 912 } | 926 } |
| 913 } | 927 } |
| 914 | 928 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 } | 1006 } |
| 993 | 1007 |
| 994 private static native void nativeOnChildProcessStarted(long clientContext, i
nt pid); | 1008 private static native void nativeOnChildProcessStarted(long clientContext, i
nt pid); |
| 995 private static native void nativeEstablishSurfacePeer( | 1009 private static native void nativeEstablishSurfacePeer( |
| 996 int pid, Surface surface, int primaryID, int secondaryID); | 1010 int pid, Surface surface, int primaryID, int secondaryID); |
| 997 private static native void nativeCompleteScopedSurfaceRequest( | 1011 private static native void nativeCompleteScopedSurfaceRequest( |
| 998 long requestTokenHigh, long requestTokenLow, Surface surface); | 1012 long requestTokenHigh, long requestTokenLow, Surface surface); |
| 999 private static native boolean nativeIsSingleProcess(); | 1013 private static native boolean nativeIsSingleProcess(); |
| 1000 private static native Surface nativeGetViewSurface(int surfaceId); | 1014 private static native Surface nativeGetViewSurface(int surfaceId); |
| 1001 } | 1015 } |
| OLD | NEW |