欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

WebKit in Android Framework

程序员文章站 2022-04-05 15:16:58
...

这部分内容我实在记不起来是我自己总结的还是从哪里看来的?看着凌乱的内容,感觉应该是当时随笔记录的理解,即使是copy来的,也算是当时工作中的一些总结

WebView extends AbsoluteLayout implements ViewTreeObserver.OnGlobalFocusChangeListener, ViewGroup.OnHierarchyChangeListener

CallbackProxy mCallbackProxy

WebViewCore mWebViewCore, many webview operation or public method using webviewcore to do something.

int mNativeClass,

mPrivateHandler, Handler for dispatching UI messages, in some cases, if it needs extra action before dispatch message, it will launch a new thread to do extra work then dispatching message. General handler to receive message coming from webkit thread. For UI relating, it will invoke callbackproxy to do

final Handler mPrivateHandler = new PrivateHandler(); Handler for dispatching UI messages.

class CallbackProxy extends Handler, a proxy class for handling WebCore -> UI thread messaging. All the callback functions are called from the WebCore thread and messages are posted to the UI thread for the actual client callback.
This class is created in the UI thread so its handler and any private classes that extend Handler will operate in the UI thread.
class WebViewCore
WebViewCore always executes in the same thread as the native webkit.
private final CallbackProxy mCallbackProxy; Proxy for handling callbacks from native code
BrowserFrame mBrowserFrame; The BrowserFrame is an interface to the native Frame component.
In it, Thread t = new Thread(new WebCoreThread()); will be created
mBrowserFrame = new BrowserFrame
mEventHub. It will create a handler to process all webviewcore invoke
In webviewcore, it will be mWebView.mPrivateHandler.sendMessage.XX
In webview, it will be like mWebViewCore.sendMessage(EventHub.XXX
class BrowserFrame extends Handler,

UI BrowserFrame.java->nativeLoadUrl == WebCoreFrameBridge.cpp->LoadUrl

CORE BrowserFrame.java-> loadStarted
CallbackProxy.java->onPageStarted

UI CallbackProxy.java -> PAGE_STARTED
WebView.java->onPageStarted

CORE WebViewCore.removeMessages
WebViewCore$EventHub.removeMessages

 BrowserFrame.setProgress
 CallbackProxy.java->onProgressChanged
相关标签: WebKit