• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            C++博客 聯(lián)系 聚合 管理  

            Blog Stats

            文章分類(17)

            收藏夾(2)

            文章檔案(18)

            相冊(cè)

            Blogs

            citywanderer


            1、下載回調(diào)接口
            Source/WebCore/loader/DocumentLoader.cpp  798
            798     if (!m_mainResourceLoader->load(m_request, m_substituteData))
            Source/WebCore/loader/MainResourceLoader.cpp  590
            590 bool MainResourceLoader::load(const ResourceRequest& r, const SubstituteData& substituteData)
            612         if (loadNow(request)) {
            557 bool MainResourceLoader::loadNow(ResourceRequest& r)
            586         m_handle = ResourceHandle::create(m_frame->loader()->networkingContext(), r, thisfalsetrue);
            Source/WebCore/platform/network/ResourceHandle.cpp  56 //與附件js下載同
             56 PassRefPtr<ResourceHandle> ResourceHandle::create(NetworkingContext* context, const ResourceRequest& request,
                ResourceHandleClient
            * client, bool defersLoading, bool shouldContentSniff)//client即為上面的MainResourceLoader類對(duì)象,如下
            //Source/WebCore/loader/MainResourceLoader.h
             48     class MainResourceLoader : public ResourceLoader {
            //Source/WebCore/loader/ResourceLoader.h
             51     class ResourceLoader : public RefCounted<ResourceLoader>protected ResourceHandleClient {
             66     RefPtr<ResourceHandle> newHandle(adoptRef(new ResourceHandle(request, client, defersLoading, shouldContentSniff)));
             
            71     if (newHandle->start(context))
            Source/WebCore/platform/network/qt/ResourceHandleQt.cpp  82 
               qt等接口必須實(shí)現(xiàn)‘Source/WebCore/platform/network/ResourceHandle.h  216’文件中的‘216     bool start(NetworkingContext*);’  
             82 bool ResourceHandle::start(NetworkingContext* context)//從這里看this為此類對(duì)象
            100     d->m_job = new QNetworkReplyHandler(this, QNetworkReplyHandler::AsynchronousLoad, d->m_defersLoading);
            Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp  373
            373 QNetworkReplyHandler::QNetworkReplyHandler(ResourceHandle* handle, LoadType loadType, bool deferred)
            401     m_queue.push(&QNetworkReplyHandler::start);
            161 void QNetworkReplyHandlerCallQueue::push(EnqueuedCall method)
            // 49     typedef void (QNetworkReplyHandler::*EnqueuedCall)();
            162 {
            163     m_enqueuedCalls.append(method);
            164     flush();//從頭開始取出enque隊(duì)列中的所有函數(shù)元素(這里第一個(gè)為為method,即start函數(shù)),并調(diào)用函數(shù)
            165 }
            //建立連接、發(fā)送html請(qǐng)求
            659 void QNetworkReplyHandler::start()
            660 {
            661     ResourceHandleInternal* d = m_resourceHandle->getInternal();
            665     QNetworkReply* reply = sendNetworkRequest(d->m_context->networkAccessManager(), d->m_firstRequest);//連接http服務(wù)器,由QNetworkAccessManager管理下載
            669     m_replyWrapper = new QNetworkReplyWrapper(&m_queue, reply, m_resourceHandle->shouldContentSniff() && d->m_context->mimeSniffingEnabled(), this); 
                         
            208 QNetworkReplyWrapper::QNetworkReplyWrapper(QNetworkReplyHandlerCallQueue* queue, QNetworkReply* reply, bool sniffMIMETypes,
                QObject
            * parent)
            209     : QObject(parent)
            210     , m_reply(reply)
            211     , m_queue(queue)
            212     , m_responseContainsData(false)
            213     , m_sniffMIMETypes(sniffMIMETypes)
            214 {
            215     Q_ASSERT(m_reply);
            216         
            217     // setFinished() must be the first that we connect, so isFinished() is updated when running other slots.
            //QT通過此種方式異步回調(diào)(yes, 信號(hào)、槽機(jī)制,http://www.ibm.com/developerworks/cn/linux/guitoolkit/qt/signal-slot/ ),當(dāng)下載完畢時(shí)QNetworkReply對(duì)象將emit finish()信號(hào)(./WebKitBuild/Debug/WebCore/moc_QNetworkReplyHandler.cpp),將調(diào)用本對(duì)象的setFinished()等函數(shù)
            218     connect(m_reply, SIGNAL(finished()), this, SLOT(setFinished()));
            219     connect(m_reply, SIGNAL(finished()), this, SLOT(receiveMetaData()));
            220     connect(m_reply, SIGNAL(readyRead()), this, SLOT(receiveMetaData()));
            221 }
               

            671     if (m_loadType == SynchronousLoad) {
            673         // If supported, a synchronous request will be finished at this point, no need to hook up the signals.
            672         m_replyWrapper->synchronousLoad();//支持同步下載??(不支持)
            674         return;
            675     }

            679 }
            下載完畢之后 (setFinished(), receiveMetaData())
            261 void QNetworkReplyWrapper::receiveMetaData()
            262 {
            263     // This slot is only used to receive the first signal from the QNetworkReply object.
            //斷開下載器的所有信號(hào)
            264     resetConnections();
            288     m_sniffer = new QtMIMETypeSniffer(m_reply, m_advertisedMIMEType, isSupportedImageType);
            289 
            290     if (m_sniffer->isFinished()) {
            291         receiveSniffedMIMEType();
            --->
            298 void QNetworkReplyWrapper::receiveSniffedMIMEType()
            299 {
            305     emitMetaDataChanged();
            306 }
                   --->
            318 void QNetworkReplyWrapper::emitMetaDataChanged()
            319 {
            320     QueueLocker lock(m_queue);
            //反饋給上層:MainResourceLoader;checkContentPolicy
            321     m_queue->push(&QNetworkReplyHandler::sendResponseIfNeeded);
            322 
            323     if (m_reply->bytesAvailable()) {
            324         m_responseContainsData = true;
            //將下載到的數(shù)據(jù)傳遞給上層處理:ResourceLoader::didReceiveData->MainResourceLoader::didReceiveData->ResourceLoader::didReceiveData
            325         m_queue->push(&QNetworkReplyHandler::forwardData);
            326     }

            327 
            328     if (isFinished()) {
            //判斷是否重定向,是的話再start();否則調(diào)用上層的didFinishLoading:ResourceLoader::didFinishLoading->MainResourceLoader::didFinishLoading->FrameLoader::finishedLoading
            329         m_queue->push(&QNetworkReplyHandler::finish);
            330         return;
            332 
            333     // If not finished, connect to the slots that will be used from this point on.
                    
            //附件js的下載將會(huì)執(zhí)行到這一步:QNetworkReplyWrapper::didReceiveFinished->QNetworkReplyHandler::finish->client->didFinishLoading(m_cachedResourceLoader->decrementRequestCount、m_cachedResourceLoader->loadDone)
            334     connect(m_reply, SIGNAL(readyRead()), this, SLOT(didReceiveReadyRead()));
            335     connect(m_reply, SIGNAL(finished()), this, SLOT(didReceiveFinished()));
            331     }

            336 }


            292         return;
            293     }

            296 }

            Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp :264


            修改原始代碼,使之以同步的方式下載網(wǎng)頁(不會(huì)用到qt復(fù)雜的信號(hào)處理機(jī)制)——無效,客戶端無反應(yīng)
            Source/WebCore/platform/network/qt/ResourceHandleQt.cpp  100
            100     d->m_job = new QNetworkReplyHandler(this, QNetworkReplyHandler::AsynchronousLoad, d->m_defersLoading);
            ——>
            100     d->m_job = new QNetworkReplyHandler(this, QNetworkReplyHandler::SynchronousLoad, d->m_defersLoading);

            修改代碼
            Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
            947         client->didReceiveData(m_resourceHandle, data.constData(), data.length(), -1);
            948         client->didFinishLoading(m_resourceHandle, 0);

            2、js附件資源回調(diào)接口
            Source/WebCore/dom/ScriptElement.cpp:255
            245 bool ScriptElement::requestScript(const String& sourceUrl)
            255     m_cachedScript = m_element->document()->cachedResourceLoader()->requestScript(sourceUrl, scriptCharset());
            Source/WebCore/loader/cache/CachedResourceLoader.cpp  178
            178 CachedScript* CachedResourceLoader::requestScript(const String& url, const String& charset)
            179 {
            180     return static_cast<CachedScript*>(requestResource(CachedResource::Script, url, charset));
            181 }
             
            300 CachedResource* CachedResourceLoader::requestResource(CachedResource::Type type, const String& resourceURL, const String&    charset, ResourceLoadPriority priority, bool forPreload)
            324     CachedResource* resource = memoryCache()->resourceForURL(url);
            328         resource = loadResource(type, url, charset, priority);
            377 CachedResource* CachedResourceLoader::loadResource(CachedResource::Type type, const KURL& url, const String& charset,    ResourceLoadPriority priority)
            383     CachedResource* resource = createResource(type, url, charset);
            385     bool inCache = memoryCache()->add(resource);
            393     resource->load(this);
            Source/WebCore/loader/cache/CachedResource.h  84
             84     virtual void load(CachedResourceLoader* cachedResourceLoader)  { load(cachedResourceLoader, false, DoSecurityCheck, true); }
            Source/WebCore/loader/cache/CachedResource.cpp  130
            130 void CachedResource::load(CachedResourceLoader* cachedResourceLoader, bool incremental, SecurityCheckPolicy securityCheck, bool  sendResourceLoadCallbacks)
            131 {
            132     m_sendResourceLoadCallbacks = sendResourceLoadCallbacks;
            133     cachedResourceLoader->load(this, incremental, securityCheck, sendResource
            537 void CachedResourceLoader::load(CachedResource* resource, bool incremental, SecurityCheckPolicy securityCheck, bool sendResourceLoadCallbacks)
            538 {   
            539     incrementRequestCount(resource);
            541     RefPtr<CachedResourceRequest> request = CachedResourceRequest::load(this, resource, incremental, securityCheck, sendResourceLoadCallbacks);
            LoadCallbacks);
            //this指向script類型的CachedResource
            Source/WebCore/loader/cache/CachedResourceLoader.cpp  537
            537 void CachedResourceLoader::load(CachedResource* resource, bool incremental, SecurityCheckPolicy securityCheck, bool sendResourceLoadCallbacks)
            538 {   
            539     incrementRequestCount(resource);
            541     RefPtr<CachedResourceRequest> request = CachedResourceRequest::load(this, resource, incremental, securityCheck, sendResourceLoadCallbacks);
            Source/WebCore/loader/cache/CachedResourceRequest.cpp  89
            89 PassRefPtr<CachedResourceRequest> CachedResourceRequest::load(CachedResourceLoader* cachedResourceLoader, CachedResource*  resource, bool incremental, SecurityCheckPolicy securityCheck, bool sendResourceLoadCallbacks)
             
            90 {
             
            91     RefPtr<CachedResourceRequest> request = adoptRef(new CachedResourceRequest(cachedResourceLoader, resource, incremental));
             
            92 
             
            93     ResourceRequest resourceRequest(resource->url());
            124     RefPtr<SubresourceLoader> loader = resourceLoadScheduler()->scheduleSubresourceLoad(cachedResourceLoader->document()->frame(),
            125         request.get(), resourceRequest, priority, securityCheck, sendResourceLoadCallbacks);
            126     if (!loader || loader->reachedTerminalState()) {
            127         // FIXME: What if resources in other frames were waiting for this revalidation?
            128         LOG(ResourceLoading, "Cannot start loading '%s'", resource->url().latin1().data());//出錯(cuò)
            Source/WebCore/loader/ResourceLoadScheduler.cpp  86
            86 PassRefPtr<SubresourceLoader> ResourceLoadScheduler::scheduleSubresourceLoad(Frame* frame, SubresourceLoaderClient* client, const ResourceRequest& request, ResourceLoadPriority priority, SecurityCheckPolicy securityCheck, 
             
            87                                                                              bool sendResourceLoadCallbacks, bool shouldContentSniff, const String& optionalOutgoingReferrer)
             
            88 {
             
            89     RefPtr<SubresourceLoader> loader = SubresourceLoader::create(frame, client, request, securityCheck, sendResourceLoadCallbacks, shouldContentSniff, optionalOutgoingReferrer);
             
            90     if (loader)
             
            91         scheduleLoad(loader.get(), priority);
            108 void ResourceLoadScheduler::scheduleLoad(ResourceLoader* resourceLoader, ResourceLoadPriority priority)
            117     HostInformation* host = hostForURL(resourceLoader->url(), CreateIfNotFound);
            123         servePendingRequests(host, priority);
            181 void ResourceLoadScheduler::servePendingRequests(HostInformation* host, ResourceLoadPriority minimumPriority)
            186         HostInformation::RequestQueue& requestsPending = host->requestsPending(ResourceLoadPriority(priority));
            187 
            188         while (!requestsPending.isEmpty()) {
            189             RefPtr<ResourceLoader> resourceLoader = requestsPending.first();
            201             resourceLoader->start();
            Source/WebCore/loader/ResourceLoader.cpp  142
            142 void ResourceLoader::start()
            164         m_handle = ResourceHandle::create(m_frame->loader()->networkingContext(), m_request, this, m_defersLoading, m_shouldContentSniff);
            Source/WebCore/platform/network/ResourceHandle.cpp  56 //與上同 

            3、圖片資源回調(diào)接口
            同2

            4、重定向
            location重定向
            posted on 2013-08-22 14:25 citywanderer 閱讀(1160) 評(píng)論(0)  編輯 收藏 引用 所屬分類: webkit
            中文字幕无码久久人妻| 99久久婷婷国产综合亚洲| 精品久久久久久无码不卡| 久久久久se色偷偷亚洲精品av| 久久99久久99精品免视看动漫| 久久久久亚洲AV无码专区体验| 久久香蕉一级毛片| 四虎久久影院| 久久Av无码精品人妻系列 | 精品永久久福利一区二区| 国产精品一区二区久久国产| 伊人久久综在合线亚洲2019| 久久婷婷是五月综合色狠狠| 91久久精一区二区三区大全| 精品人妻伦九区久久AAA片69 | 国内精品久久久久久野外| 久久精品国产亚洲AV不卡| 欧美日韩精品久久久免费观看| 国内精品久久久久影院一蜜桃| 狠狠色综合网站久久久久久久| 久久亚洲精品无码aⅴ大香| 久久久国产精品福利免费| 伊人情人综合成人久久网小说| 国产精品久久国产精品99盘| 亚洲伊人久久成综合人影院| 久久精品国产网红主播| 亚洲欧美成人久久综合中文网| 精品久久人妻av中文字幕| 性高湖久久久久久久久AAAAA| 国产精品女同久久久久电影院 | 久久AAAA片一区二区| 色偷偷88888欧美精品久久久| 久久精品中文字幕有码| 国产成人精品免费久久久久| 亚洲天堂久久久| 久久综合伊人77777| 99久久国产综合精品麻豆| 伊人久久精品无码二区麻豆| 色综合久久天天综线观看| Xx性欧美肥妇精品久久久久久 | 久久99国产精品久久久|