Chromium Code Reviews| 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..db33755968e425e7882ff882f611810c3f1c6592 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 |
| @@ -99,17 +99,32 @@ 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; |
| } |
| - public static BrowserStartupController get(Context context) { |
| + /** |
| + * 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 could be |
|
Ted C
2015/02/06 01:37:43
It [must] be ..BROWSER or ..WEBVIEW.
michaelbai
2015/02/10 05:17:31
Done.
|
| + * LibraryLoader.BROWSER or LibraryLoader.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 LibraryLoader.BROWSER == libraryProcessType |
| + || LibraryLoader.WEBVIEW == libraryProcessType; |
| + sInstance = new BrowserStartupController(context.getApplicationContext(), |
| + libraryProcessType); |
| } |
| + assert sInstance.mLibraryProcessType == libraryProcessType : "Wrong process type"; |
| return sInstance; |
| } |
| @@ -257,7 +272,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); |