OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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.app.Service; | 7 import android.app.Service; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.Intent; | 9 import android.content.Intent; |
10 import android.graphics.SurfaceTexture; | 10 import android.graphics.SurfaceTexture; |
11 import android.os.Bundle; | 11 import android.os.Bundle; |
12 import android.os.IBinder; | 12 import android.os.IBinder; |
13 import android.os.Parcelable; | 13 import android.os.Parcelable; |
14 import android.os.Process; | 14 import android.os.Process; |
15 import android.os.RemoteException; | 15 import android.os.RemoteException; |
16 import android.view.Surface; | 16 import android.view.Surface; |
17 | 17 |
18 import org.chromium.base.BaseSwitches; | 18 import org.chromium.base.BaseSwitches; |
19 import org.chromium.base.CommandLine; | 19 import org.chromium.base.CommandLine; |
| 20 import org.chromium.base.ContextUtils; |
20 import org.chromium.base.Log; | 21 import org.chromium.base.Log; |
21 import org.chromium.base.annotations.CalledByNative; | 22 import org.chromium.base.annotations.CalledByNative; |
22 import org.chromium.base.annotations.JNINamespace; | 23 import org.chromium.base.annotations.JNINamespace; |
23 import org.chromium.base.annotations.SuppressFBWarnings; | 24 import org.chromium.base.annotations.SuppressFBWarnings; |
24 import org.chromium.base.library_loader.LibraryLoader; | 25 import org.chromium.base.library_loader.LibraryLoader; |
25 import org.chromium.base.library_loader.LibraryProcessType; | 26 import org.chromium.base.library_loader.LibraryProcessType; |
26 import org.chromium.base.library_loader.Linker; | 27 import org.chromium.base.library_loader.Linker; |
27 import org.chromium.base.library_loader.ProcessInitException; | 28 import org.chromium.base.library_loader.ProcessInitException; |
28 import org.chromium.content.browser.ChildProcessConnection; | 29 import org.chromium.content.browser.ChildProcessConnection; |
29 import org.chromium.content.browser.ChildProcessLauncher; | 30 import org.chromium.content.browser.ChildProcessLauncher; |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 .registerRendererProcessHistogram(requestedSharedRel
ro, | 205 .registerRendererProcessHistogram(requestedSharedRel
ro, |
205 loadAtFixedAddressFailed); | 206 loadAtFixedAddressFailed); |
206 LibraryLoader.get(LibraryProcessType.PROCESS_CHILD).initiali
ze(); | 207 LibraryLoader.get(LibraryProcessType.PROCESS_CHILD).initiali
ze(); |
207 synchronized (mMainThread) { | 208 synchronized (mMainThread) { |
208 mLibraryInitialized = true; | 209 mLibraryInitialized = true; |
209 mMainThread.notifyAll(); | 210 mMainThread.notifyAll(); |
210 while (mFdInfos == null) { | 211 while (mFdInfos == null) { |
211 mMainThread.wait(); | 212 mMainThread.wait(); |
212 } | 213 } |
213 } | 214 } |
214 ContentMain.initApplicationContext(sContext.get().getApplica
tionContext()); | 215 ContextUtils.initApplicationContext(sContext.get().getApplic
ationContext()); |
215 for (FileDescriptorInfo fdInfo : mFdInfos) { | 216 for (FileDescriptorInfo fdInfo : mFdInfos) { |
216 nativeRegisterGlobalFileDescriptor( | 217 nativeRegisterGlobalFileDescriptor( |
217 fdInfo.mId, fdInfo.mFd.detachFd(), fdInfo.mOffse
t, fdInfo.mSize); | 218 fdInfo.mId, fdInfo.mFd.detachFd(), fdInfo.mOffse
t, fdInfo.mSize); |
218 } | 219 } |
219 nativeInitChildProcess(ChildProcessService.this, mCpuCount,
mCpuFeatures); | 220 nativeInitChildProcess(ChildProcessService.this, mCpuCount,
mCpuFeatures); |
220 if (mActivitySemaphore.tryAcquire()) { | 221 if (mActivitySemaphore.tryAcquire()) { |
221 ContentMain.start(); | 222 ContentMain.start(); |
222 nativeExitChildProcess(); | 223 nativeExitChildProcess(); |
223 } | 224 } |
224 } catch (InterruptedException e) { | 225 } catch (InterruptedException e) { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 private static native void nativeInitChildProcess( | 408 private static native void nativeInitChildProcess( |
408 ChildProcessService service, int cpuCount, long cpuFeatures); | 409 ChildProcessService service, int cpuCount, long cpuFeatures); |
409 | 410 |
410 /** | 411 /** |
411 * Force the child process to exit. | 412 * Force the child process to exit. |
412 */ | 413 */ |
413 private static native void nativeExitChildProcess(); | 414 private static native void nativeExitChildProcess(); |
414 | 415 |
415 private native void nativeShutdownMainThread(); | 416 private native void nativeShutdownMainThread(); |
416 } | 417 } |
OLD | NEW |