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

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

Issue 2828793002: Refactoring ChildProcessConnection. (Closed)
Patch Set: Refactoring ChildProcessConnection. 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
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.content.browser;
6
7 import android.content.Context;
8 import android.os.Build;
9 import android.os.Bundle;
10
11 import org.chromium.base.VisibleForTesting;
12 import org.chromium.base.process_launcher.ChildProcessCreationParams;
13
14 /**
15 * A connection that is bound as important, meaning the framework brings it to t he foreground
16 * process level when the app is.
17 */
18 public class ImportantChildProcessConnection extends BaseChildProcessConnection {
19 public static final Factory FACTORY = new BaseChildProcessConnection.Factory () {
20 @Override
21 public BaseChildProcessConnection create(Context context, int number, bo olean sandboxed,
22 DeathCallback deathCallback, String serviceClassName,
23 Bundle childProcessCommonParameters, ChildProcessCreationParams creationParams) {
24 ImportantChildProcessConnection connection =
25 new ImportantChildProcessConnection(context, number, sandbox ed, deathCallback,
26 serviceClassName, childProcessCommonParameters, crea tionParams);
27 connection.initBinding();
28 return connection;
29 }
30 };
31
32 private ChildServiceConnection mBinding;
33
34 private ImportantChildProcessConnection(Context context, int number, boolean sandboxed,
35 DeathCallback deathCallback, String serviceClassName,
36 Bundle childProcessCommonParameters, ChildProcessCreationParams crea tionParams) {
37 super(context, number, sandboxed, deathCallback, serviceClassName,
38 childProcessCommonParameters, creationParams);
39 }
40
41 @VisibleForTesting
42 protected void initBinding() {
boliu 2017/04/20 22:33:34 nothing actually overrides this?
Jay Civelli 2017/04/25 06:02:46 Removed @VisibleForTesting.
43 int flags = Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT;
44 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && getCreationParams( ) != null
45 && getCreationParams().getIsExternalService()
46 && isExportedService(isSandboxed(), getContext(), getServiceName ())) {
47 flags |= Context.BIND_EXTERNAL_SERVICE;
48 }
49 mBinding = createServiceConnection(flags);
50 }
51
52 @Override
53 public boolean bind() {
54 return mBinding.bind();
55 }
56
57 @Override
58 public void unbind() {
59 mBinding.unbind();
60 }
61 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698