码迷,mamicode.com
首页 > 移动开发 > 详细

android webkit 初始化流程

时间:2014-10-21 23:04:16      阅读:297      评论:0      收藏:0      [点我收藏+]

标签:android   style   blog   http   color   io   os   ar   java   

以android 4.2为例

1, android 4.2WebViewClassic.java WebView.java的代理类.

2,程序运行后,浏览器首先加载webkit so.

    WebViewCore.java ,apk 运行后只加载一次.

    static {

      // Load libwebcore and libchromium_net during static initialization.

      // This happens in the zygote process so they will be shared read-only

      // across all app processes.

      try {

        System.loadLibrary("chromium_net");

        System.loadLibrary("webcore");

      } catch (UnsatisfiedLinkError e) {

    Log.e(LOGTAG, "Unable to load native support libraries.");

    }

3,loadLibary 后则会初始化对应的JNI.framwork webkitc++ 层关联对应起来.

  主要处理在 WebCoreJniOnLoad.cpp

 

static RegistrationMethod gWebCoreRegMethods[] = {

{ "JavaBridge", android::registerJavaBridge },

{ "WebFrame", android::registerWebFrame },

{ "WebViewCore", android::registerWebViewCore },

{ "WebHistory", android::registerWebHistory },

{ "WebIconDatabase", android::registerWebIconDatabase },

{ "WebSettingsClassic", android::registerWebSettings },

#if ENABLE(DATABASE)

{ "WebStorage", android::registerWebStorage },

#endif

{ "WebView", android::registerWebView },

{ "ViewStateSerializer", android::registerViewStateSerializer },

{ "GeolocationPermissions", android::registerGeolocationPermissions },

{ "MockGeolocation", android::registerMockGeolocation },

#if ENABLE(VIDEO)

{ "HTML5Audio", android::registerMediaPlayerAudio },

{ "HTML5VideoViewProxy", android::registerMediaPlayerVideo },

#endif

{ "DeviceMotionAndOrientationManager", android::registerDeviceMotionAndOrientationManager },

{ "CookieManager", android::registerCookieManager },

{ "CacheManager", android::registerCacheManager },

 

};


4.创建WebView:

    webview1 = (WebView) findViewById(R.id.WebView1);

    该行调用后,则会初始webkit ,java c++ 层的关键类.


 bubuko.com,布布扣


android webkit 初始化流程

标签:android   style   blog   http   color   io   os   ar   java   

原文地址:http://www.cnblogs.com/haide/p/4041597.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!