chromium android 镜像,WebView代码组织

android_webview/java

Webview chromium栈的顶层入口点

在chromium代码栈上为downstream android代码树的使用提供一个半稳定的表层/wrapper。不像其他chromium java代码,这个包中public类的public接口被作为第一类public API,而使用方则与这个git仓库版本独立。

对于大部分WebView API,后端功能由chromium content module, 或者辅助browser components提供;而对于它分发的feature,则在chromium栈的其他层调用public Java API,再由android webview/native 目录中的代码调用native JNI的部分。

android_webview/native

Would be more appropriately named ‘jni’. In general code in here is responsible for crossing the Javanative boundary. Classes here tend to reflect their java counterpart naming, and primarily responsible for creational and object ownership and cleanup roles

Where possible avoid placing complex implementation logic in here instead factor out into more focused feature specific classes inside the android_webview/browser folder or as a component in the top-level components/ folder (e.g. if needs to be shared with Chrome browser).

By convention code in here should follow the same threading model as the public WebView API (that is, primarily executes on UI thread). Non-trivial interaction with BrowserThreads and IPC to renderer is extracted down to the browser/ folder.

android_webview/browser

Provides non-trivial behavioral and functional classes for implementing features not directly exported by the content module public API.

By convention, any complex native threading code should be encapsulated here.

DEPS enforces that classes in this folder have no static dependency on the higher layer android_webview/native JNI wrappers. This aims to make the pieces in browser/ more modular and testable, and minimize the big ball of mud tendency.

android_webview/renderer

Contains all code that logically resides in the renderer process. While WebView currently only supports single process mode, the browser/renderer separation is maintained as it is a useful architectural separation between the (implicitly trusted) java application and the (potentially untrusted) web-platform code.

android_webview/lib

This is the main entry point to the libwebviewchromium.so native library. This is the top of the native code static dependency tree; no other module may depend on this.

android_webview/common

Declares raw types etc that are shared by both android_webview/browser and android_webview/renderer

While single process mode makes it possible to share state via e.g. globals hidden in this module, resist this temptation. Instead common abstract types may be declared here, but the concrete instances should be constructed and passed in from the appropriate creational class in android_webview/lib.

As per chromium conventions, IPC message types are declared here.

android_webview/public

Defines and exports abstract native interfaces for certain performance critical (e.g. rendering pipeline) functionality and that cannot be implemented via Java.

This resolves the conflicting needs: of keeping all chromium code SDK/NDK clean, yet using certain internal Android platform facilities to implement a backwards compatible and high-performance framework custom View class.

To minimize ABI interdependencies (e.g. avoid STL types being passed over .so boundary, incompatible new/delete calls across boundaries, etc) the interfaces declared here use simple C-style calling conventions (POD structs and static methods, injected via tables of simple function pointer).

The plat_support module in frameworks/webview provides the canonical concrete realization of the abstract interfaces declared here.

android_webview/javatests

Integration tests for the org.chromium.android_webview.* APIs.

These tests exercise the top-level APIs used by the Android ‘glue layer’ to actually implement the WebView API, so they don’t actually test the full WebView stack,

They do however have access to internal APIs and state that is unavailable further up the stack.

Integration tests extend AwTestBase.

Unit tests for functionality implemented entirely in Java (for example AwLayoutSizerTest.java). Unit tests extend InstrumentationTestCase.

android_webview/unittestjava

Java support code for C++ unittests. This is necessary to test any code that uses JNI, for example any logic checked into the android_webview/native layer.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值