WebKit Child Resource Loading process

Source: Internet
Author: User

A Web page consists of a main document and a child resource. The main document describes the Web page's frame, layout. Child resources are the child elements that make up a webpage, including pictures,CSS,JS , and so on. In order to display a Web page, you first load the resource into memory. Loading refers to the process of loading the required resources into memory. Webkit uses a lot of caching mechanisms, which may be loaded from the network or from the local cache. The load of Webkit is divided into two lines, one is the loading of the main document, and the other is the loading of the child resources.

You first need to parse the main document before you know which child resources to use. However, it is not important to wait until the main document is parsed to load the child resources, or the edge-resolved edge-loaded sub-resources, that is, the partial main document begins to parse, parsing to a child resource begins to load.


The following is an example of the process of loading a child resource by loading a picture resource.


When parsing the main document, it is necessary to find aImageresource, and then notifyImageloaderLoadingImageResources. ImageloaderNoticeCachedresourceloadersends a load request. LoaderFirst QueryMemoryCacheIf there is a resource, none creates aCachedimagerepresents the resource. Then throughResourceloaderschedulerdispatches a load request. ResourceloaderschedulerCreate aSubresourceloaderinstance to complete the load request (create->init->sendrequest). Resourcehandleresponsible for interacting with platform-related interfaces, sending requests and platform-related layers, retrieving data from the platform-related layer. In theAndroidplatform, the load request passes through theResourcehandlepassed toWebkit, inWebkitlayers also involve many classes. First queryhttpif the cache has this resource, no network requests are sent. After the data is returned, it is passed through various callbacks toWebCorethe.

complete the loading of a resource, involving dozens of classes. is quite complicated.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.