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

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/BrowserStartupController.java

Issue 2247143004: Remove app context init from LibraryLoader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix per review. 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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.browser; 5 package org.chromium.content.browser;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.os.Handler; 8 import android.os.Handler;
9 import android.os.StrictMode; 9 import android.os.StrictMode;
10 10
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 // This field is set after startup has been completed based on whether the s tartup was a success 112 // This field is set after startup has been completed based on whether the s tartup was a success
113 // or not. It is used when later requests to startup come in that happen aft er the initial set 113 // or not. It is used when later requests to startup come in that happen aft er the initial set
114 // of enqueued callbacks have been executed. 114 // of enqueued callbacks have been executed.
115 private boolean mStartupSuccess; 115 private boolean mStartupSuccess;
116 116
117 private int mLibraryProcessType; 117 private int mLibraryProcessType;
118 118
119 BrowserStartupController(Context context, int libraryProcessType) { 119 BrowserStartupController(Context context, int libraryProcessType) {
120 mContext = context.getApplicationContext(); 120 mContext = context.getApplicationContext();
121 mAsyncStartupCallbacks = new ArrayList<StartupCallback>(); 121 mAsyncStartupCallbacks = new ArrayList<>();
122 mLibraryProcessType = libraryProcessType; 122 mLibraryProcessType = libraryProcessType;
123 } 123 }
124 124
125 /** 125 /**
126 * Get BrowserStartupController instance, create a new one if no existing. 126 * Get BrowserStartupController instance, create a new one if no existing.
127 * 127 *
128 * @param context the application context. 128 * @param context the application context.
129 * @param libraryProcessType the type of process the shared library is loade d. it must be 129 * @param libraryProcessType the type of process the shared library is loade d. it must be
130 * LibraryProcessType.PROCESS_BROWSER or 130 * LibraryProcessType.PROCESS_BROWSER or
131 * LibraryProcessType.PROCESS_WEBVIEW. 131 * LibraryProcessType.PROCESS_WEBVIEW.
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 295
296 // This strictmode exception is to cover the case where the browser proc ess is being started 296 // This strictmode exception is to cover the case where the browser proc ess is being started
297 // asynchronously but not in the main browser flow. The main browser fl ow will trigger 297 // asynchronously but not in the main browser flow. The main browser fl ow will trigger
298 // library loading earlier and this will be a no-op, but in the other ca ses this will need 298 // library loading earlier and this will be a no-op, but in the other ca ses this will need
299 // to block on loading libraries. 299 // to block on loading libraries.
300 // This applies to tests and ManageSpaceActivity, which can be launched from Settings. 300 // This applies to tests and ManageSpaceActivity, which can be launched from Settings.
301 StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads(); 301 StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
302 try { 302 try {
303 // Normally Main.java will have already loaded the library asynchron ously, we only need 303 // Normally Main.java will have already loaded the library asynchron ously, we only need
304 // to load it here if we arrived via another flow, e.g. bookmark acc ess & sync setup. 304 // to load it here if we arrived via another flow, e.g. bookmark acc ess & sync setup.
305 LibraryLoader.get(mLibraryProcessType).ensureInitialized(mContext); 305 LibraryLoader.get(mLibraryProcessType).ensureInitialized();
306 } finally { 306 } finally {
307 StrictMode.setThreadPolicy(oldPolicy); 307 StrictMode.setThreadPolicy(oldPolicy);
308 } 308 }
309 309
310 Runnable postResourceExtraction = new Runnable() { 310 Runnable postResourceExtraction = new Runnable() {
311 @Override 311 @Override
312 public void run() { 312 public void run() {
313 if (!mPostResourceExtractionTasksCompleted) { 313 if (!mPostResourceExtractionTasksCompleted) {
314 // TODO(yfriedman): Remove dependency on a command line flag for this. 314 // TODO(yfriedman): Remove dependency on a command line flag for this.
315 DeviceUtils.addDeviceSpecificUserAgentSwitch(mContext); 315 DeviceUtils.addDeviceSpecificUserAgentSwitch(mContext);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 348
349 private static native void nativeSetCommandLineFlags( 349 private static native void nativeSetCommandLineFlags(
350 boolean singleProcess, String pluginDescriptor); 350 boolean singleProcess, String pluginDescriptor);
351 351
352 // Is this an official build of Chrome? Only native code knows for sure. Off icial build 352 // Is this an official build of Chrome? Only native code knows for sure. Off icial build
353 // knowledge is needed very early in process startup. 353 // knowledge is needed very early in process startup.
354 private static native boolean nativeIsOfficialBuild(); 354 private static native boolean nativeIsOfficialBuild();
355 355
356 private static native boolean nativeIsPluginEnabled(); 356 private static native boolean nativeIsPluginEnabled();
357 } 357 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698