上一次說到在類
ResourceDispatcher
會收到接收
HTTP
數據消息,并進一步處理數據。那么
ResourceDispatcher
類又把接收到的數據發往何處呢?這是需要我們去搞懂它的。通過進一步的跟蹤,會發現在
ResourceDispatcher::OnReceivedData
函數調用
WebCore::ResourceHandleInternal
類來處理,也就是把接收到的數據拋給
WebCore
來處理了。如下面的代碼:
#001
?
void ResourceDispatcher::OnReceivedData(int request_id,
#002
?????????????????????????????????????????
SharedMemoryHandle shm_handle,
#003
?????????????????????????????????????????
int data_len) {
#004
???
// Acknowlegde the reception of this data.
#005
???
IPC::Message::Sender* sender = message_sender();
......
#023
???
if (data_len > 0 && shared_mem.Map(data_len)) {
#024
?????
RESOURCE_LOG("Dispatching " << data_len << " bytes for " <<
#025
??????????????????
request_info.peer->GetURLForDebugging());
#026
?????
const char* data = static_cast<char*>(shared_mem.memory());
#027
?????
request_info.peer->OnReceivedData(data, data_len);
#028
???
}
#029
?
}
上面第
27
行代碼就是調用
webcore
里類
ResourceHandleInternal::OnReceivedData
函數,這樣就把數據保存到
webcore
里面,也就是
webkit
里面了。經過如下面的調用過程:
1)
?
WebCore::ResourceLoader::didReceiveData
2)
?
WebCore::SubresourceLoader::didReceiveData
3)
?
WebCore::Loader::didReceiveData
4)
?
WebCore::CachedImage::data
這里就是把圖像的數據緩存起來,以便后面調用渲染引擎來顯示。這一次就分析到這里,總算把數據怎么樣放到
webkit
里搞清楚了,下一次再來看看
webkit
是怎么樣把數據顯示出來的。
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061
微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元

