| OLD | NEW |
| 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.os.IBinder; |
| 8 |
| 7 import org.chromium.base.process_launcher.ChildProcessCreationParams; | 9 import org.chromium.base.process_launcher.ChildProcessCreationParams; |
| 8 import org.chromium.base.process_launcher.FileDescriptorInfo; | 10 import org.chromium.base.process_launcher.FileDescriptorInfo; |
| 9 import org.chromium.content.common.IChildProcessCallback; | |
| 10 import org.chromium.content.common.IChildProcessService; | 11 import org.chromium.content.common.IChildProcessService; |
| 11 | 12 |
| 13 import javax.annotation.Nullable; |
| 14 |
| 12 /** | 15 /** |
| 13 * Manages a connection between the browser activity and a child service. ChildP
rocessConnection is | 16 * Manages a connection between the browser activity and a child service. ChildP
rocessConnection is |
| 14 * responsible for estabilishing the connection (start()), closing it (stop()) a
nd manipulating the | 17 * responsible for estabilishing the connection (start()), closing it (stop()) a
nd manipulating the |
| 15 * bindings held onto the service (addStrongBinding(), removeStrongBinding(), | 18 * bindings held onto the service (addStrongBinding(), removeStrongBinding(), |
| 16 * removeInitialBinding()). | 19 * removeInitialBinding()). |
| 17 */ | 20 */ |
| 18 public interface ChildProcessConnection { | 21 public interface ChildProcessConnection { |
| 19 /** | 22 /** |
| 20 * Used to notify the consumer about disconnection of the service. This call
back is provided | 23 * Used to notify the consumer about disconnection of the service. This call
back is provided |
| 21 * earlier than ConnectionCallbacks below, as a child process might die befo
re the connection is | 24 * earlier than ConnectionCallbacks below, as a child process might die befo
re the connection is |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 * separate to allow to pass whatever parameters are available in start(), a
nd complete the | 78 * separate to allow to pass whatever parameters are available in start(), a
nd complete the |
| 76 * remainder later while reducing the connection setup latency. | 79 * remainder later while reducing the connection setup latency. |
| 77 * @param startCallback (optional) callback when the child process starts or
fails to start. | 80 * @param startCallback (optional) callback when the child process starts or
fails to start. |
| 78 */ | 81 */ |
| 79 void start(StartCallback startCallback); | 82 void start(StartCallback startCallback); |
| 80 | 83 |
| 81 /** | 84 /** |
| 82 * Setups the connection after it was started with start(). | 85 * Setups the connection after it was started with start(). |
| 83 * @param commandLine (optional) will be ignored if the command line was alr
eady sent in start() | 86 * @param commandLine (optional) will be ignored if the command line was alr
eady sent in start() |
| 84 * @param filesToBeMapped a list of file descriptors that should be register
ed | 87 * @param filesToBeMapped a list of file descriptors that should be register
ed |
| 85 * @param processCallback used for status updates regarding this process con
nection | 88 * @param callback optional client specified callbacks that the child can us
e to communicate |
| 89 * with the parent process |
| 86 * @param connectionCallback will be called exactly once after the connectio
n is set up or the | 90 * @param connectionCallback will be called exactly once after the connectio
n is set up or the |
| 87 * setup fails | 91 * setup fails |
| 88 */ | 92 */ |
| 89 void setupConnection(String[] commandLine, FileDescriptorInfo[] filesToBeMap
ped, | 93 void setupConnection(String[] commandLine, FileDescriptorInfo[] filesToBeMap
ped, |
| 90 IChildProcessCallback processCallback, ConnectionCallback connection
Callback); | 94 @Nullable IBinder callback, ConnectionCallback connectionCallback); |
| 91 | 95 |
| 92 /** | 96 /** |
| 93 * Terminates the connection to IChildProcessService, closing all bindings.
It is safe to call | 97 * Terminates the connection to IChildProcessService, closing all bindings.
It is safe to call |
| 94 * this multiple times. | 98 * this multiple times. |
| 95 */ | 99 */ |
| 96 void stop(); | 100 void stop(); |
| 97 | 101 |
| 98 /** @return true iff the initial oom binding is currently bound. */ | 102 /** @return true iff the initial oom binding is currently bound. */ |
| 99 boolean isInitialBindingBound(); | 103 boolean isInitialBindingBound(); |
| 100 | 104 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 void addModerateBinding(); | 144 void addModerateBinding(); |
| 141 | 145 |
| 142 /** | 146 /** |
| 143 * Called when the service is no longer in moderate use of the consumer. | 147 * Called when the service is no longer in moderate use of the consumer. |
| 144 */ | 148 */ |
| 145 void removeModerateBinding(); | 149 void removeModerateBinding(); |
| 146 | 150 |
| 147 /** @return true iff the moderate oom binding is currently bound. */ | 151 /** @return true iff the moderate oom binding is currently bound. */ |
| 148 boolean isModerateBindingBound(); | 152 boolean isModerateBindingBound(); |
| 149 } | 153 } |
| OLD | NEW |