summaryrefslogtreecommitdiffstats
path: root/core/java/android/webkit/FrameLoader.java
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-03-05 18:32:52 +0000
committerSteve Block <steveblock@google.com>2010-03-05 18:39:30 +0000
commit76619af64ca9b49c4f87d5ee6d444971d5b481c4 (patch)
treee1e1195c38c5dd542db1dfeb49078e0facc8880d /core/java/android/webkit/FrameLoader.java
parent780a1cb7adee2381fbd57aa163a045149d1283ac (diff)
downloadframeworks_base-76619af64ca9b49c4f87d5ee6d444971d5b481c4.zip
frameworks_base-76619af64ca9b49c4f87d5ee6d444971d5b481c4.tar.gz
frameworks_base-76619af64ca9b49c4f87d5ee6d444971d5b481c4.tar.bz2
For synchronous loads, load file URLs in the WebCore thread, rather than in the new WebViewWorker thread
This fixes the layout test failure in fast/xmlhttprequest/xmlhttprequest-html-response-encoding.html Bug: 2218794 Change-Id: If86c5dbb72b21400bd0fb6981de1a6fdf9b40fe7
Diffstat (limited to 'core/java/android/webkit/FrameLoader.java')
-rw-r--r--core/java/android/webkit/FrameLoader.java66
1 files changed, 42 insertions, 24 deletions
diff --git a/core/java/android/webkit/FrameLoader.java b/core/java/android/webkit/FrameLoader.java
index dacb33f..303e417 100644
--- a/core/java/android/webkit/FrameLoader.java
+++ b/core/java/android/webkit/FrameLoader.java
@@ -111,11 +111,10 @@ class FrameLoader {
}
mNetwork = Network.getInstance(mListener.getContext());
if (mListener.isSynchronous()) {
- handleHTTPLoad();
- } else {
- WebViewWorker.getHandler().obtainMessage(
- WebViewWorker.MSG_ADD_HTTPLOADER, this).sendToTarget();
+ return handleHTTPLoad();
}
+ WebViewWorker.getHandler().obtainMessage(
+ WebViewWorker.MSG_ADD_HTTPLOADER, this).sendToTarget();
return true;
} else if (handleLocalFile(url, mListener, mSettings)) {
return true;
@@ -147,34 +146,53 @@ class FrameLoader {
return true;
}
if (URLUtil.isAssetUrl(url)) {
- // load asset in a separate thread as it involves IO
- WebViewWorker.getHandler().obtainMessage(
- WebViewWorker.MSG_ADD_STREAMLOADER,
- new FileLoader(url, loadListener, FileLoader.TYPE_ASSET,
- true)).sendToTarget();
+ if (loadListener.isSynchronous()) {
+ new FileLoader(url, loadListener, FileLoader.TYPE_ASSET,
+ true).load();
+ } else {
+ // load asset in a separate thread as it involves IO
+ WebViewWorker.getHandler().obtainMessage(
+ WebViewWorker.MSG_ADD_STREAMLOADER,
+ new FileLoader(url, loadListener, FileLoader.TYPE_ASSET,
+ true)).sendToTarget();
+ }
return true;
} else if (URLUtil.isResourceUrl(url)) {
- // load resource in a separate thread as it involves IO
- WebViewWorker.getHandler().obtainMessage(
- WebViewWorker.MSG_ADD_STREAMLOADER,
- new FileLoader(url, loadListener, FileLoader.TYPE_RES,
- true)).sendToTarget();
+ if (loadListener.isSynchronous()) {
+ new FileLoader(url, loadListener, FileLoader.TYPE_RES,
+ true).load();
+ } else {
+ // load resource in a separate thread as it involves IO
+ WebViewWorker.getHandler().obtainMessage(
+ WebViewWorker.MSG_ADD_STREAMLOADER,
+ new FileLoader(url, loadListener, FileLoader.TYPE_RES,
+ true)).sendToTarget();
+ }
return true;
} else if (URLUtil.isFileUrl(url)) {
- // load file in a separate thread as it involves IO
- WebViewWorker.getHandler().obtainMessage(
- WebViewWorker.MSG_ADD_STREAMLOADER,
- new FileLoader(url, loadListener, FileLoader.TYPE_FILE,
- settings.getAllowFileAccess())).sendToTarget();
+ if (loadListener.isSynchronous()) {
+ new FileLoader(url, loadListener, FileLoader.TYPE_FILE,
+ settings.getAllowFileAccess()).load();
+ } else {
+ // load file in a separate thread as it involves IO
+ WebViewWorker.getHandler().obtainMessage(
+ WebViewWorker.MSG_ADD_STREAMLOADER,
+ new FileLoader(url, loadListener, FileLoader.TYPE_FILE,
+ settings.getAllowFileAccess())).sendToTarget();
+ }
return true;
} else if (URLUtil.isContentUrl(url)) {
// Send the raw url to the ContentLoader because it will do a
// permission check and the url has to match.
- // load content in a separate thread as it involves IO
- WebViewWorker.getHandler().obtainMessage(
- WebViewWorker.MSG_ADD_STREAMLOADER,
- new ContentLoader(loadListener.url(), loadListener))
- .sendToTarget();
+ if (loadListener.isSynchronous()) {
+ new ContentLoader(loadListener.url(), loadListener).load();
+ } else {
+ // load content in a separate thread as it involves IO
+ WebViewWorker.getHandler().obtainMessage(
+ WebViewWorker.MSG_ADD_STREAMLOADER,
+ new ContentLoader(loadListener.url(), loadListener))
+ .sendToTarget();
+ }
return true;
} else if (URLUtil.isDataUrl(url)) {
// load data in the current thread to reduce the latency