Changes in the surface loading process of the browser plug-in android2.2

Source: Internet
Author: User

 

In the previous article I mentioned two rendering modes of browser plug-ins: http://blog.csdn.net/qyqzj/archive/2010/06/14/5670816.aspx,

Recently, I downloaded the 2.2 source code package, observed the relevant code, and found that the loading process of the surface mode has changed.

 

First, the original 2.1 surface was loaded like this:

 

In short, plugin informs webkit of the Java class of its own View, and webkit obtains the View of the plug-in on the Java side.

 

 

By 2.2, the surface is loaded as follows:

 

By 2.2, the underlying layer of the Android browser plug-in has gained more rights to operate JAVA objects. If webkit needs to obtain the view of the plug-in, it will call NPP_GetValue (NPPVariable = kw.urface_anpgetvalue) (this is newly defined in android_npapi.h of 2.2 ). At this time, the Plugin side will call the loadJavaClass function in ANPSystemInterface to obtain the Class Object of the PluginStub. This function returns a jclass C/C ++ object (corresponding to the Class Object in Java ), then, the plug-in directly calls the constructor of this class (through JNI) on the Native side to obtain a new PluginStub object and return it to the browser as the result of NPP_GetValue. After the native side of the browser obtains this object, JNI calls the JAVA side (WebViewCore. addSurface function) to add the view to the page view, and the surface is loaded here.

For specific procedures, refer to Version 2.2's BrowserPlugin.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.