OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.chrome.browser.init; | 5 package org.chromium.chrome.browser.init; |
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.os.Handler; | 9 import android.os.Handler; |
10 import android.os.Looper; | 10 import android.os.Looper; |
11 import android.util.Log; | 11 import android.util.Log; |
12 | 12 |
13 import org.chromium.base.ThreadUtils; | 13 import org.chromium.base.ThreadUtils; |
14 import org.chromium.base.library_loader.LibraryLoader; | 14 import org.chromium.base.library_loader.LibraryLoader; |
15 import org.chromium.base.library_loader.LibraryProcessType; | 15 import org.chromium.base.library_loader.LibraryProcessType; |
16 import org.chromium.base.library_loader.ProcessInitException; | 16 import org.chromium.base.library_loader.ProcessInitException; |
17 import org.chromium.chrome.browser.ChromeApplication; | |
18 import org.chromium.content.browser.ChildProcessLauncher; | 17 import org.chromium.content.browser.ChildProcessLauncher; |
19 | 18 |
20 import java.util.ArrayList; | 19 import java.util.ArrayList; |
21 import java.util.List; | 20 import java.util.List; |
22 | 21 |
23 /** | 22 /** |
24 * This class controls the different asynchronous states during our initializati
on: | 23 * This class controls the different asynchronous states during our initializati
on: |
25 * 1. During startBackgroundTasks(), we'll kick off loading the library and yiel
d the call stack. | 24 * 1. During startBackgroundTasks(), we'll kick off loading the library and yiel
d the call stack. |
26 * 2. We may receive a onStart() / onStop() call any point after that, whether o
r not | 25 * 2. We may receive a onStart() / onStop() call any point after that, whether o
r not |
27 * the library has been loaded. | 26 * the library has been loaded. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // some. Doing it earlier delays UI inflation and more | 91 // some. Doing it earlier delays UI inflation and more |
93 // generally startup on some devices, most likely by | 92 // generally startup on some devices, most likely by |
94 // competing for IO. | 93 // competing for IO. |
95 // For experimental results, see http://crbug.com/460438. | 94 // For experimental results, see http://crbug.com/460438. |
96 libraryLoader.asyncPrefetchLibrariesToMemory(); | 95 libraryLoader.asyncPrefetchLibrariesToMemory(); |
97 } catch (ProcessInitException e) { | 96 } catch (ProcessInitException e) { |
98 Log.e(TAG, "Unable to load native library.", e); | 97 Log.e(TAG, "Unable to load native library.", e); |
99 mActivityDelegate.onStartupFailure(); | 98 mActivityDelegate.onStartupFailure(); |
100 return; | 99 return; |
101 } | 100 } |
102 ChromeApplication chrome = (ChromeApplication) mContext; | 101 ChildProcessLauncher.warmUp(mContext); |
103 ChildProcessLauncher.warmUp(mContext, chrome.getChildProcessCrea
tionParams()); | |
104 ThreadUtils.runOnUiThread(new Runnable() { | 102 ThreadUtils.runOnUiThread(new Runnable() { |
105 @Override | 103 @Override |
106 public void run() { | 104 public void run() { |
107 onLibraryLoaded(); | 105 onLibraryLoaded(); |
108 } | 106 } |
109 }); | 107 }); |
110 } | 108 } |
111 }.start(); | 109 }.start(); |
112 } | 110 } |
113 | 111 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 ActivityResult activityResult; | 261 ActivityResult activityResult; |
264 for (int i = 0; i < mPendingActivityResults.size(); i++) { | 262 for (int i = 0; i < mPendingActivityResults.size(); i++) { |
265 activityResult = mPendingActivityResults.get(i); | 263 activityResult = mPendingActivityResults.get(i); |
266 mActivityDelegate.onActivityResultWithNative(activityResult.requ
estCode, | 264 mActivityDelegate.onActivityResultWithNative(activityResult.requ
estCode, |
267 activityResult.resultCode, activityResult.data); | 265 activityResult.resultCode, activityResult.data); |
268 } | 266 } |
269 mPendingActivityResults = null; | 267 mPendingActivityResults = null; |
270 } | 268 } |
271 } | 269 } |
272 } | 270 } |
OLD | NEW |