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

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

Issue 1953543002: Rename WebAPK related classes to be of the format *WebApk*.java (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months 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.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;
(...skipping 18 matching lines...) Expand all
29 import org.chromium.base.library_loader.LibraryProcessType; 29 import org.chromium.base.library_loader.LibraryProcessType;
30 import org.chromium.base.library_loader.Linker; 30 import org.chromium.base.library_loader.Linker;
31 import org.chromium.content.app.ChildProcessService; 31 import org.chromium.content.app.ChildProcessService;
32 import org.chromium.content.app.ChromiumLinkerParams; 32 import org.chromium.content.app.ChromiumLinkerParams;
33 import org.chromium.content.app.DownloadProcessService; 33 import org.chromium.content.app.DownloadProcessService;
34 import org.chromium.content.app.PrivilegedProcessService; 34 import org.chromium.content.app.PrivilegedProcessService;
35 import org.chromium.content.app.SandboxedProcessService; 35 import org.chromium.content.app.SandboxedProcessService;
36 import org.chromium.content.common.ContentSwitches; 36 import org.chromium.content.common.ContentSwitches;
37 import org.chromium.content.common.IChildProcessCallback; 37 import org.chromium.content.common.IChildProcessCallback;
38 import org.chromium.content.common.SurfaceWrapper; 38 import org.chromium.content.common.SurfaceWrapper;
39 import org.chromium.minting.lib.client.MintingStateParams; 39 import org.chromium.minting.lib.client.WebApkStateParams;
40 40
41 import java.io.IOException; 41 import java.io.IOException;
42 import java.util.ArrayList; 42 import java.util.ArrayList;
43 import java.util.HashMap; 43 import java.util.HashMap;
44 import java.util.LinkedList; 44 import java.util.LinkedList;
45 import java.util.List; 45 import java.util.List;
46 import java.util.Map; 46 import java.util.Map;
47 import java.util.Queue; 47 import java.util.Queue;
48 import java.util.concurrent.ConcurrentHashMap; 48 import java.util.concurrent.ConcurrentHashMap;
49 49
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 */ 121 */
122 public static void setChildProcessCreationParams(ChildProcessCreationParams params) { 122 public static void setChildProcessCreationParams(ChildProcessCreationParams params) {
123 assert params != null; 123 assert params != null;
124 sChildProcessCreationParams = params; 124 sChildProcessCreationParams = params;
125 } 125 }
126 126
127 private static void updateChildProcessCreationParams(Context context, 127 private static void updateChildProcessCreationParams(Context context,
128 String webAPKPackageName) { 128 String webAPKPackageName) {
129 int extraBindFlags = sChildProcessCreationParams != null 129 int extraBindFlags = sChildProcessCreationParams != null
130 ? sChildProcessCreationParams.mExtraBindFlags : 0; 130 ? sChildProcessCreationParams.mExtraBindFlags : 0;
131 // MintingStateParams isn't null for WebAPK renderer process only. In th is case, set 131 // WebApkStateParams isn't null for WebAPK renderer process only. In thi s case, set
132 // creation parameter as WebAPK's renderer process. 132 // creation parameter as WebAPK's renderer process.
133 if (webAPKPackageName != null) { 133 if (webAPKPackageName != null) {
134 setChildProcessCreationParams(new ChildProcessCreationParams( 134 setChildProcessCreationParams(new ChildProcessCreationParams(
135 webAPKPackageName, extraBindFlags, 135 webAPKPackageName, extraBindFlags,
136 LibraryProcessType.PROCESS_WEBAPK_CHILD)); 136 LibraryProcessType.PROCESS_WEBAPK_CHILD));
137 } else if (sChildProcessCreationParams == null 137 } else if (sChildProcessCreationParams == null
138 || sChildProcessCreationParams.mLibraryProcessType 138 || sChildProcessCreationParams.mLibraryProcessType
139 == LibraryProcessType.PROCESS_WEBAPK_CHILD) { 139 == LibraryProcessType.PROCESS_WEBAPK_CHILD) {
140 // For other cases that shouldn't use WebAPK's creation parameter, r eset 140 // For other cases that shouldn't use WebAPK's creation parameter, r eset
141 // sChildProcessCreationParams to default. 141 // sChildProcessCreationParams to default.
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 pFd = ParcelFileDescriptor.fromFd(fd); 701 pFd = ParcelFileDescriptor.fromFd(fd);
702 } catch (IOException e) { 702 } catch (IOException e) {
703 Log.e(TAG, "Invalid FD provided for process connection, aborting connection.", e); 703 Log.e(TAG, "Invalid FD provided for process connection, aborting connection.", e);
704 return null; 704 return null;
705 } 705 }
706 } 706 }
707 return new FileDescriptorInfo(id, pFd, offset, size); 707 return new FileDescriptorInfo(id, pFd, offset, size);
708 } 708 }
709 709
710 /** 710 /**
711 * Gets the MintingStateParams if the command line contains a switch: 711 * Gets the WebApkStateParams if the command line contains a switch:
712 * --use-minted-runtime=packageName. 712 * --use-minted-runtime=packageName.
713 * @param commandLine 713 * @param commandLine
714 * @return a MintingStateParams if the switch exists; null otherwise. 714 * @return a WebApkStateParams if the switch exists; null otherwise.
715 */ 715 */
716 private static MintingStateParams getMintingStateParams(String[] commandLine ) { 716 private static WebApkStateParams getWebApkStateParams(String[] commandLine) {
717 String value = ContentSwitches.getSwitchValue(commandLine, SWITCH_USE_MI NTED_RUNTIME); 717 String value = ContentSwitches.getSwitchValue(commandLine, SWITCH_USE_MI NTED_RUNTIME);
718 return value == null ? null : new MintingStateParams(true, value, null); 718 return value == null ? null : new WebApkStateParams(true, value, null);
719 } 719 }
720 720
721 /** 721 /**
722 * Spawns and connects to a child process. May be called on any thread. It w ill not block, but 722 * Spawns and connects to a child process. May be called on any thread. It w ill not block, but
723 * will instead callback to {@link #nativeOnChildProcessStarted} when the co nnection is 723 * will instead callback to {@link #nativeOnChildProcessStarted} when the co nnection is
724 * established. Note this callback will not necessarily be from the same thr ead (currently it 724 * established. Note this callback will not necessarily be from the same thr ead (currently it
725 * always comes from the main thread). 725 * always comes from the main thread).
726 * 726 *
727 * @param context Context used to obtain the application context. 727 * @param context Context used to obtain the application context.
728 * @param commandLine The child process command line argv. 728 * @param commandLine The child process command line argv.
(...skipping 14 matching lines...) Expand all
743 } else if (ContentSwitches.SWITCH_GPU_PROCESS.equals(processType)) { 743 } else if (ContentSwitches.SWITCH_GPU_PROCESS.equals(processType)) {
744 callbackType = CALLBACK_FOR_GPU_PROCESS; 744 callbackType = CALLBACK_FOR_GPU_PROCESS;
745 inSandbox = false; 745 inSandbox = false;
746 } else if (ContentSwitches.SWITCH_UTILITY_PROCESS.equals(processType)) { 746 } else if (ContentSwitches.SWITCH_UTILITY_PROCESS.equals(processType)) {
747 // We only support sandboxed right now. 747 // We only support sandboxed right now.
748 callbackType = CALLBACK_FOR_UTILITY_PROCESS; 748 callbackType = CALLBACK_FOR_UTILITY_PROCESS;
749 } else { 749 } else {
750 assert false; 750 assert false;
751 } 751 }
752 752
753 MintingStateParams mintingStateParams = getMintingStateParams(commandLin e); 753 WebApkStateParams mintingStateParams = getWebApkStateParams(commandLine) ;
754 updateChildProcessCreationParams(context, mintingStateParams != null 754 updateChildProcessCreationParams(context, mintingStateParams != null
755 ? mintingStateParams.getMintedAPKPackageName() : null); 755 ? mintingStateParams.getMintedAPKPackageName() : null);
756 startInternal(context, commandLine, childProcessId, filesToBeMapped, cli entContext, 756 startInternal(context, commandLine, childProcessId, filesToBeMapped, cli entContext,
757 callbackType, inSandbox, sChildProcessCreationParams); 757 callbackType, inSandbox, sChildProcessCreationParams);
758 } 758 }
759 759
760 /** 760 /**
761 * Spawns a background download process if it hasn't been started. The downl oad process will 761 * Spawns a background download process if it hasn't been started. The downl oad process will
762 * manage its own lifecyle and can outlive chrome. 762 * manage its own lifecyle and can outlive chrome.
763 * 763 *
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 } 1050 }
1051 1051
1052 return true; 1052 return true;
1053 } 1053 }
1054 1054
1055 private static native void nativeOnChildProcessStarted(long clientContext, i nt pid); 1055 private static native void nativeOnChildProcessStarted(long clientContext, i nt pid);
1056 private static native void nativeEstablishSurfacePeer( 1056 private static native void nativeEstablishSurfacePeer(
1057 int pid, Surface surface, int primaryID, int secondaryID); 1057 int pid, Surface surface, int primaryID, int secondaryID);
1058 private static native boolean nativeIsSingleProcess(); 1058 private static native boolean nativeIsSingleProcess();
1059 } 1059 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698