Load
BrowserFrame.startLoadingResource()
Cache:HTTP头的Expires与Cache-controlhttp://www.cnblogs.com/wrmfw/archive/2011/09/09/2172003.html
BrowserFrame.startLoadingResource()
-------> if (mListener.isSynchronous()) {
---->FrameLoader.handleCache() || mNetwork.requestURL(mMethod, mHeaders, mPostData, mListener);
----->FrameLoader.startCacheLoad(result);
------> CacheLoader.load();
---->mLoadListener.headers(headers)
----> LoadListener.headers(Headers headers){sendMessageInternal(obtainMessage(MSG_CONTENT_HEADERS, headers));}
---->LoadListener.handleMessage ()[MSG_CONTENT_HEADERS]
---> handleHeaders((Headers) msg.obj);
--->WebViewWorker.getHandler().obtainMessage(WebViewWorker.MSG_CREATE_CACHE, data).sendToTarget();
---> WebViewWorker.handleMessage(Message msg)[MSG_CREATE_CACHE]
---> CacheCreateData data = (CacheCreateData) msg.obj;
--->CacheResult ret = parseHeaders(statusCode, headers, mimeType);
---->setupFiles(databaseKey, ret);
if (handleCache()) {
// push the request data down to the LoadListener
// as response from the cache could be a redirect
// and we may need to initiate a network request if the cache
// can't satisfy redirect URL
mListener.setRequestData(mMethod, mHeaders, mPostData);
return true;
}
private boolean handleCache() {
switch (mCacheMode) {
case WebSettings.LOAD_NO_CACHE:
break;
case WebSettings.LOAD_CACHE_ONLY:
case WebSettings.LOAD_CACHE_ELSE_NETWORK:
default:
case WebSettings.LOAD_NORMAL:}