Android Chromium for WebView code structure

Source: Internet
Author: User

Reprint please indicate the source http://blog.csdn.net/typename powered by [email protected]

Overview It is believed that attention to the development of Android platform has been observed that Android 4.4 and the default implementation of WebView from WebKit to chromium, which is good for using Android WebView, based on the chromium web View performance is better and smoother, and AOSP is already compatible with the old version of the API and does not require any modifications from our application to run on Android 4.4. This article describes the implementation code structure of chromium for WebView. The implementation is divided into two parts, part of the framework of the Android WebView and the public API is also part of the WebView implementation core Chromium The following diagram shows the relationship between the two and the upper and lower structure.

Android Tree Side1. frameworks/base --core/java/android/webkit/ (1) define public API (webview,webviewsettings, etc)(2) Define the inner hidden class of the packageWebviewfactoryprovider,webviewprovider(3) define various "POD (plain old data)" Data types, the data types that users pass between the application and the WebView implementation. such as the Urlutil class. (4) Define the specific implementation code for some WebView2. frameworks/webview --Chromium/java (1) Glue layer code, bridging Android WebView Framework and external/chromium_org(2) In the Java section This is the main entrance to the chromium webviewfactory. (3) The goal of implementing code in this directory is to rely solely on the public API of Android_webview (except in some cases, such as threadutils,libraryloader,etc). And does not contain complex logic. Just keep the glue layer state. 3. Frameworks/webview --Chromium/plat_supportThis part of the Code provides platform support, a copy of the native supporting library binding a small portion of the Android_webview/public API (GL functor, Skia bitmap access Utilities)Chromium Tree Side1.android_webview/java (1) The top entrance portion of the Chromium. (2) A layer of Wrapper/semi is provided based on the chromium code to backwards compatible with the Android system version. (3) Background support for most API implementations of WebView is supported by the Chromium content module (http:/ /dev.chromium.org/developers/content-module) and its affiliated components browser (http://dev.chromium.org/developers/ Design-documents/browser-components) This part of the code corresponds to the native part of the code via JNIthe android_webview/native directory.2.android_webview/native(1) The code of this directory should be called the JNI part of the code, this layer of code is just Android_webview/java and native code of the interface layer code. The naming of a class is basically a copy mapping of the Java layer class, and the function is the same. (2) This directory exists can be stored to avoid complex implementation logic, reduce android_webview/browser pressure or components pressure(3) This part of the code must run on the same thread as the WebView public API, and the WebView public API runs on the UI thread, so this part of the code functionality must also run on the UI thread. This important interaction code with the Browserthread or IPC rendering thread is placed under the browser directory. 3.android_webview/browser(1) This directory code implements the browsing and other important feature functions. (2) code that requires complex interaction with native threads needs to be encapsulated in this package. (3) for modularity and module testing, in this part of the code there is no static forced dependency on the upper code (android_webview/native) layer code. 4.The android_webview/renderer contains all the logic code that runs in the render process.currently WebView only supports single process rendering, Browser/renderer remains separate, which is a very useful architecture, separating the Java application part from the Web platform code, avoiding the occasional, mutually independent and more stable. 5.android_webview/lib This directory is mainlylibwebviewchromium.so the entry, no other modules depend on this directory under the code. 6.android_webview/commondeclares that some raw type is available to Android_webview/browser and Android_webview/renderer. The WebView uses a single-process mode with the advantage of sharing the global state. The type declarations for each IPC are also defined here. 7.android_webview/public(1) define an abstract interface to export the native section to focus on important performance detections (such as rendering) that cannot be implemented in Java(2) Use the Android framework internal tools for high-performance background-compatible custom view.8.Android_webview/unittestjavaMain test JNI Part code
Reference: https://code.google.com/p/chromium/
https://source.android.com/
http://www.chromium.org/developers/design-documents/


Android Chromium for WebView code structure

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.