| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 com.android.webview.chromium; | 5 package com.android.webview.chromium; |
| 6 | 6 |
| 7 import android.Manifest; | 7 import android.Manifest; |
| 8 import android.app.ActivityManager; | 8 import android.app.ActivityManager; |
| 9 import android.content.ComponentCallbacks2; | 9 import android.content.ComponentCallbacks2; |
| 10 import android.content.Context; | 10 import android.content.Context; |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 | 410 |
| 411 TraceEvent.setATraceEnabled(mWebViewDelegate.isTraceTagEnabled()); | 411 TraceEvent.setATraceEnabled(mWebViewDelegate.isTraceTagEnabled()); |
| 412 mWebViewDelegate.setOnTraceEnabledChangeListener( | 412 mWebViewDelegate.setOnTraceEnabledChangeListener( |
| 413 new WebViewDelegate.OnTraceEnabledChangeListener() { | 413 new WebViewDelegate.OnTraceEnabledChangeListener() { |
| 414 @Override | 414 @Override |
| 415 public void onTraceEnabledChange(boolean enabled) { | 415 public void onTraceEnabledChange(boolean enabled) { |
| 416 TraceEvent.setATraceEnabled(enabled); | 416 TraceEvent.setATraceEnabled(enabled); |
| 417 } | 417 } |
| 418 }); | 418 }); |
| 419 | 419 |
| 420 mStarted = true; |
| 421 |
| 420 // Initialize thread-unsafe singletons. | 422 // Initialize thread-unsafe singletons. |
| 421 AwBrowserContext awBrowserContext = getBrowserContextOnUiThread(); | 423 AwBrowserContext awBrowserContext = getBrowserContextOnUiThread(); |
| 422 mGeolocationPermissions = new GeolocationPermissionsAdapter( | 424 mGeolocationPermissions = new GeolocationPermissionsAdapter( |
| 423 this, awBrowserContext.getGeolocationPermissions()); | 425 this, awBrowserContext.getGeolocationPermissions()); |
| 424 mWebStorage = new WebStorageAdapter(this, AwQuotaManagerBridge.getInstan
ce()); | 426 mWebStorage = new WebStorageAdapter(this, AwQuotaManagerBridge.getInstan
ce()); |
| 425 if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) { | 427 if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) { |
| 426 mServiceWorkerController = new ServiceWorkerControllerAdapter( | 428 mServiceWorkerController = new ServiceWorkerControllerAdapter( |
| 427 awBrowserContext.getServiceWorkerController()); | 429 awBrowserContext.getServiceWorkerController()); |
| 428 } | 430 } |
| 429 | 431 |
| 430 mStarted = true; | |
| 431 mRunQueue.drainQueue(); | 432 mRunQueue.drainQueue(); |
| 432 } | 433 } |
| 433 | 434 |
| 434 boolean hasStarted() { | 435 boolean hasStarted() { |
| 435 return mStarted; | 436 return mStarted; |
| 436 } | 437 } |
| 437 | 438 |
| 438 void startYourEngines(boolean onMainThread) { | 439 void startYourEngines(boolean onMainThread) { |
| 439 synchronized (mLock) { | 440 synchronized (mLock) { |
| 440 ensureChromiumStartedLocked(onMainThread); | 441 ensureChromiumStartedLocked(onMainThread); |
| 441 } | 442 } |
| 442 } | 443 } |
| 443 | 444 |
| 444 // Only on UI thread. | 445 // Only on UI thread. |
| 445 AwBrowserContext getBrowserContextOnUiThread() { | 446 AwBrowserContext getBrowserContextOnUiThread() { |
| 446 // TODO(crbug.com/667337) | 447 assert mStarted; |
| 447 // assert mStarted; | |
| 448 | 448 |
| 449 if (BuildConfig.DCHECK_IS_ON && !ThreadUtils.runningOnUiThread()) { | 449 if (BuildConfig.DCHECK_IS_ON && !ThreadUtils.runningOnUiThread()) { |
| 450 throw new RuntimeException( | 450 throw new RuntimeException( |
| 451 "getBrowserContextOnUiThread called on " + Thread.currentThr
ead()); | 451 "getBrowserContextOnUiThread called on " + Thread.currentThr
ead()); |
| 452 } | 452 } |
| 453 | 453 |
| 454 if (mBrowserContext == null) { | 454 if (mBrowserContext == null) { |
| 455 mBrowserContext = | 455 mBrowserContext = |
| 456 new AwBrowserContext(mWebViewPrefs, ContextUtils.getApplicat
ionContext()); | 456 new AwBrowserContext(mWebViewPrefs, ContextUtils.getApplicat
ionContext()); |
| 457 } | 457 } |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 this, HttpAuthDatabase.newInstance(context, HTTP_AUTH_DA
TABASE_FILE)); | 651 this, HttpAuthDatabase.newInstance(context, HTTP_AUTH_DA
TABASE_FILE)); |
| 652 } | 652 } |
| 653 } | 653 } |
| 654 return mWebViewDatabase; | 654 return mWebViewDatabase; |
| 655 } | 655 } |
| 656 | 656 |
| 657 WebViewDelegate getWebViewDelegate() { | 657 WebViewDelegate getWebViewDelegate() { |
| 658 return mWebViewDelegate; | 658 return mWebViewDelegate; |
| 659 } | 659 } |
| 660 } | 660 } |
| OLD | NEW |