参考地址:http://blog.csdn.net/dlmu2001/article/details/6168545
FrameLoader类负责一个Frame的加载,在Frame的流程中起到非常重要的作用,同很多组件都有交互,本文将分析FrameLoader类的代码
1. 概述
顾名思义,FrameLoader是一个Frame的loader,它的作用就是为客户端提供一个下载一个Frame的一系列的接口。这里的客户指的是类的客户,比如Frame类,间接客户是上层应用,比如 qwebframe
从它的定义看,最容易想到的是一个load接口,用来将一个frame load下来。任何一个页面都需要一个mainframe,因此一个页面的下载一般就是从load 一个 mainframe开始
在 load frame的过程中,通过FrameLoaderClient接口将load过程的不同阶段告知客户
FrameLoader通过 setDocumentLoader相当于把load的工作委托给了 DocumentLoader类
FrameLoader同 DocumentLoader是has-a的关系。一般在load的时候创建 DocumentLoader。Frame调用DocumentLoader的startLoadingMainResource开始 load frame
类数据代码:
1 class FrameLoader { 2 WTF_MAKE_NONCOPYABLE(FrameLoader); 3 private: 4 Frame* m_frame; 5 FrameLoaderClient* m_client; 6 7 mutable PolicyChecker m_policyChecker; 8 mutable HistoryController m_history; 9 mutable ResourceLoadNotifier m_notifer; 10 mutable SubframeLoader m_subframeLoader; 11 mutable FrameLoaderStateMachine m_stateMachine; 12 13 FrameState m_state; 14 FrameLoadType m_loadType; 15 16 // Document loaders for the three phases of frame loading. Note that while 17 // a new request is being loaded, the old document loader may still be referenced. 18 // E.g. while a new request is in the "policy" state, the old document loader may 19 // be consulted in particular as it makes sense to imply certain settings on the new loader. 20 RefPtr<DocumentLoader> m_documentLoader; 21 RefPtr<DocumentLoader> m_provisionalDocumentLoader; 22 RefPtr<DocumentLoader> m_policyDocumentLoader; 23 24 bool m_delegateIsHandlingProvisionalLoadError; 25 26 bool m_quickRedirectComing; 27 bool m_sentRedirectNotification; 28 bool m_inStopAllLoaders; 29 30 String m_outgoingReferrer; 31 32 bool m_isExecutingJavaScriptFormAction; 33 34 bool m_didCallImplicitClose; 35 bool m_wasUnloadEventEmitted; 36 bool m_pageDismissalEventBeingDispatched; 37 bool m_isComplete; 38 bool m_isLoadingMainResource; 39 40 RefPtr<SerializedScriptValue> m_pendingStateObject; 41 42 KURL m_workingURL; 43 44 OwnPtr<IconLoader> m_iconLoader; 45 bool m_mayLoadIconLater; 46 47 bool m_needsClear; 48 49 KURL m_submittedFormURL; 50 51 Timer<FrameLoader> m_checkTimer; 52 bool m_shouldCallCheckCompleted; 53 bool m_shouldCallCheckLoadComplete; 54 55 Frame* m_opener; 56 HashSet<Frame*> m_openedFrames; 57 58 bool m_didPerformFirstNavigation; 59 bool m_loadingFromCachedPage; 60 bool m_suppressOpenerInNewFrame; 61 62 SandboxFlags m_sandboxFlags; 63 SandboxFlags m_forcedSandboxFlags; 64 65 RefPtr<FrameNetworkingContext> m_networkingContext; 66 67 KURL m_previousUrl; 68 }
2. 类关系
时间: 2024-11-06 15:44:05