• 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           
  • 相关阅读:
    ES6变量的解构赋值
    ES6新增内容
    Rvalue references
    range-based for statement
    Space in Template Expression, nullptr, and auto
    Type Alias、noexcept、override、final
    Variadic Template
    =default =delete
    为什么不要特化函数模版?
    boost::noncopyable 的作用
  • 原文地址:https://www.cnblogs.com/fangxiang/p/2375812.html
Copyright © 2020-2023  润新知