Webkit create frame and loadurl



1. Creating Frame

in android, it begins in "WebCoreFrameBridge.cpp",CreateFrame()

static void CreateFrame(JNIEnv* env, jobject obj, jobject javaview,
             jobject jAssetManager, jobject historyList)

it create many important classes for the browser,  in time order:

Page WebFrame FrameLoaderClientAndroid FrameWebViewCore FrameView andWebFrameView

blue color ones are classes for android only. black are common class for webkit.


one most class is Frame:

below is the diagram for Frame and the class created by it.

FrameloaderClient(created in the same function as frame)

Frame

|--FrameLoader(init, raw pointer, create in the constructor list)

           |--DocumentLoader  (RefPtr, assign by function)

                     |--MainResourceLoader (RefPtr ,startLoadingMainResource)

                     |--DocumentWriter(raw pointer, in the constructor list)

                               |--Document (passref begin, createDocument, return a document)


2. printf  KURL 

    KURL is the class used in webkit to present url.

    If we want to log the content of KURL, we should use code like this:

   LOG(Loading," url %s",url.string().utf8().data());
    

    Detail implement is below:

    a KURL is defined in WebCore/Platform/KURL.h, it has a member function string().

    b KURL.string(), return a class of String, which was defined in wtf/text/WTFString.h, it has a member function utf8()

    c String.utf8() return a class of CString , which was defined in wtf/text/CString.h, it has a member function data().

    d CString.data() return the type of char* , which can be printed directly.



3 LoadUrl

LoadProcess

FrameLoader->DocumentLoader->ResourceLoader->ResourceHandle(ResouceHanderInternal)->ResourceLoaderAndroid(WebUrlLoader)

->WebUrlLoaderClient->WebRequest(chromium's callback)


a.WebView.java 

loadUrl

b.WebViewCore.java

loadUrl

c.BrowserFrame.java 

loadUrl

nativeLoadUrl

d.WebCoreFrameBridge.cpp

LoadUrl

--pFrame->loader()->load(request, false);

e.FrameLoader

load(const ResourceRequest& request, bool lockHistory)

----FrameLoaderClient->createDocumentLoader()

load(DocumentLoader* newDocumentLoader)

----addExtraFieldsToMainResourceRequest

----loadWithDocumentLoader

callContinueLoadAfterNavigationPolicy()

continueLoadAfterWillSubmitForm()

f. DocumentLoader

startLoadingMainResource

g.MainResourceLoader

load

loadNow.

h.ResourceHandle

create

i.ResourceHandleAndroid.cpp

start

j.ResourceLoaderAndroid

start

k.WebUrlLoader

start

l.WebUrlLoaderClient

start.

......

to chromium stack.

also another imporant classes

ResourceRequest and ResourceResonse



 browser

from click to tab

TitleBarXlarge->onClick
TitleBarBase->onAction
Controller->handleNewIntent
IntentHandler->onNewIntent
Controller->openTabAndShow



from loadurl to network (apache stack)

a.WebView.java 

loadUrl

b.WebViewCore.java

loadUrl

c.BrowserFrame.java 

loadUrl

nativeLoadUrl

d.WebCoreFrameBridge.cpp

LoadUrl

--pFrame->loader()->load(request, false);

e.FrameLoader

load(const ResourceRequest& request, bool lockHistory)

----FrameLoaderClient->createDocumentLoader()

load(DocumentLoader* newDocumentLoader)

----addExtraFieldsToMainResourceRequest

----loadWithDocumentLoader

callContinueLoadAfterNavigationPolicy()

continueLoadAfterWillSubmitForm()

f. DocumentLoader

startLoadingMainResource

g.MainResourceLoader

load

loadNow.

h.ResourceHandle

create

i.ResourceHandleAndroid.cpp

start

j.ResourceLoaderAndroid

// from now same as chromium stack.

h. ResourceLoaderAndroid::start

i.WebCoreFrameBridge.startLoadingResource

j.BrowserFrame.java startLoadingResource

k.FrameLoader.java executeLoad

for local file

handleLocalFile.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值