OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.content.Context; | 7 import android.content.Context; |
8 import android.content.Intent; | 8 import android.content.Intent; |
9 import android.graphics.SurfaceTexture; | 9 import android.graphics.SurfaceTexture; |
10 import android.os.Binder; | 10 import android.os.Binder; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
158 while (mCommandLineParams == null) { | 158 while (mCommandLineParams == null) { |
159 mMainThread.wait(); | 159 mMainThread.wait(); |
160 } | 160 } |
161 } | 161 } |
162 CommandLine.init(mCommandLineParams); | 162 CommandLine.init(mCommandLineParams); |
163 | 163 |
164 Linker linker = null; | 164 Linker linker = null; |
165 boolean requestedSharedRelro = false; | 165 boolean requestedSharedRelro = false; |
166 if (Linker.isUsed()) { | 166 if (Linker.isUsed()) { |
167 synchronized (mMainThread) { | 167 synchronized (mMainThread) { |
168 while (!mIsBound) { | 168 while (!mIsBound) { |
Jay Civelli
2016/12/12 17:40:28
I guess now we'll always be bound by the time we g
boliu
2016/12/12 17:54:02
Yeah afaict, so should be safe to remove.
And rem
boliu
2016/12/12 18:13:08
Actually, I can't find any hard evidence to back t
boliu
2016/12/12 18:21:22
Oh, bahh, I can't decide.. Here's the evidence:
bi
| |
169 mMainThread.wait(); | 169 mMainThread.wait(); |
170 } | 170 } |
171 } | 171 } |
172 linker = getLinker(); | 172 linker = getLinker(); |
173 if (mLinkerParams.mWaitForSharedRelro) { | 173 if (mLinkerParams.mWaitForSharedRelro) { |
174 requestedSharedRelro = true; | 174 requestedSharedRelro = true; |
175 linker.initServiceProcess(mLinkerParams.mBaseLoadAdd ress); | 175 linker.initServiceProcess(mLinkerParams.mBaseLoadAdd ress); |
176 } else { | 176 } else { |
177 linker.disableSharedRelros(); | 177 linker.disableSharedRelros(); |
178 } | 178 } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
277 */ | 277 */ |
278 @UsedByReflection("WebApkSandboxedProcessService") | 278 @UsedByReflection("WebApkSandboxedProcessService") |
279 public IBinder bind(Intent intent, int authorizedCallerUid) { | 279 public IBinder bind(Intent intent, int authorizedCallerUid) { |
280 mAuthorizedCallerUid = authorizedCallerUid; | 280 mAuthorizedCallerUid = authorizedCallerUid; |
281 initializeParams(intent); | 281 initializeParams(intent); |
282 return mBinder; | 282 return mBinder; |
283 } | 283 } |
284 | 284 |
285 void initializeParams(Intent intent) { | 285 void initializeParams(Intent intent) { |
286 synchronized (mMainThread) { | 286 synchronized (mMainThread) { |
287 mCommandLineParams = | |
288 intent.getStringArrayExtra(ChildProcessConstants.EXTRA_COMMA ND_LINE); | |
289 // mLinkerParams is never used if Linker.isUsed() returns false. | 287 // mLinkerParams is never used if Linker.isUsed() returns false. |
290 // See onCreate(). | 288 // See onCreate(). |
291 mLinkerParams = new ChromiumLinkerParams(intent); | 289 mLinkerParams = new ChromiumLinkerParams(intent); |
Jay Civelli
2016/12/12 17:40:28
In the future, should we still depend on anything
boliu
2016/12/12 17:54:02
I dunno.. it's still ok to pass things that's fixe
Jay Civelli
2016/12/12 19:11:22
Yes, but then the linker has to wait for the comma
boliu
2016/12/12 19:16:02
Surely we can refactor the linker to not require c
| |
292 mLibraryProcessType = ChildProcessCreationParams.getLibraryProcessTy pe(intent); | 290 mLibraryProcessType = ChildProcessCreationParams.getLibraryProcessTy pe(intent); |
293 mIsBound = true; | 291 mIsBound = true; |
294 mMainThread.notifyAll(); | 292 mMainThread.notifyAll(); |
295 } | 293 } |
296 } | 294 } |
297 | 295 |
298 void getServiceInfo(Bundle bundle) { | 296 void getServiceInfo(Bundle bundle) { |
299 // Required to unparcel FileDescriptorInfo. | 297 // Required to unparcel FileDescriptorInfo. |
300 bundle.setClassLoader(mHostClassLoader); | 298 bundle.setClassLoader(mHostClassLoader); |
301 synchronized (mMainThread) { | 299 synchronized (mMainThread) { |
302 // Allow the command line to be set via bind() intent or setupConnec tion, but | 300 // Allow the command line to be set via bind() intent or setupConnec tion, but |
Jay Civelli
2016/12/12 17:40:28
Is this comment still accurate?
boliu
2016/12/12 17:54:02
I dunno what this comment is really saying.. bind
Jay Civelli
2016/12/12 19:11:22
Yes, maybe remove since now there is only one way
| |
303 // the FD can only be transferred here. | 301 // the FD can only be transferred here. |
304 if (mCommandLineParams == null) { | 302 if (mCommandLineParams == null) { |
305 mCommandLineParams = | 303 mCommandLineParams = |
306 bundle.getStringArray(ChildProcessConstants.EXTRA_COMMAN D_LINE); | 304 bundle.getStringArray(ChildProcessConstants.EXTRA_COMMAN D_LINE); |
305 mMainThread.notifyAll(); | |
307 } | 306 } |
308 // We must have received the command line by now | 307 // We must have received the command line by now |
309 assert mCommandLineParams != null; | 308 assert mCommandLineParams != null; |
310 mCpuCount = bundle.getInt(ChildProcessConstants.EXTRA_CPU_COUNT); | 309 mCpuCount = bundle.getInt(ChildProcessConstants.EXTRA_CPU_COUNT); |
311 mCpuFeatures = bundle.getLong(ChildProcessConstants.EXTRA_CPU_FEATUR ES); | 310 mCpuFeatures = bundle.getLong(ChildProcessConstants.EXTRA_CPU_FEATUR ES); |
312 assert mCpuCount > 0; | 311 assert mCpuCount > 0; |
313 Parcelable[] fdInfosAsParcelable = | 312 Parcelable[] fdInfosAsParcelable = |
314 bundle.getParcelableArray(ChildProcessConstants.EXTRA_FILES) ; | 313 bundle.getParcelableArray(ChildProcessConstants.EXTRA_FILES) ; |
315 if (fdInfosAsParcelable != null) { | 314 if (fdInfosAsParcelable != null) { |
316 // For why this arraycopy is necessary: | 315 // For why this arraycopy is necessary: |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
425 private static native void nativeInitChildProcessImpl( | 424 private static native void nativeInitChildProcessImpl( |
426 ChildProcessServiceImpl serviceImpl, int cpuCount, long cpuFeatures) ; | 425 ChildProcessServiceImpl serviceImpl, int cpuCount, long cpuFeatures) ; |
427 | 426 |
428 /** | 427 /** |
429 * Force the child process to exit. | 428 * Force the child process to exit. |
430 */ | 429 */ |
431 private static native void nativeExitChildProcess(); | 430 private static native void nativeExitChildProcess(); |
432 | 431 |
433 private native void nativeShutdownMainThread(); | 432 private native void nativeShutdownMainThread(); |
434 } | 433 } |
OLD | NEW |