Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java

Issue 2178973004: DialogSurfaceManager implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed IDialogSurfaceActivityMapper from common.aidl Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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;
30 import org.chromium.content.common.ContentSwitches; 31 import org.chromium.content.common.ContentSwitches;
31 import org.chromium.content.common.FileDescriptorInfo; 32 import org.chromium.content.common.FileDescriptorInfo;
32 import org.chromium.content.common.IChildProcessCallback; 33 import org.chromium.content.common.IChildProcessCallback;
33 import org.chromium.content.common.SurfaceWrapper; 34 import org.chromium.content.common.SurfaceWrapper;
35 import org.chromium.media.DialogSurfaceManagerImpl;
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;
40 import java.util.concurrent.ConcurrentHashMap; 42 import java.util.concurrent.ConcurrentHashMap;
41 43
42 /** 44 /**
43 * This class provides the method to start/stop ChildProcess called by native. 45 * This class provides the method to start/stop ChildProcess called by native.
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 getDialogSurfaceManager() {
831 if (callbackType != CALLBACK_FOR_GPU_PROCESS) {
832 Log.e(TAG, "Illegal callback for non-GPU process.");
833 return null;
834 }
835 // We create a new one of these every time, but it's only
836 // retained if DialogSurfaceManager really needs it. Also, it's
837 // likely that we're only called once anyway.
838 return DialogSurfaceManagerImpl.instance(
boliu 2017/01/04 23:14:39 getInstance a bit more idiomatic I think
liberato (no reviews please) 2017/01/11 22:17:55 Done.
839 new DialogSurfaceWindowTokenProviderImpl());
840 }
826 }; 841 };
827 } 842 }
828 843
829 static void logPidWarning(int pid, String message) { 844 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. 845 // This class is effectively a no-op in single process mode, so don't lo g warnings there.
831 if (pid > 0 && !nativeIsSingleProcess()) { 846 if (pid > 0 && !nativeIsSingleProcess()) {
832 Log.w(TAG, "%s, pid=%d", message, pid); 847 Log.w(TAG, "%s, pid=%d", message, pid);
833 } 848 }
834 } 849 }
835 850
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 } 928 }
914 929
915 private static native void nativeOnChildProcessStarted(long clientContext, i nt pid); 930 private static native void nativeOnChildProcessStarted(long clientContext, i nt pid);
916 private static native void nativeEstablishSurfacePeer( 931 private static native void nativeEstablishSurfacePeer(
917 int pid, Surface surface, int primaryID, int secondaryID); 932 int pid, Surface surface, int primaryID, int secondaryID);
918 private static native void nativeCompleteScopedSurfaceRequest( 933 private static native void nativeCompleteScopedSurfaceRequest(
919 UnguessableToken requestToken, Surface surface); 934 UnguessableToken requestToken, Surface surface);
920 private static native boolean nativeIsSingleProcess(); 935 private static native boolean nativeIsSingleProcess();
921 private static native Surface nativeGetViewSurface(int surfaceId); 936 private static native Surface nativeGetViewSurface(int surfaceId);
922 } 937 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698