首页 > 移动平台 > 详细

android webkit 初始化流程

时间:2014-10-21 23:02:22      阅读:431      评论:0      收藏:0      [点我收藏+]

以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 初始化流程

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!