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)
- void MainResourceLoader::continueAfterContentPolicy(
- PolicyAction contentPolicy, const ResourceResponse& r)
- {
- KURL url = request().url();
- const String& mimeType = r.mimeType();
- switch (contentPolicy) {
- case PolicyUse: {
- .....
- break;
- }
- case PolicyDownload:
- .....
- return;
- .......
- }
- handle->getInternal()->m_loader->downloadFile();
for apache stack
11. void WebCoreResourceLoader::downloadFile()
- env->CallVoidMethod(mJLoader, gResourceLoader.mDownloadFileMethodID);
- 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