| Index: android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
|
| diff --git a/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java b/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
|
| index 15144316e965c0d62a4a718347ba95e19068cff1..96120eabb8d59acc5f29df72cee5096f9eee9f32 100644
|
| --- a/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
|
| +++ b/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
|
| @@ -36,15 +36,12 @@
|
| import org.chromium.android_webview.AwContentsStatics;
|
| import org.chromium.android_webview.AwCookieManager;
|
| import org.chromium.android_webview.AwDevToolsServer;
|
| -import org.chromium.android_webview.AwGeolocationPermissions;
|
| import org.chromium.android_webview.AwNetworkChangeNotifierRegistrationPolicy;
|
| import org.chromium.android_webview.AwQuotaManagerBridge;
|
| import org.chromium.android_webview.AwResource;
|
| import org.chromium.android_webview.AwSettings;
|
| -import org.chromium.android_webview.HttpAuthDatabase;
|
| import org.chromium.android_webview.R;
|
| import org.chromium.android_webview.ResourcesContextWrapperFactory;
|
| -import org.chromium.base.BuildConfig;
|
| import org.chromium.base.CommandLine;
|
| import org.chromium.base.ContextUtils;
|
| import org.chromium.base.MemoryPressureListener;
|
| @@ -382,14 +379,15 @@
|
| }
|
| }
|
|
|
| - // Only on UI thread.
|
| - AwBrowserContext getBrowserContextOnUiThread() {
|
| + AwBrowserContext getBrowserContext() {
|
| + synchronized (mLock) {
|
| + return getBrowserContextLocked();
|
| + }
|
| + }
|
| +
|
| + private AwBrowserContext getBrowserContextLocked() {
|
| + assert Thread.holdsLock(mLock);
|
| assert mStarted;
|
| - if (BuildConfig.DCHECK_IS_ON && !ThreadUtils.runningOnUiThread()) {
|
| - throw new RuntimeException(
|
| - "getBrowserContextOnUiThread called on " + Thread.currentThread());
|
| - }
|
| -
|
| if (mBrowserContext == null) {
|
| mBrowserContext =
|
| new AwBrowserContext(mWebViewPrefs, ContextUtils.getApplicationContext());
|
| @@ -484,12 +482,7 @@
|
| if (mGeolocationPermissions == null) {
|
| ensureChromiumStartedLocked(true);
|
| mGeolocationPermissions = new GeolocationPermissionsAdapter(
|
| - runOnUiThreadBlocking(new Callable<AwGeolocationPermissions>() {
|
| - @Override
|
| - public AwGeolocationPermissions call() {
|
| - return getBrowserContextOnUiThread().getGeolocationPermissions();
|
| - }
|
| - }));
|
| + getBrowserContextLocked().getGeolocationPermissions());
|
| }
|
| }
|
| return mGeolocationPermissions;
|
| @@ -521,30 +514,20 @@
|
| synchronized (mLock) {
|
| if (mWebStorage == null) {
|
| ensureChromiumStartedLocked(true);
|
| - mWebStorage = new WebStorageAdapter(
|
| - runOnUiThreadBlocking(new Callable<AwQuotaManagerBridge>() {
|
| - @Override
|
| - public AwQuotaManagerBridge call() {
|
| - return AwQuotaManagerBridge.getInstance();
|
| - }
|
| - }));
|
| + mWebStorage = new WebStorageAdapter(AwQuotaManagerBridge.getInstance());
|
| }
|
| }
|
| return mWebStorage;
|
| }
|
|
|
| @Override
|
| - public WebViewDatabase getWebViewDatabase(final Context context) {
|
| + public WebViewDatabase getWebViewDatabase(Context context) {
|
| synchronized (mLock) {
|
| if (mWebViewDatabase == null) {
|
| ensureChromiumStartedLocked(true);
|
| + AwBrowserContext browserContext = getBrowserContextLocked();
|
| mWebViewDatabase = new WebViewDatabaseAdapter(
|
| - runOnUiThreadBlocking(new Callable<HttpAuthDatabase>() {
|
| - @Override
|
| - public HttpAuthDatabase call() {
|
| - return getBrowserContextOnUiThread().getHttpAuthDatabase(context);
|
| - }
|
| - }));
|
| + browserContext.getHttpAuthDatabase(context));
|
| }
|
| }
|
| return mWebViewDatabase;
|
|
|