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.app; | 5 package org.chromium.content.app; |
6 | 6 |
7 import android.app.Service; | 7 import android.app.Service; |
8 import android.content.Intent; | 8 import android.content.Intent; |
9 import android.os.Bundle; | |
10 import android.os.IBinder; | 9 import android.os.IBinder; |
11 | 10 |
12 import org.chromium.base.annotations.JNINamespace; | 11 import org.chromium.base.annotations.JNINamespace; |
13 import org.chromium.content.browser.ChildProcessLauncher; | 12 import org.chromium.content.browser.ChildProcessLauncher; |
14 | 13 |
15 /** | 14 /** |
16 * This is the base class for child services; the [Non]SandboxedProcessService0,
1.. etc | 15 * This is the base class for child services; the [Non]SandboxedProcessService0,
1.. etc |
17 * subclasses provide the concrete service entry points, to enable the browser t
o connect | 16 * subclasses provide the concrete service entry points, to enable the browser t
o connect |
18 * to more than one distinct process (i.e. one process per service number, up to
limit of N). | 17 * to more than one distinct process (i.e. one process per service number, up to
limit of N). |
19 * The embedding application must declare these service instances in the applica
tion section | 18 * The embedding application must declare these service instances in the applica
tion section |
(...skipping 21 matching lines...) Expand all Loading... |
41 | 40 |
42 @Override | 41 @Override |
43 public IBinder onBind(Intent intent) { | 42 public IBinder onBind(Intent intent) { |
44 // We call stopSelf() to request that this service be stopped as soon as
the client | 43 // We call stopSelf() to request that this service be stopped as soon as
the client |
45 // unbinds. Otherwise the system may keep it around and available for a
reconnect. The | 44 // unbinds. Otherwise the system may keep it around and available for a
reconnect. The |
46 // child processes do not currently support reconnect; they must be init
ialized from | 45 // child processes do not currently support reconnect; they must be init
ialized from |
47 // scratch every time. | 46 // scratch every time. |
48 stopSelf(); | 47 stopSelf(); |
49 return mChildProcessServiceImpl.bind(intent, -1); | 48 return mChildProcessServiceImpl.bind(intent, -1); |
50 } | 49 } |
51 | |
52 /** | |
53 * Helper method to initialize the params from intent. | |
54 * @param intent Intent to launch the service. | |
55 */ | |
56 protected void initializeParams(Intent intent) { | |
57 mChildProcessServiceImpl.initializeParams(intent); | |
58 } | |
59 | |
60 /** | |
61 * Helper method to get the information about the service from a given bundl
e. | |
62 * @param bundle Bundle that contains the information to start the service. | |
63 */ | |
64 protected void getServiceInfo(Bundle bundle) { | |
65 mChildProcessServiceImpl.getServiceInfo(bundle); | |
66 } | |
67 } | 50 } |
OLD | NEW |