| Index: content/public/android/java/src/org/chromium/content/browser/BrowserStartupController.java
|
| diff --git a/content/public/android/java/src/org/chromium/content/browser/BrowserStartupController.java b/content/public/android/java/src/org/chromium/content/browser/BrowserStartupController.java
|
| index 5a12ca69bebf182e55db7b91ace698ead2daef9a..c82365f1c5a24bef2ce58aa57bff46dc0bc54b9a 100644
|
| --- a/content/public/android/java/src/org/chromium/content/browser/BrowserStartupController.java
|
| +++ b/content/public/android/java/src/org/chromium/content/browser/BrowserStartupController.java
|
| @@ -14,6 +14,7 @@ import org.chromium.base.ResourceExtractor;
|
| import org.chromium.base.ThreadUtils;
|
| import org.chromium.base.VisibleForTesting;
|
| import org.chromium.base.library_loader.LibraryLoader;
|
| +import org.chromium.base.library_loader.LibraryProcessType;
|
| import org.chromium.base.library_loader.LoaderErrors;
|
| import org.chromium.base.library_loader.ProcessInitException;
|
| import org.chromium.content.app.ContentMain;
|
| @@ -99,17 +100,38 @@ public class BrowserStartupController {
|
| // of enqueued callbacks have been executed.
|
| private boolean mStartupSuccess;
|
|
|
| - BrowserStartupController(Context context) {
|
| + private int mLibraryProcessType;
|
| +
|
| + BrowserStartupController(Context context, int libraryProcessType) {
|
| mContext = context;
|
| mAsyncStartupCallbacks = new ArrayList<StartupCallback>();
|
| + mLibraryProcessType = libraryProcessType;
|
| }
|
|
|
| + // TODO(michaelbai): Remove method once down stream is converted to use new method.
|
| public static BrowserStartupController get(Context context) {
|
| + return get(context, LibraryProcessType.PROCESS_BROWSER);
|
| + }
|
| +
|
| + /**
|
| + * Get BrowserStartupController instance, create a new one if no existing.
|
| + *
|
| + * @param context the application context.
|
| + * @param libraryProcessType the type of process the shared library is loaded. it must be
|
| + * LibraryProcessType.PROCESS_BROWSER or
|
| + * LibraryProcessType.PROCESS_WEBVIEW.
|
| + * @return BrowserStartupController instance.
|
| + */
|
| + public static BrowserStartupController get(Context context, int libraryProcessType) {
|
| assert ThreadUtils.runningOnUiThread() : "Tried to start the browser on the wrong thread.";
|
| ThreadUtils.assertOnUiThread();
|
| if (sInstance == null) {
|
| - sInstance = new BrowserStartupController(context.getApplicationContext());
|
| + assert LibraryProcessType.PROCESS_BROWSER == libraryProcessType
|
| + || LibraryProcessType.PROCESS_WEBVIEW == libraryProcessType;
|
| + sInstance = new BrowserStartupController(context.getApplicationContext(),
|
| + libraryProcessType);
|
| }
|
| + assert sInstance.mLibraryProcessType == libraryProcessType : "Wrong process type";
|
| return sInstance;
|
| }
|
|
|
| @@ -257,7 +279,7 @@ public class BrowserStartupController {
|
|
|
| // Normally Main.java will have already loaded the library asynchronously, we only need
|
| // to load it here if we arrived via another flow, e.g. bookmark access & sync setup.
|
| - LibraryLoader.ensureInitialized(mContext, true);
|
| + LibraryLoader.get(mLibraryProcessType).ensureInitialized(mContext, true);
|
|
|
| // TODO(yfriedman): Remove dependency on a command line flag for this.
|
| DeviceUtils.addDeviceSpecificUserAgentSwitch(mContext);
|
|
|