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.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
8 import android.content.ComponentName; | 8 import android.content.ComponentName; |
9 import android.content.Context; | 9 import android.content.Context; |
10 import android.content.Intent; | 10 import android.content.Intent; |
11 import android.content.pm.ApplicationInfo; | 11 import android.content.pm.ApplicationInfo; |
12 import android.content.pm.PackageManager; | 12 import android.content.pm.PackageManager; |
13 import android.graphics.SurfaceTexture; | 13 import android.graphics.SurfaceTexture; |
14 import android.os.Build; | 14 import android.os.Build; |
15 import android.os.Bundle; | 15 import android.os.Bundle; |
| 16 import android.os.IBinder; |
16 import android.os.ParcelFileDescriptor; | 17 import android.os.ParcelFileDescriptor; |
17 import android.os.RemoteException; | 18 import android.os.RemoteException; |
18 import android.text.TextUtils; | 19 import android.text.TextUtils; |
19 import android.util.Pair; | 20 import android.util.Pair; |
20 import android.view.Surface; | 21 import android.view.Surface; |
21 | 22 |
22 import org.chromium.base.CommandLine; | 23 import org.chromium.base.CommandLine; |
23 import org.chromium.base.CpuFeatures; | 24 import org.chromium.base.CpuFeatures; |
24 import org.chromium.base.Log; | 25 import org.chromium.base.Log; |
25 import org.chromium.base.ThreadUtils; | 26 import org.chromium.base.ThreadUtils; |
26 import org.chromium.base.TraceEvent; | 27 import org.chromium.base.TraceEvent; |
27 import org.chromium.base.VisibleForTesting; | 28 import org.chromium.base.VisibleForTesting; |
28 import org.chromium.base.annotations.CalledByNative; | 29 import org.chromium.base.annotations.CalledByNative; |
29 import org.chromium.base.annotations.JNINamespace; | 30 import org.chromium.base.annotations.JNINamespace; |
30 import org.chromium.base.library_loader.Linker; | 31 import org.chromium.base.library_loader.Linker; |
31 import org.chromium.content.app.ChromiumLinkerParams; | 32 import org.chromium.content.app.ChromiumLinkerParams; |
32 import org.chromium.content.app.DownloadProcessService; | 33 import org.chromium.content.app.DownloadProcessService; |
33 import org.chromium.content.app.PrivilegedProcessService; | 34 import org.chromium.content.app.PrivilegedProcessService; |
34 import org.chromium.content.app.SandboxedProcessService; | 35 import org.chromium.content.app.SandboxedProcessService; |
35 import org.chromium.content.common.ContentSwitches; | 36 import org.chromium.content.common.ContentSwitches; |
36 import org.chromium.content.common.IChildProcessCallback; | 37 import org.chromium.content.common.IChildProcessCallback; |
37 import org.chromium.content.common.SurfaceWrapper; | 38 import org.chromium.content.common.SurfaceWrapper; |
| 39 import org.chromium.media.DialogSurfaceManager; |
38 | 40 |
39 import java.io.IOException; | 41 import java.io.IOException; |
40 import java.util.ArrayList; | 42 import java.util.ArrayList; |
41 import java.util.LinkedList; | 43 import java.util.LinkedList; |
42 import java.util.Map; | 44 import java.util.Map; |
43 import java.util.Queue; | 45 import java.util.Queue; |
44 import java.util.concurrent.ConcurrentHashMap; | 46 import java.util.concurrent.ConcurrentHashMap; |
45 | 47 |
46 /** | 48 /** |
47 * This class provides the method to start/stop ChildProcess called by native. | 49 * This class provides the method to start/stop ChildProcess called by native. |
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 } | 962 } |
961 | 963 |
962 @Override | 964 @Override |
963 public void onDownloadStarted(boolean started, int downloadId) { | 965 public void onDownloadStarted(boolean started, int downloadId) { |
964 // TODO(qinmin): call native to cancel or proceed with the downl
oad. | 966 // TODO(qinmin): call native to cancel or proceed with the downl
oad. |
965 if (callbackType != CALLBACK_FOR_DOWNLOAD_PROCESS) { | 967 if (callbackType != CALLBACK_FOR_DOWNLOAD_PROCESS) { |
966 Log.e(TAG, "Illegal callback for non-download process."); | 968 Log.e(TAG, "Illegal callback for non-download process."); |
967 return; | 969 return; |
968 } | 970 } |
969 } | 971 } |
| 972 |
| 973 @Override |
| 974 public IBinder getDialogSurfaceManager() { |
| 975 if (callbackType != CALLBACK_FOR_GPU_PROCESS) { |
| 976 Log.e(TAG, "Illegal callback for non-GPU process."); |
| 977 return null; |
| 978 } |
| 979 // We create a new one of these every time, but it's only |
| 980 // retained if DialogSurfaceManager really needs it. Also, it's |
| 981 // likely that we're only called once anyway. |
| 982 return DialogSurfaceManager.instance(new DialogSurfaceActivityMa
pper()); |
| 983 } |
970 }; | 984 }; |
971 } | 985 } |
972 | 986 |
973 static void logPidWarning(int pid, String message) { | 987 static void logPidWarning(int pid, String message) { |
974 // This class is effectively a no-op in single process mode, so don't lo
g warnings there. | 988 // This class is effectively a no-op in single process mode, so don't lo
g warnings there. |
975 if (pid > 0 && !nativeIsSingleProcess()) { | 989 if (pid > 0 && !nativeIsSingleProcess()) { |
976 Log.w(TAG, "%s, pid=%d", message, pid); | 990 Log.w(TAG, "%s, pid=%d", message, pid); |
977 } | 991 } |
978 } | 992 } |
979 | 993 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 } | 1068 } |
1055 | 1069 |
1056 return true; | 1070 return true; |
1057 } | 1071 } |
1058 | 1072 |
1059 private static native void nativeOnChildProcessStarted(long clientContext, i
nt pid); | 1073 private static native void nativeOnChildProcessStarted(long clientContext, i
nt pid); |
1060 private static native void nativeEstablishSurfacePeer( | 1074 private static native void nativeEstablishSurfacePeer( |
1061 int pid, Surface surface, int primaryID, int secondaryID); | 1075 int pid, Surface surface, int primaryID, int secondaryID); |
1062 private static native boolean nativeIsSingleProcess(); | 1076 private static native boolean nativeIsSingleProcess(); |
1063 } | 1077 } |
OLD | NEW |