Previously wrote a few loading process instructions, is from the bottom up, a little trees trees feeling. After a recent period of study, there is a way to generalize the abstract.
WebKit loading process and page composition is directly related, the page is webkit to load the object. So WebKit is responsible for loading the classes that correspond to the classes that are responsible for page management. Apple's description of WebView clearly shows the MVC structure on page view:
A page also has its hierarchy from the element, and corresponds to the load class, as follows:
Speaking from the page element WebView represents a page rendering, corresponding to a Web pages. A page contains one or more frames, one of which is called the main frame, and the other frame (the IFrame or object element introduces HTML) is called a sub Frame. Each frame, from JavaScript, has a window and document object.
The frame,document and child resources in the page correspond to the loaded Frameloader, Documentloader, and Subresourceloader. Where frame can navigate (Navigation) operations, that is, load, reload, forward, and rewind operations, while document represents a specific HTML document, no navigation operation.
Several of the loaders seen here are logical representations of loading, and the actual loading behavior is given to Resourceloader (s), Mainresourceloader and Subresourceloader, which includes the resource-loaded queue management operations ( Resourceloadscheduler).
Resourcehandle is an important port interface in WebKit, which is adapted to the network layer of each platform and represents a specific Network load task.
relationship of major classes
Frameloader Loading Timing
From the above you can know that Frameloader represents the load behavior of frame, Documentloader represents the loading behavior of document. To differentiate the loaded process, Frameloader distinguishes the load state and lets documentloader convert between different states. In addition, Frameloader also uses a state machine to manage the state of the frame loading display (frameloaderstatemachine).
In addition to this, Frameloader also maintains the history item (Historycontroller) to correspond to processing navigation operations, with detailed items defined in FrameLoaderTypes.h.
Document Loader
Relative to Frameloader, Documentloader is relatively simple, and its task is to invoke a mainresourceloader to load the main document. Because the transformation of the state was done in Frameloader. The loading of sub-resources is based on documentloader management.
Loading of child resources
Just as the page element belongs to the document, the loaded classes responsible for the child resources are subordinate to the document and later moved to the Documentloader class. The following relationship is formed:
Cachedresourceloader
As for Cachedresourceloader, it is actually a package class that encapsulates the functions of creating various kinds of cachedresource. Each page element that needs to be loaded inherits from Cachedresourceclient, creating cachedresourcerequest, through documentloader/ The Cachedresourceloader in document initiated the request.
The following is the invocation of the script element initiating the request:
Memory cache/application Cache
Resource Load Scheduler
There are two lists stored in hostinformation, one is the list of waiting loads that are stored with different priority groups, and one is the list that is being loaded.
When you use Scheduleservependingrequests to process queued requests, they are executed in the order of precedence. Here is the basic process:
The above is a summary of the loading process, the middle of the lack of some process content, you can refer to the following two links:
[WebKit] Design and implementation of WebCore page loading (II.)
[WebKit] Design and implementation of WebCore page loading (III.)
Reprint Please specify source: Http://blog.csdn.net/horkychen