| 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.Context; | 8 import android.content.Context; |
| 9 import android.content.Intent; | 9 import android.content.Intent; |
| 10 import android.content.pm.ApplicationInfo; | 10 import android.content.pm.ApplicationInfo; |
| 11 import android.content.pm.PackageManager; | 11 import android.content.pm.PackageManager; |
| 12 import android.graphics.SurfaceTexture; | 12 import android.graphics.SurfaceTexture; |
| 13 import android.os.Build; | 13 import android.os.Build; |
| 14 import android.os.Bundle; | 14 import android.os.Bundle; |
| 15 import android.os.IBinder; |
| 15 import android.os.ParcelFileDescriptor; | 16 import android.os.ParcelFileDescriptor; |
| 16 import android.os.RemoteException; | 17 import android.os.RemoteException; |
| 17 import android.text.TextUtils; | 18 import android.text.TextUtils; |
| 18 import android.util.Pair; | 19 import android.util.Pair; |
| 19 import android.view.Surface; | 20 import android.view.Surface; |
| 20 | 21 |
| 21 import org.chromium.base.CommandLine; | 22 import org.chromium.base.CommandLine; |
| 22 import org.chromium.base.CpuFeatures; | 23 import org.chromium.base.CpuFeatures; |
| 23 import org.chromium.base.Log; | 24 import org.chromium.base.Log; |
| 24 import org.chromium.base.ThreadUtils; | 25 import org.chromium.base.ThreadUtils; |
| 25 import org.chromium.base.TraceEvent; | 26 import org.chromium.base.TraceEvent; |
| 26 import org.chromium.base.VisibleForTesting; | 27 import org.chromium.base.VisibleForTesting; |
| 27 import org.chromium.base.annotations.CalledByNative; | 28 import org.chromium.base.annotations.CalledByNative; |
| 28 import org.chromium.base.annotations.JNINamespace; | 29 import org.chromium.base.annotations.JNINamespace; |
| 29 import org.chromium.base.library_loader.Linker; | 30 import org.chromium.base.library_loader.Linker; |
| 30 import org.chromium.content.app.ChildProcessService; | 31 import org.chromium.content.app.ChildProcessService; |
| 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 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 } | 832 } |
| 831 | 833 |
| 832 @Override | 834 @Override |
| 833 public void onDownloadStarted(boolean started, int downloadId) { | 835 public void onDownloadStarted(boolean started, int downloadId) { |
| 834 // TODO(qinmin): call native to cancel or proceed with the downl
oad. | 836 // TODO(qinmin): call native to cancel or proceed with the downl
oad. |
| 835 if (callbackType != CALLBACK_FOR_DOWNLOAD_PROCESS) { | 837 if (callbackType != CALLBACK_FOR_DOWNLOAD_PROCESS) { |
| 836 Log.e(TAG, "Illegal callback for non-download process."); | 838 Log.e(TAG, "Illegal callback for non-download process."); |
| 837 return; | 839 return; |
| 838 } | 840 } |
| 839 } | 841 } |
| 842 |
| 843 @Override |
| 844 public IBinder getDialogSurfaceManager() { |
| 845 if (callbackType != CALLBACK_FOR_GPU_PROCESS) { |
| 846 Log.e(TAG, "Illegal callback for non-GPU process."); |
| 847 return null; |
| 848 } |
| 849 return DialogSurfaceManager.instance(); |
| 850 } |
| 840 }; | 851 }; |
| 841 } | 852 } |
| 842 | 853 |
| 843 static void logPidWarning(int pid, String message) { | 854 static void logPidWarning(int pid, String message) { |
| 844 // This class is effectively a no-op in single process mode, so don't lo
g warnings there. | 855 // This class is effectively a no-op in single process mode, so don't lo
g warnings there. |
| 845 if (pid > 0 && !nativeIsSingleProcess()) { | 856 if (pid > 0 && !nativeIsSingleProcess()) { |
| 846 Log.w(TAG, "%s, pid=%d", message, pid); | 857 Log.w(TAG, "%s, pid=%d", message, pid); |
| 847 } | 858 } |
| 848 } | 859 } |
| 849 | 860 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 } | 910 } |
| 900 | 911 |
| 901 return true; | 912 return true; |
| 902 } | 913 } |
| 903 | 914 |
| 904 private static native void nativeOnChildProcessStarted(long clientContext, i
nt pid); | 915 private static native void nativeOnChildProcessStarted(long clientContext, i
nt pid); |
| 905 private static native void nativeEstablishSurfacePeer( | 916 private static native void nativeEstablishSurfacePeer( |
| 906 int pid, Surface surface, int primaryID, int secondaryID); | 917 int pid, Surface surface, int primaryID, int secondaryID); |
| 907 private static native boolean nativeIsSingleProcess(); | 918 private static native boolean nativeIsSingleProcess(); |
| 908 } | 919 } |
| OLD | NEW |