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 13 matching lines...) Expand all Loading... |
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.ChildProcessCreationParams; | 33 import org.chromium.base.process_launcher.ChildProcessCreationParams; |
| 34 import org.chromium.base.process_launcher.FileDescriptorInfo; |
34 import org.chromium.content.browser.ChildProcessConstants; | 35 import org.chromium.content.browser.ChildProcessConstants; |
35 import org.chromium.content.common.ContentSwitches; | 36 import org.chromium.content.common.ContentSwitches; |
36 import org.chromium.content.common.FileDescriptorInfo; | |
37 import org.chromium.content.common.IChildProcessCallback; | 37 import org.chromium.content.common.IChildProcessCallback; |
38 import org.chromium.content.common.IChildProcessService; | 38 import org.chromium.content.common.IChildProcessService; |
39 import org.chromium.content.common.SurfaceWrapper; | 39 import org.chromium.content.common.SurfaceWrapper; |
40 | 40 |
41 import java.util.concurrent.Semaphore; | 41 import java.util.concurrent.Semaphore; |
42 import java.util.concurrent.atomic.AtomicReference; | 42 import java.util.concurrent.atomic.AtomicReference; |
43 | 43 |
44 /** | 44 /** |
45 * 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 |
46 * object of {@link ChildProcessServiceImpl}. | 46 * object of {@link ChildProcessServiceImpl}. |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 mMainThread.wait(); | 261 mMainThread.wait(); |
262 } | 262 } |
263 } | 263 } |
264 | 264 |
265 int[] fileIds = new int[mFdInfos.length]; | 265 int[] fileIds = new int[mFdInfos.length]; |
266 int[] fds = new int[mFdInfos.length]; | 266 int[] fds = new int[mFdInfos.length]; |
267 long[] regionOffsets = new long[mFdInfos.length]; | 267 long[] regionOffsets = new long[mFdInfos.length]; |
268 long[] regionSizes = new long[mFdInfos.length]; | 268 long[] regionSizes = new long[mFdInfos.length]; |
269 for (int i = 0; i < mFdInfos.length; i++) { | 269 for (int i = 0; i < mFdInfos.length; i++) { |
270 FileDescriptorInfo fdInfo = mFdInfos[i]; | 270 FileDescriptorInfo fdInfo = mFdInfos[i]; |
271 fileIds[i] = fdInfo.mId; | 271 fileIds[i] = fdInfo.id; |
272 fds[i] = fdInfo.mFd.detachFd(); | 272 fds[i] = fdInfo.fd.detachFd(); |
273 regionOffsets[i] = fdInfo.mOffset; | 273 regionOffsets[i] = fdInfo.offset; |
274 regionSizes[i] = fdInfo.mSize; | 274 regionSizes[i] = fdInfo.size; |
275 } | 275 } |
276 nativeRegisterFileDescriptors(fileIds, fds, regionOffsets, r
egionSizes); | 276 nativeRegisterFileDescriptors(fileIds, fds, regionOffsets, r
egionSizes); |
277 nativeInitChildProcessImpl(ChildProcessServiceImpl.this, mCp
uCount, | 277 nativeInitChildProcessImpl(ChildProcessServiceImpl.this, mCp
uCount, |
278 mCpuFeatures); | 278 mCpuFeatures); |
279 if (mActivitySemaphore.tryAcquire()) { | 279 if (mActivitySemaphore.tryAcquire()) { |
280 ContentMain.start(); | 280 ContentMain.start(); |
281 nativeExitChildProcess(); | 281 nativeExitChildProcess(); |
282 } | 282 } |
283 } catch (InterruptedException e) { | 283 } catch (InterruptedException e) { |
284 Log.w(TAG, "%s startup failed: %s", MAIN_THREAD_NAME, e); | 284 Log.w(TAG, "%s startup failed: %s", MAIN_THREAD_NAME, e); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 private static native void nativeInitChildProcessImpl( | 430 private static native void nativeInitChildProcessImpl( |
431 ChildProcessServiceImpl serviceImpl, int cpuCount, long cpuFeatures)
; | 431 ChildProcessServiceImpl serviceImpl, int cpuCount, long cpuFeatures)
; |
432 | 432 |
433 /** | 433 /** |
434 * Force the child process to exit. | 434 * Force the child process to exit. |
435 */ | 435 */ |
436 private static native void nativeExitChildProcess(); | 436 private static native void nativeExitChildProcess(); |
437 | 437 |
438 private native void nativeShutdownMainThread(); | 438 private native void nativeShutdownMainThread(); |
439 } | 439 } |
OLD | NEW |