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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/DeferredStartupHandler.java

Issue 2397623004: Revert of [Reland] Refactor WebappRegistry into a singleton instance. (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/ServiceTabLauncher.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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; 5 package org.chromium.chrome.browser;
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.content.SharedPreferences; 9 import android.content.SharedPreferences;
10 import android.content.pm.ResolveInfo; 10 import android.content.pm.ResolveInfo;
(...skipping 30 matching lines...) Expand all
41 import org.chromium.chrome.browser.partnerbookmarks.PartnerBookmarksShim; 41 import org.chromium.chrome.browser.partnerbookmarks.PartnerBookmarksShim;
42 import org.chromium.chrome.browser.partnercustomizations.HomepageManager; 42 import org.chromium.chrome.browser.partnercustomizations.HomepageManager;
43 import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomiza tions; 43 import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomiza tions;
44 import org.chromium.chrome.browser.physicalweb.PhysicalWeb; 44 import org.chromium.chrome.browser.physicalweb.PhysicalWeb;
45 import org.chromium.chrome.browser.precache.PrecacheLauncher; 45 import org.chromium.chrome.browser.precache.PrecacheLauncher;
46 import org.chromium.chrome.browser.preferences.ChromePreferenceManager; 46 import org.chromium.chrome.browser.preferences.ChromePreferenceManager;
47 import org.chromium.chrome.browser.preferences.privacy.PrivacyPreferencesManager ; 47 import org.chromium.chrome.browser.preferences.privacy.PrivacyPreferencesManager ;
48 import org.chromium.chrome.browser.share.ShareHelper; 48 import org.chromium.chrome.browser.share.ShareHelper;
49 import org.chromium.chrome.browser.webapps.ChromeWebApkHost; 49 import org.chromium.chrome.browser.webapps.ChromeWebApkHost;
50 import org.chromium.chrome.browser.webapps.WebApkVersionManager; 50 import org.chromium.chrome.browser.webapps.WebApkVersionManager;
51 import org.chromium.chrome.browser.webapps.WebappRegistry;
52 import org.chromium.content.browser.ChildProcessLauncher; 51 import org.chromium.content.browser.ChildProcessLauncher;
53 52
54 import java.util.ArrayList; 53 import java.util.ArrayList;
55 import java.util.LinkedList; 54 import java.util.LinkedList;
56 import java.util.List; 55 import java.util.List;
57 import java.util.Locale; 56 import java.util.Locale;
58 import java.util.Queue; 57 import java.util.Queue;
59 import java.util.concurrent.TimeUnit; 58 import java.util.concurrent.TimeUnit;
60 59
61 /** 60 /**
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 ThreadUtils.assertOnUiThread(); 166 ThreadUtils.assertOnUiThread();
168 167
169 RecordHistogram.recordLongTimesHistogram( 168 RecordHistogram.recordLongTimesHistogram(
170 "UMA.Debug.EnableCrashUpload.DeferredStartUptime2", 169 "UMA.Debug.EnableCrashUpload.DeferredStartUptime2",
171 SystemClock.uptimeMillis() - UmaUtils.getForegroundStartTime(), 170 SystemClock.uptimeMillis() - UmaUtils.getForegroundStartTime(),
172 TimeUnit.MILLISECONDS); 171 TimeUnit.MILLISECONDS);
173 172
174 mDeferredTasks.add(new Runnable() { 173 mDeferredTasks.add(new Runnable() {
175 @Override 174 @Override
176 public void run() { 175 public void run() {
177 // Initialize the WebappRegistry if it's not already initialized . Must be done on
178 // the main thread.
179 WebappRegistry.getInstance();
180
181 // Punt all tasks that may block on disk off onto a background t hread. 176 // Punt all tasks that may block on disk off onto a background t hread.
182 initAsyncDiskTask(); 177 initAsyncDiskTask();
183 178
184 AfterStartupTaskUtils.setStartupComplete(); 179 AfterStartupTaskUtils.setStartupComplete();
185 180
186 PartnerBrowserCustomizations.setOnInitializeAsyncFinished(new Ru nnable() { 181 PartnerBrowserCustomizations.setOnInitializeAsyncFinished(new Ru nnable() {
187 @Override 182 @Override
188 public void run() { 183 public void run() {
189 String homepageUrl = HomepageManager.getHomepageUri(mApp Context); 184 String homepageUrl = HomepageManager.getHomepageUri(mApp Context);
190 LaunchMetrics.recordHomePageLaunchMetrics( 185 LaunchMetrics.recordHomePageLaunchMetrics(
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 269
275 removeSnapshotDatabase(); 270 removeSnapshotDatabase();
276 271
277 cacheIsChromeDefaultBrowser(); 272 cacheIsChromeDefaultBrowser();
278 273
279 RecordHistogram.recordLongTimesHistogram( 274 RecordHistogram.recordLongTimesHistogram(
280 "UMA.Debug.EnableCrashUpload.DeferredStartUpDuration Async", 275 "UMA.Debug.EnableCrashUpload.DeferredStartUpDuration Async",
281 SystemClock.uptimeMillis() - asyncTaskStartTime, 276 SystemClock.uptimeMillis() - asyncTaskStartTime,
282 TimeUnit.MILLISECONDS); 277 TimeUnit.MILLISECONDS);
283 278
284 // Warm up all web app shared prefs. This must be run after the WebappRegistry
285 // instance is initialized.
286 WebappRegistry.warmUpSharedPrefs();
287
288 return null; 279 return null;
289 } finally { 280 } finally {
290 TraceEvent.end("ChromeBrowserInitializer.onDeferredStartup.d oInBackground"); 281 TraceEvent.end("ChromeBrowserInitializer.onDeferredStartup.d oInBackground");
291 } 282 }
292 } 283 }
293
294 @Override
295 protected void onPostExecute(Void params) {
296 // Must be run on the UI thread after the WebappRegistry has bee n completely warmed.
297 WebappRegistry.getInstance().unregisterOldWebapps(System.current TimeMillis());
298 }
299 }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); 284 }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
300 } 285 }
301 286
302 private void startModerateBindingManagementIfNeeded() { 287 private void startModerateBindingManagementIfNeeded() {
303 // Moderate binding doesn't apply to low end devices. 288 // Moderate binding doesn't apply to low end devices.
304 if (SysUtils.isLowEndDevice()) return; 289 if (SysUtils.isLowEndDevice()) return;
305 290
306 boolean moderateBindingTillBackgrounded = 291 boolean moderateBindingTillBackgrounded =
307 FieldTrialList.findFullName("ModerateBindingOnBackgroundTabCreat ion") 292 FieldTrialList.findFullName("ModerateBindingOnBackgroundTabCreat ion")
308 .equals("Enabled"); 293 .equals("Enabled");
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 } 354 }
370 355
371 /** 356 /**
372 * @return Whether deferred startup has been completed. 357 * @return Whether deferred startup has been completed.
373 */ 358 */
374 @VisibleForTesting 359 @VisibleForTesting
375 public boolean isDeferredStartupCompleteForApp() { 360 public boolean isDeferredStartupCompleteForApp() {
376 return mDeferredStartupCompletedForApp; 361 return mDeferredStartupCompletedForApp;
377 } 362 }
378 } 363 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/ServiceTabLauncher.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698