Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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.ParcelFileDescriptor; | 13 import android.os.ParcelFileDescriptor; |
| 14 import android.os.Process; | 14 import android.os.Process; |
| 15 import android.os.RemoteException; | 15 import android.os.RemoteException; |
| 16 import android.util.Log; | 16 import android.util.Log; |
| 17 import android.view.Surface; | 17 import android.view.Surface; |
| 18 | 18 |
| 19 import org.chromium.base.CalledByNative; | 19 import org.chromium.base.CalledByNative; |
| 20 import org.chromium.base.JNINamespace; | 20 import org.chromium.base.JNINamespace; |
| 21 import org.chromium.content.browser.ChildProcessConnection; | 21 import org.chromium.content.browser.ChildProcessConnection; |
| 22 import org.chromium.content.browser.StartupObserver; | |
| 22 import org.chromium.content.common.IChildProcessCallback; | 23 import org.chromium.content.common.IChildProcessCallback; |
| 23 import org.chromium.content.common.IChildProcessService; | 24 import org.chromium.content.common.IChildProcessService; |
| 24 import org.chromium.content.browser.ChildProcessLauncher; | 25 import org.chromium.content.browser.ChildProcessLauncher; |
| 25 import org.chromium.content.common.ProcessInitException; | 26 import org.chromium.content.common.ProcessInitException; |
| 26 | 27 |
| 27 import java.util.ArrayList; | 28 import java.util.ArrayList; |
| 28 import java.util.concurrent.atomic.AtomicReference; | 29 import java.util.concurrent.atomic.AtomicReference; |
| 29 | 30 |
| 30 /** | 31 /** |
| 31 * This is the base class for child services; the [Non]SandboxedProcessService0, 1.. etc | 32 * This is the base class for child services; the [Non]SandboxedProcessService0, 1.. etc |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 mMainThread.wait(); | 132 mMainThread.wait(); |
| 132 } | 133 } |
| 133 } | 134 } |
| 134 assert mFileIds.size() == mFileFds.size(); | 135 assert mFileIds.size() == mFileFds.size(); |
| 135 int[] fileIds = new int[mFileIds.size()]; | 136 int[] fileIds = new int[mFileIds.size()]; |
| 136 int[] fileFds = new int[mFileFds.size()]; | 137 int[] fileFds = new int[mFileFds.size()]; |
| 137 for (int i = 0; i < mFileIds.size(); ++i) { | 138 for (int i = 0; i < mFileIds.size(); ++i) { |
| 138 fileIds[i] = mFileIds.get(i); | 139 fileIds[i] = mFileIds.get(i); |
| 139 fileFds[i] = mFileFds.get(i).detachFd(); | 140 fileFds[i] = mFileFds.get(i).detachFd(); |
| 140 } | 141 } |
| 141 ContentMain.initApplicationContext(sContext.get().getApplica tionContext()); | 142 ContentMain contentMain = new ContentMain(); |
| 143 contentMain.initApplicationContext(sContext.get().getApplica tionContext()); | |
| 142 nativeInitChildProcess(sContext.get().getApplicationContext( ), | 144 nativeInitChildProcess(sContext.get().getApplicationContext( ), |
| 143 ChildProcessService.this, fileIds, fileFds, | 145 ChildProcessService.this, fileIds, fileFds, |
| 144 mCpuCount, mCpuFeatures); | 146 mCpuCount, mCpuFeatures); |
| 145 ContentMain.start(); | 147 contentMain.start(true, new StartupObserver()); |
|
joth
2013/07/22 16:28:15
initApplicationContext & start are still static (I
aberent
2013/07/22 19:37:40
Done. I should have reverted these changes; at one
| |
| 146 nativeExitChildProcess(); | 148 nativeExitChildProcess(); |
| 147 } catch (InterruptedException e) { | 149 } catch (InterruptedException e) { |
| 148 Log.w(TAG, MAIN_THREAD_NAME + " startup failed: " + e); | 150 Log.w(TAG, MAIN_THREAD_NAME + " startup failed: " + e); |
| 149 } catch (ProcessInitException e) { | 151 } catch (ProcessInitException e) { |
| 150 Log.w(TAG, MAIN_THREAD_NAME + " startup failed: " + e); | 152 Log.w(TAG, MAIN_THREAD_NAME + " startup failed: " + e); |
| 151 } | 153 } |
| 152 } | 154 } |
| 153 }, MAIN_THREAD_NAME); | 155 }, MAIN_THREAD_NAME); |
| 154 mMainThread.start(); | 156 mMainThread.start(); |
| 155 } | 157 } |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 266 ChildProcessService service, int[] extraFileIds, int[] extraFileFds, | 268 ChildProcessService service, int[] extraFileIds, int[] extraFileFds, |
| 267 int cpuCount, long cpuFeatures); | 269 int cpuCount, long cpuFeatures); |
| 268 | 270 |
| 269 /** | 271 /** |
| 270 * Force the child process to exit. | 272 * Force the child process to exit. |
| 271 */ | 273 */ |
| 272 private static native void nativeExitChildProcess(); | 274 private static native void nativeExitChildProcess(); |
| 273 | 275 |
| 274 private native void nativeShutdownMainThread(); | 276 private native void nativeShutdownMainThread(); |
| 275 } | 277 } |
| OLD | NEW |