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

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

Issue 2845243002: Moving BindingManager and ChildProcessConnection to base/.
Patch Set: Moving BindingManager and ChildProcessConnection to base/. Created 3 years, 7 months 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 12 matching lines...) Expand all
23 import org.chromium.base.Log; 23 import org.chromium.base.Log;
24 import org.chromium.base.UnguessableToken; 24 import org.chromium.base.UnguessableToken;
25 import org.chromium.base.annotations.CalledByNative; 25 import org.chromium.base.annotations.CalledByNative;
26 import org.chromium.base.annotations.JNINamespace; 26 import org.chromium.base.annotations.JNINamespace;
27 import org.chromium.base.annotations.MainDex; 27 import org.chromium.base.annotations.MainDex;
28 import org.chromium.base.annotations.SuppressFBWarnings; 28 import org.chromium.base.annotations.SuppressFBWarnings;
29 import org.chromium.base.annotations.UsedByReflection; 29 import org.chromium.base.annotations.UsedByReflection;
30 import org.chromium.base.library_loader.LibraryLoader; 30 import org.chromium.base.library_loader.LibraryLoader;
31 import org.chromium.base.library_loader.Linker; 31 import org.chromium.base.library_loader.Linker;
32 import org.chromium.base.library_loader.ProcessInitException; 32 import org.chromium.base.library_loader.ProcessInitException;
33 import org.chromium.base.process_launcher.ChildProcessConstants;
33 import org.chromium.base.process_launcher.ChildProcessCreationParams; 34 import org.chromium.base.process_launcher.ChildProcessCreationParams;
34 import org.chromium.base.process_launcher.FileDescriptorInfo; 35 import org.chromium.base.process_launcher.FileDescriptorInfo;
35 import org.chromium.base.process_launcher.ICallbackInt; 36 import org.chromium.base.process_launcher.ICallbackInt;
36 import org.chromium.base.process_launcher.IChildProcessService; 37 import org.chromium.base.process_launcher.IChildProcessService;
37 import org.chromium.content.browser.ChildProcessConstants; 38 import org.chromium.content.browser.ContentChildProcessConstants;
38 import org.chromium.content.common.ContentSwitches; 39 import org.chromium.content.common.ContentSwitches;
39 import org.chromium.content.common.IGpuProcessCallback; 40 import org.chromium.content.common.IGpuProcessCallback;
40 import org.chromium.content.common.SurfaceWrapper; 41 import org.chromium.content.common.SurfaceWrapper;
41 42
42 import java.util.concurrent.Semaphore; 43 import java.util.concurrent.Semaphore;
43 import java.util.concurrent.atomic.AtomicReference; 44 import java.util.concurrent.atomic.AtomicReference;
44 45
45 /** 46 /**
46 * This class implements all of the functionality for {@link ChildProcessService } which owns an 47 * This class implements all of the functionality for {@link ChildProcessService } which owns an
47 * object of {@link ChildProcessServiceImpl}. 48 * object of {@link ChildProcessServiceImpl}.
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 mAuthorizedCallerUid = authorizedCallerUid; 330 mAuthorizedCallerUid = authorizedCallerUid;
330 initializeParams(intent); 331 initializeParams(intent);
331 return mBinder; 332 return mBinder;
332 } 333 }
333 334
334 private void initializeParams(Intent intent) { 335 private void initializeParams(Intent intent) {
335 synchronized (mMainThread) { 336 synchronized (mMainThread) {
336 // mLinkerParams is never used if Linker.isUsed() returns false. 337 // mLinkerParams is never used if Linker.isUsed() returns false.
337 // See onCreate(). 338 // See onCreate().
338 mLinkerParams = (ChromiumLinkerParams) intent.getParcelableExtra( 339 mLinkerParams = (ChromiumLinkerParams) intent.getParcelableExtra(
339 ChildProcessConstants.EXTRA_LINKER_PARAMS); 340 ContentChildProcessConstants.EXTRA_LINKER_PARAMS);
340 mLibraryProcessType = ChildProcessCreationParams.getLibraryProcessTy pe(intent); 341 mLibraryProcessType = ChildProcessCreationParams.getLibraryProcessTy pe(intent);
341 mMainThread.notifyAll(); 342 mMainThread.notifyAll();
342 } 343 }
343 synchronized (mBinderLock) { 344 synchronized (mBinderLock) {
344 mBindToCallerCheck = 345 mBindToCallerCheck = intent.getBooleanExtra(
345 intent.getBooleanExtra(ChildProcessConstants.EXTRA_BIND_TO_C ALLER, false); 346 ContentChildProcessConstants.EXTRA_BIND_TO_CALLER, false);
346 } 347 }
347 } 348 }
348 349
349 private void getServiceInfo(Bundle bundle) { 350 private void getServiceInfo(Bundle bundle) {
350 // Required to unparcel FileDescriptorInfo. 351 // Required to unparcel FileDescriptorInfo.
351 bundle.setClassLoader(mHostClassLoader); 352 bundle.setClassLoader(mHostClassLoader);
352 synchronized (mMainThread) { 353 synchronized (mMainThread) {
353 if (mCommandLineParams == null) { 354 if (mCommandLineParams == null) {
354 mCommandLineParams = 355 mCommandLineParams =
355 bundle.getStringArray(ChildProcessConstants.EXTRA_COMMAN D_LINE); 356 bundle.getStringArray(ChildProcessConstants.EXTRA_COMMAN D_LINE);
356 mMainThread.notifyAll(); 357 mMainThread.notifyAll();
357 } 358 }
358 // We must have received the command line by now 359 // We must have received the command line by now
359 assert mCommandLineParams != null; 360 assert mCommandLineParams != null;
360 mCpuCount = bundle.getInt(ChildProcessConstants.EXTRA_CPU_COUNT); 361 mCpuCount = bundle.getInt(ContentChildProcessConstants.EXTRA_CPU_COU NT);
361 mCpuFeatures = bundle.getLong(ChildProcessConstants.EXTRA_CPU_FEATUR ES); 362 mCpuFeatures = bundle.getLong(ContentChildProcessConstants.EXTRA_CPU _FEATURES);
362 assert mCpuCount > 0; 363 assert mCpuCount > 0;
363 Parcelable[] fdInfosAsParcelable = 364 Parcelable[] fdInfosAsParcelable =
364 bundle.getParcelableArray(ChildProcessConstants.EXTRA_FILES) ; 365 bundle.getParcelableArray(ChildProcessConstants.EXTRA_FILES) ;
365 if (fdInfosAsParcelable != null) { 366 if (fdInfosAsParcelable != null) {
366 // For why this arraycopy is necessary: 367 // For why this arraycopy is necessary:
367 // http://stackoverflow.com/questions/8745893/i-dont-get-why-thi s-classcastexception-occurs 368 // http://stackoverflow.com/questions/8745893/i-dont-get-why-thi s-classcastexception-occurs
368 mFdInfos = new FileDescriptorInfo[fdInfosAsParcelable.length]; 369 mFdInfos = new FileDescriptorInfo[fdInfosAsParcelable.length];
369 System.arraycopy(fdInfosAsParcelable, 0, mFdInfos, 0, fdInfosAsP arcelable.length); 370 System.arraycopy(fdInfosAsParcelable, 0, mFdInfos, 0, fdInfosAsP arcelable.length);
370 } 371 }
371 Bundle sharedRelros = bundle.getBundle(Linker.EXTRA_LINKER_SHARED_RE LROS); 372 Bundle sharedRelros = bundle.getBundle(Linker.EXTRA_LINKER_SHARED_RE LROS);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 private static native void nativeInitChildProcessImpl( 435 private static native void nativeInitChildProcessImpl(
435 ChildProcessServiceImpl serviceImpl, int cpuCount, long cpuFeatures) ; 436 ChildProcessServiceImpl serviceImpl, int cpuCount, long cpuFeatures) ;
436 437
437 /** 438 /**
438 * Force the child process to exit. 439 * Force the child process to exit.
439 */ 440 */
440 private static native void nativeExitChildProcess(); 441 private static native void nativeExitChildProcess();
441 442
442 private native void nativeShutdownMainThread(); 443 private native void nativeShutdownMainThread();
443 } 444 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698