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

Side by Side Diff: content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java

Issue 2560403002: android: Remove command line args from intent bundle (Closed)
Patch Set: delete more Created 4 years 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
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 private long mCpuFeatures; 63 private long mCpuFeatures;
64 // File descriptors that should be registered natively. 64 // File descriptors that should be registered natively.
65 private FileDescriptorInfo[] mFdInfos; 65 private FileDescriptorInfo[] mFdInfos;
66 // Linker-specific parameters for this child process service. 66 // Linker-specific parameters for this child process service.
67 private ChromiumLinkerParams mLinkerParams; 67 private ChromiumLinkerParams mLinkerParams;
68 // Child library process type. 68 // Child library process type.
69 private int mLibraryProcessType; 69 private int mLibraryProcessType;
70 70
71 private static AtomicReference<Context> sContext = new AtomicReference<>(nul l); 71 private static AtomicReference<Context> sContext = new AtomicReference<>(nul l);
72 private boolean mLibraryInitialized = false; 72 private boolean mLibraryInitialized = false;
73 // Becomes true once the service is bound. Access must synchronize around mM ainThread.
74 private boolean mIsBound = false;
75 73
76 /** 74 /**
77 * If >= 0 enables "validation of caller of {@link mBinder}'s methods". A Re moteException 75 * If >= 0 enables "validation of caller of {@link mBinder}'s methods". A Re moteException
78 * is thrown when an application with a uid other than {@link mAuthorizedCal lerUid} calls 76 * is thrown when an application with a uid other than {@link mAuthorizedCal lerUid} calls
79 * {@link mBinder}'s methods. 77 * {@link mBinder}'s methods.
80 */ 78 */
81 private int mAuthorizedCallerUid; 79 private int mAuthorizedCallerUid;
82 80
83 private final Semaphore mActivitySemaphore = new Semaphore(1); 81 private final Semaphore mActivitySemaphore = new Semaphore(1);
84 82
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 synchronized (mMainThread) { 155 synchronized (mMainThread) {
158 while (mCommandLineParams == null) { 156 while (mCommandLineParams == null) {
159 mMainThread.wait(); 157 mMainThread.wait();
160 } 158 }
161 } 159 }
162 CommandLine.init(mCommandLineParams); 160 CommandLine.init(mCommandLineParams);
163 161
164 Linker linker = null; 162 Linker linker = null;
165 boolean requestedSharedRelro = false; 163 boolean requestedSharedRelro = false;
166 if (Linker.isUsed()) { 164 if (Linker.isUsed()) {
167 synchronized (mMainThread) { 165 assert mLinkerParams != null;
168 while (!mIsBound) {
169 mMainThread.wait();
170 }
171 }
172 linker = getLinker(); 166 linker = getLinker();
173 if (mLinkerParams.mWaitForSharedRelro) { 167 if (mLinkerParams.mWaitForSharedRelro) {
174 requestedSharedRelro = true; 168 requestedSharedRelro = true;
175 linker.initServiceProcess(mLinkerParams.mBaseLoadAdd ress); 169 linker.initServiceProcess(mLinkerParams.mBaseLoadAdd ress);
176 } else { 170 } else {
177 linker.disableSharedRelros(); 171 linker.disableSharedRelros();
178 } 172 }
179 } 173 }
180 boolean isLoaded = false; 174 boolean isLoaded = false;
181 if (CommandLine.getInstance().hasSwitch( 175 if (CommandLine.getInstance().hasSwitch(
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 * is thrown when an application with a uid other than 269 * is thrown when an application with a uid other than
276 * {@link authorizedCallerUid} calls the service's methods. 270 * {@link authorizedCallerUid} calls the service's methods.
277 */ 271 */
278 @UsedByReflection("WebApkSandboxedProcessService") 272 @UsedByReflection("WebApkSandboxedProcessService")
279 public IBinder bind(Intent intent, int authorizedCallerUid) { 273 public IBinder bind(Intent intent, int authorizedCallerUid) {
280 mAuthorizedCallerUid = authorizedCallerUid; 274 mAuthorizedCallerUid = authorizedCallerUid;
281 initializeParams(intent); 275 initializeParams(intent);
282 return mBinder; 276 return mBinder;
283 } 277 }
284 278
285 void initializeParams(Intent intent) { 279 private void initializeParams(Intent intent) {
286 synchronized (mMainThread) { 280 synchronized (mMainThread) {
287 mCommandLineParams =
288 intent.getStringArrayExtra(ChildProcessConstants.EXTRA_COMMA ND_LINE);
289 // mLinkerParams is never used if Linker.isUsed() returns false. 281 // mLinkerParams is never used if Linker.isUsed() returns false.
290 // See onCreate(). 282 // See onCreate().
291 mLinkerParams = new ChromiumLinkerParams(intent); 283 mLinkerParams = new ChromiumLinkerParams(intent);
292 mLibraryProcessType = ChildProcessCreationParams.getLibraryProcessTy pe(intent); 284 mLibraryProcessType = ChildProcessCreationParams.getLibraryProcessTy pe(intent);
293 mIsBound = true;
294 mMainThread.notifyAll(); 285 mMainThread.notifyAll();
295 } 286 }
296 } 287 }
297 288
298 void getServiceInfo(Bundle bundle) { 289 private void getServiceInfo(Bundle bundle) {
299 // Required to unparcel FileDescriptorInfo. 290 // Required to unparcel FileDescriptorInfo.
300 bundle.setClassLoader(mHostClassLoader); 291 bundle.setClassLoader(mHostClassLoader);
301 synchronized (mMainThread) { 292 synchronized (mMainThread) {
302 // Allow the command line to be set via bind() intent or setupConnec tion, but
303 // the FD can only be transferred here.
304 if (mCommandLineParams == null) { 293 if (mCommandLineParams == null) {
305 mCommandLineParams = 294 mCommandLineParams =
306 bundle.getStringArray(ChildProcessConstants.EXTRA_COMMAN D_LINE); 295 bundle.getStringArray(ChildProcessConstants.EXTRA_COMMAN D_LINE);
296 mMainThread.notifyAll();
307 } 297 }
308 // We must have received the command line by now 298 // We must have received the command line by now
309 assert mCommandLineParams != null; 299 assert mCommandLineParams != null;
310 mCpuCount = bundle.getInt(ChildProcessConstants.EXTRA_CPU_COUNT); 300 mCpuCount = bundle.getInt(ChildProcessConstants.EXTRA_CPU_COUNT);
311 mCpuFeatures = bundle.getLong(ChildProcessConstants.EXTRA_CPU_FEATUR ES); 301 mCpuFeatures = bundle.getLong(ChildProcessConstants.EXTRA_CPU_FEATUR ES);
312 assert mCpuCount > 0; 302 assert mCpuCount > 0;
313 Parcelable[] fdInfosAsParcelable = 303 Parcelable[] fdInfosAsParcelable =
314 bundle.getParcelableArray(ChildProcessConstants.EXTRA_FILES) ; 304 bundle.getParcelableArray(ChildProcessConstants.EXTRA_FILES) ;
315 if (fdInfosAsParcelable != null) { 305 if (fdInfosAsParcelable != null) {
316 // For why this arraycopy is necessary: 306 // For why this arraycopy is necessary:
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 private static native void nativeInitChildProcessImpl( 415 private static native void nativeInitChildProcessImpl(
426 ChildProcessServiceImpl serviceImpl, int cpuCount, long cpuFeatures) ; 416 ChildProcessServiceImpl serviceImpl, int cpuCount, long cpuFeatures) ;
427 417
428 /** 418 /**
429 * Force the child process to exit. 419 * Force the child process to exit.
430 */ 420 */
431 private static native void nativeExitChildProcess(); 421 private static native void nativeExitChildProcess();
432 422
433 private native void nativeShutdownMainThread(); 423 private native void nativeShutdownMainThread();
434 } 424 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698