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

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

Issue 2748343006: Moving ChildProcessCreationParams from content to base. (Closed)
Patch Set: Fix build. Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/public/android/java/src/org/chromium/content/browser/ChildProcessCreationParams.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ChildProcessCreationParams.java b/content/public/android/java/src/org/chromium/content/browser/ChildProcessCreationParams.java
deleted file mode 100644
index f9ebc3c3a8e20c8d07e7303edde82493f71dc74e..0000000000000000000000000000000000000000
--- a/content/public/android/java/src/org/chromium/content/browser/ChildProcessCreationParams.java
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.content.browser;
-
-import android.content.Intent;
-import android.util.SparseArray;
-
-import org.chromium.base.library_loader.LibraryProcessType;
-
-/**
- * Allows specifying the package name for looking up child services
- * configuration and classes into (if it differs from the application
- * package name, like in the case of Android WebView). Also allows
- * specifying additional child service binding flags.
- */
-public class ChildProcessCreationParams {
- /** ID used for the default params. */
- public static final int DEFAULT_ID = 0;
-
- private static final Object sLock = new Object();
- private static final SparseArray<ChildProcessCreationParams> sParamMap = new SparseArray<>();
- private static int sNextId = 1; // 0 is reserved for DEFAULT_ID.
-
- /** Register default params. This should be called once on start up. */
- public static void registerDefault(ChildProcessCreationParams params) {
- synchronized (sLock) {
- // TODO(boliu): Assert not overwriting existing entry once WebApk is fixed.
- sParamMap.append(DEFAULT_ID, params);
- }
- }
-
- // TODO(boliu): Make package visible once WebApk is fixed.
- public static ChildProcessCreationParams getDefault() {
- return get(DEFAULT_ID);
- }
-
- /** Register new params. Returns the allocated ID corresponding this params. */
- public static int register(ChildProcessCreationParams params) {
- assert params != null;
- int id = -1;
- synchronized (sLock) {
- id = sNextId++;
- sParamMap.append(id, params);
- }
- assert id > 0;
- return id;
- }
-
- /** Releases param corresponding to this ID. Any future use of this ID will crash. */
- public static void unregister(int id) {
- assert id > DEFAULT_ID; // Not allowed to unregister default.
- synchronized (sLock) {
- sParamMap.delete(id);
- }
- }
-
- static ChildProcessCreationParams get(int id) {
- assert id >= 0;
- synchronized (sLock) {
- return sParamMap.get(id);
- }
- }
-
- // Members should all be immutable to avoid worrying about thread safety.
- private final String mPackageName;
- private final boolean mIsExternalService;
- private final int mLibraryProcessType;
-
- public ChildProcessCreationParams(String packageName, boolean isExternalService,
- int libraryProcessType) {
- mPackageName = packageName;
- mIsExternalService = isExternalService;
- mLibraryProcessType = libraryProcessType;
- }
-
- String getPackageName() {
- return mPackageName;
- }
-
- boolean getIsExternalService() {
- return mIsExternalService;
- }
-
- int getLibraryProcessType() {
- return mLibraryProcessType;
- }
-
- void addIntentExtras(Intent intent) {
- intent.putExtra(ChildProcessConstants.EXTRA_LIBRARY_PROCESS_TYPE, mLibraryProcessType);
- }
-
- public static int getLibraryProcessType(Intent intent) {
- return intent.getIntExtra(
- ChildProcessConstants.EXTRA_LIBRARY_PROCESS_TYPE, LibraryProcessType.PROCESS_CHILD);
- }
-}

Powered by Google App Engine
This is Rietveld 408576698