博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

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

posted on 2012-09-21 10:45  Likwo  阅读(2453)  评论(0编辑  收藏  举报