loader()->load函數里面,那么在這個函數里面到底是怎么樣處理的呢,只有去分析它的代碼,我們才能找到它的答案,現在就來開始看吧,如下:#001voidFrameLoader::load(constResourceRequest&request)#002{#003load(request,SubstituteData());#004}在這個函數也只是一個中間者,它又調用函數loa" />

欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

谷歌瀏覽器的源碼分析(24)

系統 2377 0
繼續上一次的分析,這里開始把連接址和其它相關的信息傳送 frame_->loader()->load 函數里面,那么在這個函數里面到底是怎么樣處理的呢,只有去分析它的代碼,我們才能找到它的答案,現在就來開始看吧,如下:

#001 ? void FrameLoader::load(const ResourceRequest& request)

#002 ? {

#003 ????? load(request, SubstituteData());

#004 ? }

在這個函數也只是一個中間者,它又調用函數 load 函數的重載函數來實現了。

#001 ? void FrameLoader::load(const ResourceRequest& request, const SubstituteData& substituteData)

#002 ? {

#003 ????? if (m_inStopAllLoaders)

#004 ?? ??????? return;

#005 ?????????

#006 ????? // FIXME: is this the right place to reset loadType? Perhaps this should be done after loading is finished or aborted.

# 007 ????? m _loadType = FrameLoadTypeStandard;

#008 ????? load(m_client->createDocumentLoader(request, substituteData).get());

#009 ? }

#010 ?

在這個函數里,第一個參數 request 是連接相關的信息,第二個參數 substituteData 是一些狀態數據。然后在第 7 行里設置加載的類型,第 8 行里調用 WebFrameLoaderClient::createDocumentLoader 函數來創建 WebDocumentLoaderImpl 對象,然后再通過 get 函數返回來,這樣就知道 load 函數又調用那個重載函數了,原來它是調用這個函數,如下:

#001 ? void FrameLoader::load(DocumentLoader* newDocumentLoader)

#002 ? {

#003 ????? ResourceRequest& r = newDocumentLoader->request();

#004 ????? addExtraFieldsToRequest(r, true, false);

#005 ????? FrameLoadType type;

#006 ?

#007 ????? if (shouldTreatURLAsSameAsCurrent(newDocumentLoader->originalRequest().url())) {

#008 ????????? r.setCachePolicy(ReloadIgnoringCacheData);

#009 ????????? type = FrameLoadTypeSame;

#010 ????? } else

#011 ????????? type = FrameLoadTypeStandard;

#012 ?

#013 ????? // Do not use original encoding override since it is not loaded by user

#014 ????? // selecting encoding.

#015 ????? if (m_documentLoader)

#016 ????????? newDocumentLoader->setOverrideEncoding(String());

#017 ?????

#018 ????? // When we loading alternate content for an unreachable URL that we're

#019 ????? // visiting in the b/f list, we treat it as a reload so the b/f list

#020 ????? // is appropriately maintained.

#021 ????? if (shouldReloadToHandleUnreachableURL(newDocumentLoader)) {

#022 ????????? ASSERT(type == FrameLoadTypeStandard);

#023 ???????? ? type = FrameLoadTypeReload;

#024 ????? }

#025 ?

#026 ????? load(newDocumentLoader, type, 0);

#027 ? }

上面只對 newDocumentLoader 做一些準備工作,并沒有真正地去加載任何東西,接著又調用函數:

void FrameLoader::load(DocumentLoader* loader, FrameLoadType type, PassRefPtr<FormState> formState)

在上面這個函數進行安全策略的處理,然后再經過 N 個函數處理之后,就調用下面的函數:

void FrameLoader::continueLoadAfterWillSubmitForm(PolicyAction)

在這個函數開始使用類 DocumentLoader 來設置下載請求,主要通過函數

bool DocumentLoader::startLoadingMainResource(unsigned long identifier)

來實現的,緊跟后面調用加載函數:

bool MainResourceLoader::load(const ResourceRequest& r, const SubstituteData& ? substituteData)

在這個函數里又開始分為兩種情況處理,一種是延進加載數據,一種是立即加載數據,下面主要介紹立即加載數據函數:

bool MainResourceLoader::loadNow(ResourceRequest& r)

在類 MainResourceLoader 是主要資源下載的管理類, loadNow 函數是把資源請求 ResourceRequest 變成一個 IPC 消息又發送給資源下載進程去處理。它的簡略代碼如下:

#001 ? bool MainResourceLoader::loadNow(ResourceRequest& r)

#002 ? {

......

#011 ????? willSendRequest(r, ResourceResponse());

#012 ?

......

?

#015 ????? if (!frameLoader())

#016 ? ???????? return false;

#017 ?????

......

#023 ?

#024 ????? if (m_substituteData.isValid())

#025 ????????? handleDataLoadSoon(r);

#026 ????? else if (shouldLoadEmpty || frameLoader()->representationExistsForURLScheme(url.protocol()))

#027 ????????? handleEmptyLoad(url, !shouldLoadEmpty);

#028 ????? else

# 029 ????????? m _handle = ResourceHandle::create(r, this, m_frame.get(), false, true, true);

#030 ?

#031 ????? return false;

#032 ? }

在這個函數的第 29 行里,就會通過 ResourceHandle::create 函數創建一個資源消息,并把這個消息發送出去,到底它是怎么樣實現的呢?下一次再來分析它。

谷歌瀏覽器的源碼分析(24)


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!?。?/p>

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 性夜影院爽黄e爽在线观看 苏晓晖个人简介军衔 | 九九国产在线视频 | 男女激情动态视频 | 色偷偷888欧美精品久久久 | 久草网在线视频 | 欧美日韩不卡在线 | 亚洲欧美日韩精品高清 | 操舔 | 日产精品久久久久久久 | av毛片免费看 | 国产睡熟迷奷系列网站 | 电影长安道无删减免费看 | 亚洲欧美精品中字久久99 | 91精品国产日韩91久久久久久360 | 国产91精品黄网在线观看 | 精品国产一区二区三区久久影院 | 色偷偷精品视频在线播放放 | 久久综合久色欧美综合狠狠 | 久热官网| 亚洲乱码在线 | 性夜影院爽黄a爽在线看香蕉 | 亚洲天堂成人网 | 国产专区在线视频 | 国产欧美一区二区久久 | 特级毛片网站 | 亚洲日韩视频 | 国产理论自拍 | 成人国产激情福利久久精品 | 99视频有精品视频高清 | 国产高清一国产免费软件 | 天天色天天综合 | 青草视频网| 亚洲偷图色综合色就色 | 成片在线看一区二区草莓 | 欧美精品成人免费视频 | 亚洲无线| 在线不卡一区 | 成人久久18免费软件 | 欧美色无极 | 一区二区三区四区在线播放 | 99草在线观看 |