This article describes only HTTP network request-related information, and the types of Https, Spdy, File, FTP, WebSocket, and so on, only refer to where the relationship branch appears.
The code hierarchy diagram is as follows:
+----------------------------------------+| Webview.java (SDK public API) |+----------------------------------------+| Android & Chromium Wrapper | Java Bridging and Encapsulation layer +----------------------------------------+| Content Module (Navigation Control) | Core layer, the loading process is responsible for a variety of Jump +----------------------------------------+| Blink public Web API (WebView) | Web API for external manipulation of kernel +----------------------------------------+| WebCore | The original WebCore's head and tail were cut off to form blink+----------------------------------------+| blink Public Platform API (Network) | Platform API requires external implementation +----------------------------------------+| Content Module (I/O thread) | For the upper level implementation, operate in the IO thread +----------------------------------------+| Network Stack &NBSp;| Network library +----------------------------------------+
( index of the yellow label ):
+--------------------------------------------+| Browser Application | Browser program +--------------------------------------------+| Package Android.webkit | SDK api+--------------------------------------------+| Package Com.android.webview.chromium | Android Bridging layer +--------------------------------------------+| Package Org.chromium.android_webview | Chromium package Layer +--------------------------------------------+| Package Org.chromium.content.browser | Chromium Android Platform code +--------------------------------------------+| Content Module Browser Side | Content module Browser Process processing +--------------------IPC---------------------+| Content Module Renderer Side | Content Module renderer Process processing +--------------------------------------------+| Blink public Web API |+--------------------------------------------+| WebCore |+--------------------------------------------+| Blink public Platform API |+--------------------------------------------+| Content Module implementation of Blink | Content implementation Blink interface +--------------------IPC-------------------- +| Content Module Loading Control | Load flow control +--------------------------------------------+| NET Module Public API | NET Library external interface layer +--------------------------------------------+| Job Factory | Task Factory (Differentiate network protocol) +--------------------------------------------+| Transaction & HttpCache | Transaction and httpcache+--------------------------------------------+| | Session & Socket Pool | Session with Socket pool| Stream |---------------------------| Flow | | DNS & Hostcache | +--------------------------------------------+| Socket |+--------------------------------------------+
The following is a detailed inter-class relationship/hierarchy diagram . Look at the picture tip:
- The layer at the beginning of the package is the Java class
- Classes with the same name at different levels are labeled namespaces, such as Resourceloader, Frametree
- If a pure virtual class has only a single implementation, it is abbreviated to a base class name | Impl
- It is from the user's point of view according to the data flow to sub-level, and according to the function of clustering module (this is a personal understanding, unofficial document description)
- If Class A is associated with the base class of Class B, it is actually interacting with Class B and Class A.
- The horizontal line indicates the distinguishing function module/package/namespace. A yellow rectangular label indicates the function/meaning of this layer. The gray rectangle is a description of the layer.
- For the first time, just look at the yellow label and know what the levels and hierarchies are; second, look at the layer you care about, including the description of the layer and the connection to the upper and lower layers. If interested, read the third time carefully and get a clear picture.
Simplified Message Flow as follows:
- The UI thread of the browser process begins Webview.loadurl
- After multi-layer bridging, the class reaches Contentviewcore.java to JNI code Content::contentviewcoreimpl
- The URL that was packaged by Navigationcontrollerimpl to initiate a C + + request, and renderframehostimpl it into an IPC message sent to the renderer process
- After the IPC mechanism is processed in the renderer process, the Renderframeimpl is reached, and then the message flows through the blink and WebCore layers , finally arriving at Weburlloaderimpl responsible for the actual load
- Weburlloaderimpl network data I/O to the I/O thread of the browser process by sending an IPC message via Ipcresourceloaderbridge
- This message is received by Resourcedispatcherhostimpl after processing by IPC and then handed to Content::resourceloader to control Net library for network communication acquisition data .
- NET Library after HttpCache (Memory | Disk), DNS (Hostcache), connect (SSL handshake), write, read, the resulting data is finally sent through the Resourcemessagefilter IPC message back to the renderer process
- WebCore gets the data, it is referred to parsing thread by P Osttask
The following is the loading process of the Xmind export diagram, it is best to save as to the local use of look at the picture software. Look at the picture tip:
- The flow from top to bottom is based on the stack upside down.
- "..." means the code that omits the IPC mechanism
- There are some places in the diagram where the code for the callback mechanism is omitted
- The same parent node represents a sequential execution within this parent function
- Most class names and function names already represent their functionality and meaning, and you can also view the header file comments for that class to help you understand them, or to compare the "inter-Class diagram" below. Some classes do not need to be understood when doing specific development, so they are not explained.
- There are several classes in the process that have the same name function Doloop, these classes are divided into small operations of the large process, internally with the Emun state representing the operation step (the case XXX branch in the figure) to track which step, so as to achieve the asynchronous and reduce the processing time of the secondary loop.
Figure is too large, divided into two paragraphs, click to view the larger image:
Reprint Please specify Source: http://blog.csdn.net/hursing