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

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

Issue 2049843004: Upstream: Renderers are running in WebAPKs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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.app.Service;
7 import android.content.Intent; 8 import android.content.Intent;
8 9
9 import org.chromium.base.library_loader.LibraryProcessType; 10 import org.chromium.base.library_loader.LibraryProcessType;
10 11
11 /** 12 /**
12 * Allows specifying the package name for looking up child services 13 * Allows specifying the package name for looking up child services
13 * configuration and classes into (if it differs from the application 14 * configuration and classes into (if it differs from the application
14 * package name, like in the case of Android WebView). Also allows 15 * package name, like in the case of Android WebView). Also allows
15 * specifying additional child service binging flags. 16 * specifying additional child service binging flags.
16 */ 17 */
17 public class ChildProcessCreationParams { 18 public class ChildProcessCreationParams {
18 private final String mPackageName; 19 private final String mPackageName;
19 private final int mExtraBindFlags; 20 private final int mExtraBindFlags;
20 private final int mLibraryProcessType; 21 private final int mLibraryProcessType;
22 private final Class<? extends Service> mServiceName;
21 private static final String EXTRA_LIBRARY_PROCESS_TYPE = 23 private static final String EXTRA_LIBRARY_PROCESS_TYPE =
22 "org.chromium.content.common.child_service_params.library_process_ty pe"; 24 "org.chromium.content.common.child_service_params.library_process_ty pe";
23 25
24 private static volatile ChildProcessCreationParams sChildProcessCreationPara ms; 26 private static volatile ChildProcessCreationParams sChildProcessCreationPara ms;
25 27
26 public static void set(ChildProcessCreationParams params) { 28 public static void set(ChildProcessCreationParams params) {
27 sChildProcessCreationParams = params; 29 sChildProcessCreationParams = params;
28 } 30 }
29 31
30 public static ChildProcessCreationParams get() { 32 public static ChildProcessCreationParams get() {
31 return sChildProcessCreationParams; 33 return sChildProcessCreationParams;
32 } 34 }
33 35
34 public ChildProcessCreationParams(String packageName, int extraBindFlags, 36 public ChildProcessCreationParams(String packageName, int extraBindFlags,
35 int libraryProcessType) { 37 int libraryProcessType) {
36 mPackageName = packageName; 38 mPackageName = packageName;
37 mExtraBindFlags = extraBindFlags; 39 mExtraBindFlags = extraBindFlags;
38 mLibraryProcessType = libraryProcessType; 40 mLibraryProcessType = libraryProcessType;
41 mServiceName = null;
42 }
43
44 public ChildProcessCreationParams(String packageName, int extraBindFlags,
45 int libraryProcessType, Class<? extends Service> serviceName) {
46 mPackageName = packageName;
47 mExtraBindFlags = extraBindFlags;
48 mLibraryProcessType = libraryProcessType;
49 mServiceName = serviceName;
39 } 50 }
40 51
41 public ChildProcessCreationParams copy() { 52 public ChildProcessCreationParams copy() {
42 return new ChildProcessCreationParams(mPackageName, mExtraBindFlags, mLi braryProcessType); 53 return new ChildProcessCreationParams(mPackageName, mExtraBindFlags, mLi braryProcessType,
54 mServiceName);
43 } 55 }
44 56
45 public String getPackageName() { 57 public String getPackageName() {
46 return mPackageName; 58 return mPackageName;
47 } 59 }
48 60
49 public int getExtraBindFlags() { 61 public int getExtraBindFlags() {
50 return mExtraBindFlags; 62 return mExtraBindFlags;
51 } 63 }
52 64
65 public int getLibraryProcessType() {
66 return mLibraryProcessType;
pkotwicz 2016/06/10 21:29:48 I can't seem to find where this function is called
Xi Han 2016/06/13 20:04:11 Removed.
67 }
68
69 public Class<? extends Service> getServiceName() {
70 return mServiceName;
71 }
72
53 /** 73 /**
54 * Adds required extra flags to the given child service binding flags and re turns them. 74 * Adds required extra flags to the given child service binding flags and re turns them.
55 * Does not modify the state of the ChildProcessCreationParams instance. 75 * Does not modify the state of the ChildProcessCreationParams instance.
56 * 76 *
57 * @param bindFlags Source bind flags to modify. 77 * @param bindFlags Source bind flags to modify.
58 * @return Bind flags with extra flags added. 78 * @return Bind flags with extra flags added.
59 */ 79 */
60 public int addExtraBindFlags(int bindFlags) { 80 public int addExtraBindFlags(int bindFlags) {
61 return bindFlags | mExtraBindFlags; 81 return bindFlags | mExtraBindFlags;
62 } 82 }
63 83
64 public void addIntentExtras(Intent intent) { 84 public void addIntentExtras(Intent intent) {
65 intent.putExtra(EXTRA_LIBRARY_PROCESS_TYPE, mLibraryProcessType); 85 intent.putExtra(EXTRA_LIBRARY_PROCESS_TYPE, mLibraryProcessType);
66 } 86 }
67 87
68 public static int getLibraryProcessType(Intent intent) { 88 public static int getLibraryProcessType(Intent intent) {
69 return intent.getIntExtra(EXTRA_LIBRARY_PROCESS_TYPE, 89 return intent.getIntExtra(EXTRA_LIBRARY_PROCESS_TYPE,
70 LibraryProcessType.PROCESS_CHILD); 90 LibraryProcessType.PROCESS_CHILD);
71 } 91 }
72 } 92 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698