zoukankan      html  css  js  c++  java
  • Webkit Download files webkit 文件下载流程分析

    1. WebView.loadUrl

    ......

    2.bool MainResourceLoader::loadNow(ResourceRequest& r)

    3.m_handle = ResourceHandle::create(m_frame->loader()->networkingContext(), r, this, false, true);

    ....

    network

    .....

    4.void MainResourceLoader::didReceiveResponse(const ResourceResponse& r).(this will be called when the first package comes)

    5.MainResourceLoader.cpp    frameLoader()->policyChecker()->checkContentPolicy(m_response.mimeType(), callContinueAfterContentPolicy, this);

    //first checkContentpolicy and then call the func pointer that passed in.

    6.void MainResourceLoader::callContinueAfterContentPolicy(void* argument, PolicyAction policy)

    //policy already nailed down.

    7.void MainResourceLoader::continueAfterContentPolicy(PolicyAction policy)

    8.void MainResourceLoader::continueAfterContentPolicy(PolicyAction contentPolicy, const ResourceResponse& r)

    1. void MainResourceLoader::continueAfterContentPolicy(  
    2.     PolicyAction contentPolicy, const ResourceResponse& r)  
    3. {  
    4.     KURL url = request().url();  
    5.     const String& mimeType = r.mimeType();  
    6.       
    7.     switch (contentPolicy) {  
    8.     case PolicyUse: {  
    9.         .....  
    10.         break;  
    11.     }  
    12.   
    13.     case PolicyDownload:  
    14.        .....  
    15.         return;  
    16.     .......  
    17. }  
    9.void FrameLoaderClientAndroid::download(ResourceHandle* handle, const ResourceRequest&)

    1. handle->getInternal()->m_loader->downloadFile();  
    10.  ResourceLoaderAndroid->downloadFile()


    for apache stack

    11. void WebCoreResourceLoader::downloadFile()

    1. env->CallVoidMethod(mJLoader, gResourceLoader.mDownloadFileMethodID);   
    12.LoadListener.downloadFile().

    1. mBrowserFrame.getCallbackProxy().onDownloadStart()  
    ......


    for chromium stack

    11.WebURLLoader->downloadFile();

    12.WebUrlLoaderClient->downlaodFile()

    13.WebCoreFrameBridge.cpp->downloadStart(m_response->getUrl(), m_request->getUserAgent(), contentDisposition, m_response->getMimeType(), m_response->getExpectedSize());

    14. BrowserFrame.downloadStart()

    to downloadManager




    main resource when to check media type?

    MainResourceLoader receive data to checkType
    1.MainResourceLoader::didReceiveResponse
    is a subBranch of the parse process.
    in the main Branch 
    FrameLoaderClient::committedLoad will call DocumentLoader::commitData
    but it will also call MainResourceLoader::didReceiveResponse,by the way.
    2.PolicyChecker::checkContentPolicy
    FrameLoaderClientAndroid::
    call TreatAsAttachment and canShowMIMEType to determine
    call "DOMImplementation::isTextMIMEType"

    come from http://blog.csdn.net/elfylin/article/details/7093832

  • 相关阅读:
    牛客-Python-字符流中第一个不重复的字符
    牛客网-python-表示数值的字符串
    牛客网-(标星)正则表达式的匹配
    牛客网-构建乘积数组
    牛客网-和为S的两个数字
    new code-和为S的连续正数序列
    newcode-平衡二叉树
    Reinforcement Learning学习笔记|Deep Q-learning算法
    Reinforcement Learning学习笔记|Q-learning算法
    C++|重拾|笔记20190307
  • 原文地址:https://www.cnblogs.com/likwo/p/2696527.html
Copyright © 2011-2022 走看看