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

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

Issue 2793623002: android: Limit num renderer to service slots (Closed)
Patch Set: fix remaining unit tests Created 3 years, 8 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.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;
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 private static final String NUM_PRIVILEGED_SERVICES_KEY = 225 private static final String NUM_PRIVILEGED_SERVICES_KEY =
226 "org.chromium.content.browser.NUM_PRIVILEGED_SERVICES"; 226 "org.chromium.content.browser.NUM_PRIVILEGED_SERVICES";
227 private static final String SANDBOXED_SERVICES_NAME_KEY = 227 private static final String SANDBOXED_SERVICES_NAME_KEY =
228 "org.chromium.content.browser.SANDBOXED_SERVICES_NAME"; 228 "org.chromium.content.browser.SANDBOXED_SERVICES_NAME";
229 // Overrides the number of available sandboxed services. 229 // Overrides the number of available sandboxed services.
230 @VisibleForTesting 230 @VisibleForTesting
231 public static final String SWITCH_NUM_SANDBOXED_SERVICES_FOR_TESTING = "num- sandboxed-services"; 231 public static final String SWITCH_NUM_SANDBOXED_SERVICES_FOR_TESTING = "num- sandboxed-services";
232 public static final String SWITCH_SANDBOXED_SERVICES_NAME_FOR_TESTING = 232 public static final String SWITCH_SANDBOXED_SERVICES_NAME_FOR_TESTING =
233 "sandboxed-services-name"; 233 "sandboxed-services-name";
234 234
235 private static int getNumberOfServices(Context context, boolean inSandbox, S tring packageName) { 235 static int getNumberOfServices(Context context, boolean inSandbox, String pa ckageName) {
236 int numServices = -1; 236 int numServices = -1;
237 if (inSandbox 237 if (inSandbox
238 && CommandLine.getInstance().hasSwitch( 238 && CommandLine.getInstance().hasSwitch(
239 SWITCH_NUM_SANDBOXED_SERVICES_FOR_TESTING)) { 239 SWITCH_NUM_SANDBOXED_SERVICES_FOR_TESTING)) {
240 String value = CommandLine.getInstance().getSwitchValue( 240 String value = CommandLine.getInstance().getSwitchValue(
241 SWITCH_NUM_SANDBOXED_SERVICES_FOR_TESTING); 241 SWITCH_NUM_SANDBOXED_SERVICES_FOR_TESTING);
242 if (!TextUtils.isEmpty(value)) { 242 if (!TextUtils.isEmpty(value)) {
243 try { 243 try {
244 numServices = Integer.parseInt(value); 244 numServices = Integer.parseInt(value);
245 } catch (NumberFormatException e) { 245 } catch (NumberFormatException e) {
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 885
886 try { 886 try {
887 ((ChildProcessConnectionImpl) sServiceMap.get(pid)).crashServiceForT esting(); 887 ((ChildProcessConnectionImpl) sServiceMap.get(pid)).crashServiceForT esting();
888 } catch (RemoteException ex) { 888 } catch (RemoteException ex) {
889 return false; 889 return false;
890 } 890 }
891 891
892 return true; 892 return true;
893 } 893 }
894 } 894 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698