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

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

Issue 2828793002: Refactoring ChildProcessConnection. (Closed)
Patch Set: More test fixing. 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 side-by-side diff with in-line comments
Download patch
Index: content/public/android/java/src/org/chromium/content/browser/ImportantChildProcessConnection.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ImportantChildProcessConnection.java b/content/public/android/java/src/org/chromium/content/browser/ImportantChildProcessConnection.java
new file mode 100644
index 0000000000000000000000000000000000000000..ec5b738e0b46c58d5042ecd86e235bb01ade6fc9
--- /dev/null
+++ b/content/public/android/java/src/org/chromium/content/browser/ImportantChildProcessConnection.java
@@ -0,0 +1,50 @@
+// Copyright 2013 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.Context;
+import android.os.Bundle;
+
+import org.chromium.base.process_launcher.ChildProcessCreationParams;
+
+/**
+ * A connection that is bound as important, meaning the framework brings it to the foreground
+ * process level when the app is.
+ */
+public class ImportantChildProcessConnection extends BaseChildProcessConnection {
+ public static final Factory FACTORY = new BaseChildProcessConnection.Factory() {
+ @Override
+ public BaseChildProcessConnection create(Context context, int number, boolean sandboxed,
+ DeathCallback deathCallback, String serviceClassName,
+ Bundle childProcessCommonParameters, ChildProcessCreationParams creationParams) {
+ return new ImportantChildProcessConnection(context, number, sandboxed, deathCallback,
+ serviceClassName, childProcessCommonParameters, creationParams);
+ }
+ };
+
+ private final ChildServiceConnection mBinding;
+
+ private ImportantChildProcessConnection(Context context, int number, boolean sandboxed,
+ DeathCallback deathCallback, String serviceClassName,
+ Bundle childProcessCommonParameters, ChildProcessCreationParams creationParams) {
+ super(context, number, sandboxed, deathCallback, serviceClassName,
+ childProcessCommonParameters, creationParams);
+ int flags = Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT;
+ if (shouldBindAsExportedService()) {
+ flags |= Context.BIND_EXTERNAL_SERVICE;
+ }
+ mBinding = createServiceConnection(flags);
+ }
+
+ @Override
+ public boolean bind() {
+ return mBinding.bind();
+ }
+
+ @Override
+ public void unbind() {
+ mBinding.unbind();
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698