@VisibleForTesting void prepareToStartBrowserProcess(int maxRendererProcesses) throws ProcessInitException { Log.i(TAG, "Initializing chromium process, renderers=" + maxRendererProcesses); // Normally Main.java will have kicked this off asynchronously for Chrome. But other // ContentView apps like tests also need them so we make sure we've extracted resources // here. We can still make it a little async (wait until the library is loaded). ResourceExtractor resourceExtractor = ResourceExtractor.get(mContext); resourceExtractor.startExtractingResources(); // 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); // TODO(yfriedman): Remove dependency on a command line flag for this. DeviceUtils.addDeviceSpecificUserAgentSwitch(mContext); Context appContext = mContext.getApplicationContext(); // Now we really need to have the resources ready. resourceExtractor.waitForCompletion(); nativeSetCommandLineFlags(maxRendererProcesses, nativeIsPluginEnabled() ? getPlugins() : null); ContentMain.initApplicationContext(appContext); }
/** Wrap ContentMain.start() for testing. */ @VisibleForTesting int contentStart() { return ContentMain.start(); }