Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(899)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java

Issue 2207933002: Reland of Separate deferred startup into tasks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix one-line. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java
index ace78a5b2e54fbf994705877d490a45255da0aa7..e640decb13ae08bf2719f91e39fd8dd6c65303b0 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java
@@ -277,6 +277,7 @@ public class ChromeApplication extends ContentApplication {
* activity.
*/
private void onForegroundSessionStart() {
+ UmaUtils.recordForegroundStartTime();
ChildProcessLauncher.onBroughtToForeground();
mBackgroundProcessing.startTimers();
updatePasswordEchoState();
@@ -445,38 +446,61 @@ public class ChromeApplication extends ContentApplication {
if (mInitializedSharedClasses) return;
mInitializedSharedClasses = true;
- ForcedSigninProcessor.start(this);
- AccountsChangedReceiver.addObserver(new AccountsChangedReceiver.AccountsChangedObserver() {
+ DeferredStartupHandler.getInstance().addDeferredTask(new Runnable() {
@Override
- public void onAccountsChanged(Context context, Intent intent) {
- ThreadUtils.runOnUiThread(new Runnable() {
- @Override
- public void run() {
- ForcedSigninProcessor.start(ChromeApplication.this);
- }
- });
+ public void run() {
+ ForcedSigninProcessor.start(getApplicationContext());
+ AccountsChangedReceiver.addObserver(
+ new AccountsChangedReceiver.AccountsChangedObserver() {
+ @Override
+ public void onAccountsChanged(Context context, Intent intent) {
+ ThreadUtils.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ ForcedSigninProcessor.start(getApplicationContext());
+ }
+ });
+ }
+ });
}
});
- GoogleServicesManager.get(this).onMainActivityStart();
- RevenueStats.getInstance();
- mDevToolsServer = new DevToolsServer(DEV_TOOLS_SERVER_SOCKET_PREFIX);
- mDevToolsServer.setRemoteDebuggingEnabled(
- true, DevToolsServer.Security.ALLOW_DEBUG_PERMISSION);
+ DeferredStartupHandler.getInstance().addDeferredTask(new Runnable() {
+ @Override
+ public void run() {
+ GoogleServicesManager.get(getApplicationContext()).onMainActivityStart();
+ RevenueStats.getInstance();
+ }
+ });
- startApplicationActivityTracker();
+ DeferredStartupHandler.getInstance().addDeferredTask(new Runnable() {
+ @Override
+ public void run() {
+ mDevToolsServer = new DevToolsServer(DEV_TOOLS_SERVER_SOCKET_PREFIX);
+ mDevToolsServer.setRemoteDebuggingEnabled(
+ true, DevToolsServer.Security.ALLOW_DEBUG_PERMISSION);
- // Add process check to diagnose http://crbug.com/606309. Remove this after the bug is
- // fixed.
- assert !CommandLine.getInstance().hasSwitch(ContentSwitches.SWITCH_PROCESS_TYPE);
- if (!CommandLine.getInstance().hasSwitch(ContentSwitches.SWITCH_PROCESS_TYPE)) {
- DownloadController.setDownloadNotificationService(
- DownloadManagerService.getDownloadManagerService(this));
- }
+ startApplicationActivityTracker();
+ }
+ });
- if (ApiCompatibilityUtils.isPrintingSupported()) {
- mPrintingController = PrintingControllerFactory.create(getApplicationContext());
- }
+ DeferredStartupHandler.getInstance().addDeferredTask(new Runnable() {
+ @Override
+ public void run() {
+ // Add process check to diagnose http://crbug.com/606309. Remove this after the bug
+ // is fixed.
+ assert !CommandLine.getInstance().hasSwitch(ContentSwitches.SWITCH_PROCESS_TYPE);
+ if (!CommandLine.getInstance().hasSwitch(ContentSwitches.SWITCH_PROCESS_TYPE)) {
+ DownloadController.setDownloadNotificationService(
+ DownloadManagerService.getDownloadManagerService(
+ getApplicationContext()));
+ }
+
+ if (ApiCompatibilityUtils.isPrintingSupported()) {
+ mPrintingController = PrintingControllerFactory.create(getApplicationContext());
+ }
+ }
+ });
}
/**

Powered by Google App Engine
This is Rietveld 408576698