webkit to Chromium/load/rtsp/dns

本文详细解析了Chromium与WebKit之间的交互过程,包括资源加载流程、从点击到页面加载的具体步骤、不同类型的网络请求处理机制及DNS解析过程。通过这些内容,读者可以深入了解浏览器内核的工作原理。


a.webkit to chromium to webkit

ResourceLoaderAndroid to chromium// for file
1.ResourceLoaderAndroid::start
2.WebUrlLoader::start (convert "ResourceRequest" to "WebRequest")
3.WebUrlLoaderClient::start
4.WebRequest::start
5.URLRequest::start()//chromium
6.URLRequest::StartJob(URLRequestJobManager::CreateJob)//create different job
//URLRequest::StartInternal() for 4.0
7.job.start()//depending on defferent job.
8.URLRequestFileJob::Start()//PostTask(FROM_HERE, NewRunnableMethod(this, &URLRequestFileJob::DidResolve)
9.URLRequestFileJob::DidResolve
10.NotifyHeadersComplete()
11.URLRequest::ResponseStarted(URLRequest ){delegate_->OnResponseStarted(this);}
12.WebRequest::OnResponseStarted(URLRequest);//create WebResponse.
//pass URLRequest to webkit, so get the type

13.WebUrlLoaderClient::didReceiveResponse.


b.chromium to socket

chromium to socket,take URLRequestHttpJob for example
1.URLRequestHttpJob::Start()
2.URLRequestHttpJob::AddCookieHeaderAndStart()
3.URLRequestHttpJob::OnCanGetCookiesCompleted()
4.StartTransaction()
5.HttpNetworkTransaction::Start()
6.HttpNetworkTransaction::DoLoop()//create
7.HttpNetworkTransaction::DoCreateStream()
8.HttpStreamFactoryImpl::RequestStream//http_stream_factory_impl.cc
need to be finished


c chromium webkit's interface

if we provide a service, we need to do at least two things.
1). we provide a class that can provide service, the client use the class's object to do the work.
2). we need to provide a abstract interface for callback.
and we call the callback interface at the proper time.
3). And as "b" says, the client need a class to be the subclass of the callback interface. and set the object as the server's real client.
so the bilateral channel is setup.

interface between chromium and webkit
1.URLRequest (url_request.h)
chromium's service class, it's was exposed to webkit, and webkit will call it for download.
2.URLRequest::Delegate
chromimu's callback interface, it's method will be called by chromium at proper time.
3.WebRequest
Webkit's client class. It's also the server's callback class.
1). it's subclass of  URLRequest::Delegate, it will set itself to the URLRequest.
2). it will use URLRequest's object to use the service.
3). it's method (inherited from URLRequest::Delegate) will be called by URLRequest at the proper time.



d.  click to load

TitleBarXlarge->onClick
TitleBarBase->onAction
Controller->handleNewIntent
IntentHandler->onNewIntent
Controller->openTabAndShow


e rtsp protocal to other application

PolicyChecker::continueAfterNavigationPolicy
FrameLoaderClientAndroid::canHandleRequest
WebFrame::canHandleRequest
BrowserFrame::handleUrl
CallbackProxy::shouldOverrideUrlLoading
CallbackProxy::handlemessage:OVERRIDE_URL
CallbackProxy::uiOverrideUrlLoading
WebViewClient::shouldOverrideUrlLoading
Controller::shouldOverrideUrlLoading
UrlHandler::shouldOverrideUrlLoading


f. chromium's job

  { "http", URLRequestHttpJob::Factory },
  { "https", URLRequestHttpJob::Factory },
  { "file", URLRequestFileJob::Factory },
#ifndef ANDROID
  { "ftp", URLRequestFtpJob::Factory },
  { "about", URLRequestAboutJob::Factory },
  { "data", URLRequestDataJob::Factory },


g. apache dns

Socket()//httpconnection
tryAllAddresses() //InetAddress.getAllByName
startupSocket
impl.connect(dstAddress, dstPort);
?impl
PlainSocketImpl

PlainSocketImpl.connect
socksConnect
socksRequestConnection


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值