| 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.os.Bundle; | 11 import android.os.Bundle; |
| 12 import android.os.IBinder; |
| 12 import android.os.ParcelFileDescriptor; | 13 import android.os.ParcelFileDescriptor; |
| 13 import android.os.RemoteException; | 14 import android.os.RemoteException; |
| 14 import android.text.TextUtils; | 15 import android.text.TextUtils; |
| 15 import android.view.Surface; | 16 import android.view.Surface; |
| 16 | 17 |
| 17 import org.chromium.base.CommandLine; | 18 import org.chromium.base.CommandLine; |
| 18 import org.chromium.base.CpuFeatures; | 19 import org.chromium.base.CpuFeatures; |
| 19 import org.chromium.base.Log; | 20 import org.chromium.base.Log; |
| 20 import org.chromium.base.ThreadUtils; | 21 import org.chromium.base.ThreadUtils; |
| 21 import org.chromium.base.TraceEvent; | 22 import org.chromium.base.TraceEvent; |
| 22 import org.chromium.base.UnguessableToken; | 23 import org.chromium.base.UnguessableToken; |
| 23 import org.chromium.base.VisibleForTesting; | 24 import org.chromium.base.VisibleForTesting; |
| 24 import org.chromium.base.annotations.CalledByNative; | 25 import org.chromium.base.annotations.CalledByNative; |
| 25 import org.chromium.base.annotations.JNINamespace; | 26 import org.chromium.base.annotations.JNINamespace; |
| 26 import org.chromium.base.library_loader.Linker; | 27 import org.chromium.base.library_loader.Linker; |
| 27 import org.chromium.content.app.ChromiumLinkerParams; | 28 import org.chromium.content.app.ChromiumLinkerParams; |
| 28 import org.chromium.content.app.PrivilegedProcessService; | 29 import org.chromium.content.app.PrivilegedProcessService; |
| 29 import org.chromium.content.app.SandboxedProcessService; | 30 import org.chromium.content.app.SandboxedProcessService; |
| 31 import org.chromium.content.browser.androidoverlay.AndroidOverlayProviderImpl; |
| 30 import org.chromium.content.common.ContentSwitches; | 32 import org.chromium.content.common.ContentSwitches; |
| 31 import org.chromium.content.common.FileDescriptorInfo; | 33 import org.chromium.content.common.FileDescriptorInfo; |
| 32 import org.chromium.content.common.IChildProcessCallback; | 34 import org.chromium.content.common.IChildProcessCallback; |
| 33 import org.chromium.content.common.SurfaceWrapper; | 35 import org.chromium.content.common.SurfaceWrapper; |
| 34 | 36 |
| 35 import java.io.IOException; | 37 import java.io.IOException; |
| 36 import java.util.ArrayList; | 38 import java.util.ArrayList; |
| 37 import java.util.LinkedList; | 39 import java.util.LinkedList; |
| 38 import java.util.Map; | 40 import java.util.Map; |
| 39 import java.util.Queue; | 41 import java.util.Queue; |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 if (callbackType != CALLBACK_FOR_GPU_PROCESS) { | 818 if (callbackType != CALLBACK_FOR_GPU_PROCESS) { |
| 817 Log.e(TAG, "Illegal callback for non-GPU process."); | 819 Log.e(TAG, "Illegal callback for non-GPU process."); |
| 818 return null; | 820 return null; |
| 819 } | 821 } |
| 820 Surface surface = ChildProcessLauncher.nativeGetViewSurface(surf
aceId); | 822 Surface surface = ChildProcessLauncher.nativeGetViewSurface(surf
aceId); |
| 821 if (surface == null) { | 823 if (surface == null) { |
| 822 return null; | 824 return null; |
| 823 } | 825 } |
| 824 return new SurfaceWrapper(surface); | 826 return new SurfaceWrapper(surface); |
| 825 } | 827 } |
| 828 |
| 829 @Override |
| 830 public IBinder getAndroidOverlayProvider() { |
| 831 if (callbackType != CALLBACK_FOR_GPU_PROCESS) { |
| 832 Log.e(TAG, "Illegal callback for non-GPU process."); |
| 833 return null; |
| 834 } |
| 835 return AndroidOverlayProviderImpl.getInstance(); |
| 836 } |
| 826 }; | 837 }; |
| 827 } | 838 } |
| 828 | 839 |
| 829 static void logPidWarning(int pid, String message) { | 840 static void logPidWarning(int pid, String message) { |
| 830 // This class is effectively a no-op in single process mode, so don't lo
g warnings there. | 841 // This class is effectively a no-op in single process mode, so don't lo
g warnings there. |
| 831 if (pid > 0 && !nativeIsSingleProcess()) { | 842 if (pid > 0 && !nativeIsSingleProcess()) { |
| 832 Log.w(TAG, "%s, pid=%d", message, pid); | 843 Log.w(TAG, "%s, pid=%d", message, pid); |
| 833 } | 844 } |
| 834 } | 845 } |
| 835 | 846 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 } | 924 } |
| 914 | 925 |
| 915 private static native void nativeOnChildProcessStarted(long clientContext, i
nt pid); | 926 private static native void nativeOnChildProcessStarted(long clientContext, i
nt pid); |
| 916 private static native void nativeEstablishSurfacePeer( | 927 private static native void nativeEstablishSurfacePeer( |
| 917 int pid, Surface surface, int primaryID, int secondaryID); | 928 int pid, Surface surface, int primaryID, int secondaryID); |
| 918 private static native void nativeCompleteScopedSurfaceRequest( | 929 private static native void nativeCompleteScopedSurfaceRequest( |
| 919 UnguessableToken requestToken, Surface surface); | 930 UnguessableToken requestToken, Surface surface); |
| 920 private static native boolean nativeIsSingleProcess(); | 931 private static native boolean nativeIsSingleProcess(); |
| 921 private static native Surface nativeGetViewSurface(int surfaceId); | 932 private static native Surface nativeGetViewSurface(int surfaceId); |
| 922 } | 933 } |
| OLD | NEW |