OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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.content.ComponentName; | 7 import android.content.ComponentName; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.Intent; | 9 import android.content.Intent; |
10 import android.content.ServiceConnection; | 10 import android.content.ServiceConnection; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 public ChildServiceConnection(int bindFlags) { | 124 public ChildServiceConnection(int bindFlags) { |
125 mBindFlags = bindFlags; | 125 mBindFlags = bindFlags; |
126 } | 126 } |
127 | 127 |
128 boolean bind(String[] commandLine) { | 128 boolean bind(String[] commandLine) { |
129 if (!mBound) { | 129 if (!mBound) { |
130 try { | 130 try { |
131 TraceEvent.begin("ChildProcessConnectionImpl.ChildServiceCon
nection.bind"); | 131 TraceEvent.begin("ChildProcessConnectionImpl.ChildServiceCon
nection.bind"); |
132 final Intent intent = createServiceBindIntent(); | 132 final Intent intent = createServiceBindIntent(); |
133 if (commandLine != null) { | 133 // Note, the intent may be saved and re-used by Android for
re-launching the |
134 intent.putExtra(ChildProcessConstants.EXTRA_COMMAND_LINE
, commandLine); | 134 // child service. Do not pass data that is different for eac
h child; command |
135 } | 135 // line arguments for example. |
136 if (mLinkerParams != null) { | 136 if (mLinkerParams != null) { |
137 mLinkerParams.addIntentExtras(intent); | 137 mLinkerParams.addIntentExtras(intent); |
138 } | 138 } |
139 mBound = mContext.bindService(intent, this, mBindFlags); | 139 mBound = mContext.bindService(intent, this, mBindFlags); |
140 } finally { | 140 } finally { |
141 TraceEvent.end("ChildProcessConnectionImpl.ChildServiceConne
ction.bind"); | 141 TraceEvent.end("ChildProcessConnectionImpl.ChildServiceConne
ction.bind"); |
142 } | 142 } |
143 } | 143 } |
144 return mBound; | 144 return mBound; |
145 } | 145 } |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 return true; | 515 return true; |
516 } | 516 } |
517 return false; | 517 return false; |
518 } | 518 } |
519 | 519 |
520 @VisibleForTesting | 520 @VisibleForTesting |
521 public boolean isConnected() { | 521 public boolean isConnected() { |
522 return mService != null; | 522 return mService != null; |
523 } | 523 } |
524 } | 524 } |
OLD | NEW |