summaryrefslogtreecommitdiff
path: root/core/java/android/webkit/FrameLoader.java
diff options
context:
space:
mode:
authorGrace Kloba <klobag@google.com>2010-02-03 10:24:06 -0800
committerGrace Kloba <klobag@google.com>2010-02-04 08:59:10 -0800
commitac75f56600691d318d40301204baaf840c9586f2 (patch)
treeef2e3648d49ed787c732f85bb226e68dd1f9c221 /core/java/android/webkit/FrameLoader.java
parentbca1c65fe491d070470ca248e804166a33e998a7 (diff)
Enable StreamLoader to be loaded in a separate thread.
Move ContentLoader and FileLoader to this new way as they involves IO. Will work on CacheLoader later. Change StreamLoader to contain a Handler instead of derive from a Handler so that the Handler can be created in the thread where load() is called. Rename StreamLoader's old "LoadListener mHandler" to mLoadListener. Remove unused import and unreachable exception. Fix http://b/issue?id=2158613 This improved page_cycler performance in moz/intl by 10-30% as we are not blocked by IO any more.
Diffstat (limited to 'core/java/android/webkit/FrameLoader.java')
-rw-r--r--core/java/android/webkit/FrameLoader.java23
1 files changed, 14 insertions, 9 deletions
diff --git a/core/java/android/webkit/FrameLoader.java b/core/java/android/webkit/FrameLoader.java
index 58eca38edae2..b13c4055bc8a 100644
--- a/core/java/android/webkit/FrameLoader.java
+++ b/core/java/android/webkit/FrameLoader.java
@@ -141,24 +141,29 @@ class FrameLoader {
return true;
}
if (URLUtil.isAssetUrl(url)) {
- FileLoader.requestUrl(url, loadListener, FileLoader.TYPE_ASSET,
- true);
+ // load asset in a separate thread as it involves IO
+ new FileLoader(url, loadListener, FileLoader.TYPE_ASSET, true)
+ .enqueue();
return true;
} else if (URLUtil.isResourceUrl(url)) {
- FileLoader.requestUrl(url, loadListener, FileLoader.TYPE_RES,
- true);
+ // load resource in a separate thread as it involves IO
+ new FileLoader(url, loadListener, FileLoader.TYPE_RES, true)
+ .enqueue();
return true;
} else if (URLUtil.isFileUrl(url)) {
- FileLoader.requestUrl(url, loadListener, FileLoader.TYPE_FILE,
- settings.getAllowFileAccess());
+ // load file in a separate thread as it involves IO
+ new FileLoader(url, loadListener, FileLoader.TYPE_FILE, settings
+ .getAllowFileAccess()).enqueue();
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..
- ContentLoader.requestUrl(loadListener.url(), loadListener);
+ // permission check and the url has to match.
+ // load content in a separate thread as it involves IO
+ new ContentLoader(loadListener.url(), loadListener).enqueue();
return true;
} else if (URLUtil.isDataUrl(url)) {
- DataLoader.requestUrl(url, loadListener);
+ // load data in the current thread to reduce the latency
+ new DataLoader(url, loadListener).load();
return true;
} else if (URLUtil.isAboutUrl(url)) {
loadListener.data(mAboutBlank.getBytes(), mAboutBlank.length());