As we all know, WebKit needs to create a DOM tree. For this it is necessary to create WebView, Chrome,page,frame, document, document PARSER, Dom tree Builder (dom trees build engine), Scriptrunner, Resource Handle and so on objects.
At the same time, you also need to create support objects that serve or communicate with the above objects, such as the chromeclient associated with the local window, the frameloaderclient associated with the Frameloader event, the document that serves the document Loader, Documentwriter and documentparser; Analysis of HTML page words Htmlmetachractorparser, Htmltokenizer , the Htmlparserscheduler of the parser service, the htmlconstrctionsite of the service for the DOM tree, the resourceloader of the request service for the network resource, and so on.
Of course, in addition to the objects listed here, there are many objects such as Subresourceloader and so on are not all listed. So, when are so many objects created? Sorted by time, I ranked them as follows:
Webview->chromeclient->chrome->page->frameloaderclient->frameloader->frame->
Policychecker->documentloader->documentwriter->document->htmldocumentparser->
textresourcedecoder->htmlmetachractorparser->htmltokenizer->htmlscriprunner->htmlparserscheduler- >
Htmltreebuilder->htmlconstructionsite->htmlelementfactory->mainresourceloader->resourcehandle
Detailed creation details I drew two time series diagrams:
Figure One: Creation of individual objects when initializing (before initiating a request for network requests)
Figure II: Creation of various objects after initiating network requests (request) and details of the creation of the DOM tree
The next chapter is about the working process of the lexical analyzer.
WebKit initialization and the creation of various objects in the process of loading the URL and the detailed analysis of the DOM tree