Load

 File:

BrowserFrame.startLoadingResource()

------>FrameLoader.executeLoad()
------->FrameLoader.handleLocalFile(String url, LoadListener loadListener, WebSettings settings) 
--->new DataLoader(url, loadListener).load()
---->StreamLoader.load()
--->StreamLoader.sendHeaders()
 ---->mLoadListener.headers(headers)
---->sendMessageInternal(obtainMessage(MSG_CONTENT_HEADERS, headers))
---->LoadListener.handleMessage(Message msg)---->LoadListener.handleHeaders(Headers headers)

 

Cache:HTTP头的Expires与Cache-controlhttp://www.cnblogs.com/wrmfw/archive/2011/09/09/2172003.html

BrowserFrame.startLoadingResource()

------>FrameLoader.executeLoad()

-------> if (mListener.isSynchronous()) {

                return handleHTTPLoad();
            }
            WebViewWorker.getHandler().obtainMessage(
                    WebViewWorker.MSG_ADD_HTTPLOADER, this).sendToTarget();

---->FrameLoader.handleCache()  || mNetwork.requestURL(mMethod, mHeaders, mPostData, mListener);

----->FrameLoader.startCacheLoad(result); 

------> CacheLoader.load();   

--->buildHeaders(headers);    StreamLoader.sendHeaders() &&sendData()-->mDataStream.read(mData);

 ---->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;

       CacheManager.CacheResult cache = CacheManager.createCacheFile(data.mUrl, data.mStatusCode, data.mHeaders,
                                                                                                        data.mMimeType, data.mPostId, false);

 --->CacheResult ret = parseHeaders(statusCode, headers, mimeType);

 ---->setupFiles(databaseKey, ret); 

 

handleHTTPLoad 

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:}

---->FrameLoader.handleCache() 

---->CacheManager.getCacheFile           

posted on 2012-03-01 16:48  者行孙  阅读(599)  评论(0编辑  收藏  举报

导航