| 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; |
| 11 import android.os.Bundle; | 11 import android.os.Bundle; |
| 12 import android.os.IBinder; | 12 import android.os.IBinder; |
| 13 import android.os.Parcel; | 13 import android.os.Parcel; |
| 14 import android.os.Parcelable; | 14 import android.os.Parcelable; |
| 15 import android.os.Process; | 15 import android.os.Process; |
| 16 import android.os.RemoteException; | 16 import android.os.RemoteException; |
| 17 import android.view.Surface; | 17 import android.view.Surface; |
| 18 | 18 |
| 19 import org.chromium.base.BaseSwitches; | 19 import org.chromium.base.BaseSwitches; |
| 20 import org.chromium.base.CommandLine; | 20 import org.chromium.base.CommandLine; |
| 21 import org.chromium.base.ContextUtils; | 21 import org.chromium.base.ContextUtils; |
| 22 import org.chromium.base.JNIUtils; |
| 22 import org.chromium.base.Log; | 23 import org.chromium.base.Log; |
| 23 import org.chromium.base.UnguessableToken; | 24 import org.chromium.base.UnguessableToken; |
| 24 import org.chromium.base.annotations.CalledByNative; | 25 import org.chromium.base.annotations.CalledByNative; |
| 25 import org.chromium.base.annotations.JNINamespace; | 26 import org.chromium.base.annotations.JNINamespace; |
| 26 import org.chromium.base.annotations.MainDex; | 27 import org.chromium.base.annotations.MainDex; |
| 27 import org.chromium.base.annotations.SuppressFBWarnings; | 28 import org.chromium.base.annotations.SuppressFBWarnings; |
| 28 import org.chromium.base.annotations.UsedByReflection; | 29 import org.chromium.base.annotations.UsedByReflection; |
| 29 import org.chromium.base.library_loader.LibraryLoader; | 30 import org.chromium.base.library_loader.LibraryLoader; |
| 30 import org.chromium.base.library_loader.Linker; | 31 import org.chromium.base.library_loader.Linker; |
| 31 import org.chromium.base.library_loader.ProcessInitException; | 32 import org.chromium.base.library_loader.ProcessInitException; |
| 32 import org.chromium.content.browser.ChildProcessConstants; | 33 import org.chromium.content.browser.ChildProcessConstants; |
| 33 import org.chromium.content.browser.ChildProcessCreationParams; | 34 import org.chromium.content.browser.ChildProcessCreationParams; |
| 35 import org.chromium.content.common.ContentSwitches; |
| 34 import org.chromium.content.common.FileDescriptorInfo; | 36 import org.chromium.content.common.FileDescriptorInfo; |
| 35 import org.chromium.content.common.IChildProcessCallback; | 37 import org.chromium.content.common.IChildProcessCallback; |
| 36 import org.chromium.content.common.IChildProcessService; | 38 import org.chromium.content.common.IChildProcessService; |
| 37 import org.chromium.content.common.SurfaceWrapper; | 39 import org.chromium.content.common.SurfaceWrapper; |
| 38 | 40 |
| 39 import java.util.concurrent.Semaphore; | 41 import java.util.concurrent.Semaphore; |
| 40 import java.util.concurrent.atomic.AtomicReference; | 42 import java.util.concurrent.atomic.AtomicReference; |
| 41 | 43 |
| 42 /** | 44 /** |
| 43 * This class implements all of the functionality for {@link ChildProcessService
} which owns an | 45 * This class implements all of the functionality for {@link ChildProcessService
} which owns an |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 public void run() { | 187 public void run() { |
| 186 try { | 188 try { |
| 187 // CommandLine must be initialized before everything else. | 189 // CommandLine must be initialized before everything else. |
| 188 synchronized (mMainThread) { | 190 synchronized (mMainThread) { |
| 189 while (mCommandLineParams == null) { | 191 while (mCommandLineParams == null) { |
| 190 mMainThread.wait(); | 192 mMainThread.wait(); |
| 191 } | 193 } |
| 192 } | 194 } |
| 193 CommandLine.init(mCommandLineParams); | 195 CommandLine.init(mCommandLineParams); |
| 194 | 196 |
| 197 if (ContentSwitches.SWITCH_RENDERER_PROCESS.equals( |
| 198 CommandLine.getInstance().getSwitchValue( |
| 199 ContentSwitches.SWITCH_PROCESS_TYPE))) { |
| 200 JNIUtils.enableSelectiveJniRegistration(); |
| 201 } |
| 202 |
| 195 Linker linker = null; | 203 Linker linker = null; |
| 196 boolean requestedSharedRelro = false; | 204 boolean requestedSharedRelro = false; |
| 197 if (Linker.isUsed()) { | 205 if (Linker.isUsed()) { |
| 198 assert mLinkerParams != null; | 206 assert mLinkerParams != null; |
| 199 linker = getLinker(); | 207 linker = getLinker(); |
| 200 if (mLinkerParams.mWaitForSharedRelro) { | 208 if (mLinkerParams.mWaitForSharedRelro) { |
| 201 requestedSharedRelro = true; | 209 requestedSharedRelro = true; |
| 202 linker.initServiceProcess(mLinkerParams.mBaseLoadAdd
ress); | 210 linker.initServiceProcess(mLinkerParams.mBaseLoadAdd
ress); |
| 203 } else { | 211 } else { |
| 204 linker.disableSharedRelros(); | 212 linker.disableSharedRelros(); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 private static native void nativeInitChildProcessImpl( | 456 private static native void nativeInitChildProcessImpl( |
| 449 ChildProcessServiceImpl serviceImpl, int cpuCount, long cpuFeatures)
; | 457 ChildProcessServiceImpl serviceImpl, int cpuCount, long cpuFeatures)
; |
| 450 | 458 |
| 451 /** | 459 /** |
| 452 * Force the child process to exit. | 460 * Force the child process to exit. |
| 453 */ | 461 */ |
| 454 private static native void nativeExitChildProcess(); | 462 private static native void nativeExitChildProcess(); |
| 455 | 463 |
| 456 private native void nativeShutdownMainThread(); | 464 private native void nativeShutdownMainThread(); |
| 457 } | 465 } |
| OLD | NEW |