Android WebView代码组织
android-webview-dev@chromium.org
Last updated Jul 2014.
Android build tree中,external/chromium_org是chromium源代码(根目录位于src.chromium.org/viewvc/chrome/trunk/src/的一个镜像。
CHROMIUM TREE (“upstream”: trunk/src; “downstream”: external/chromium_org)
ANDROID TREE
- frameworks/base -- core/java/android/webkit/…
- Defines the public API to the android.webkit package (WebView, WebSettings, etc)
- Declares the [hidden] abstract WebViewFactoryProvider, WebViewProvider interface that webview implementations must subclass.
- Defines various “POD” like data types that are passed between the application and the concrete WebView implementation (e.g. WebViewTransport) and ancillary utility classes (e.g. URLUtil)
- (Historic; pre-KK) Defines the WebViewClassic & related classes that powered the legacy webview implementation
- frameworks/webview -- chromium/java
- often referred to as the “glue layer” this bridges between the core android framework, and external/chromium_org
- Performs dependency inversion so frameworks/base and external/chromium_org have no interdependency on internal details of each other. This is the main entry-point on the java side for the chromium WebViewFactory
- The goal is this should only depend on android_webview public APIs (some accidental exceptions exist, e.g. ThreadUtils, LibraryLoader etc) and not contain complex logic; just method forwarding (interface adaption) across the boundary.
- By convention, this module also provides all the mappings from embedding application targetSdkVersion to specific set of settings for workarounds & quirks that should be runtime enabled in the underlying chromium stack
- frameworks/webview -- - chromium/plat_support
- provides a native support library to bind a select few internal native platform APIs to android_webview/public counterparts (e.g. GL functor, gralloc, and skia bitmap access utilities).
- Dependency injection of code in this folder avoids any build-time dependency of external/chromium_org on non-NDK symbols.
- cts -- tests/tests/webkit/src/android/webkit/cts
- Android Compatibility Test Suite for the android.webkit.* APIs. These tests have only access to the ‘public’ WebView API and test the WebView implementation in an configuration identical to when it’s actually running in an application.
- There should be at least one test for every publicly exposed API in the suite. This makes sure everything is ‘hooked up’ correctly.