Understand WebKit and Chromium: Chromium plug-in and extension Basics

Source: Internet
Author: User
Tags javascript extension

Http://blog.csdn.net/milado_nju

PPAPI is proposed because of the high portability and performance of the NPAPI, especially for cross-process plug-ins, especially when the plug-ins require 2D and 3D plotting and sound. In the early days, we had to solve these problems. In order to win support from plug-in vendors, we tried our best to use the APIs of the original NPAPI. Now, with the continuous development of PPAPI, APIs are constantly changing. Later, PPAPI was also used in Native Client technology and gradually modified. Until now, you can view the complete list at http://code.google.com/p/ppapi/w/list.

So why does PPAPI provide high-performance graphics and sound? As mentioned above, in the current NPAPI plug-in system, the common practice is that when the webpage needs to display the plug-in or needs to be updated, it will send an invalid (Invalidate) for the plug-in to draw them. In the PPAPI plug-in mechanism, it introduces a retained mode, which means that the browser always retains a backend bucket to indicate the last drawn area. This is very useful because the PPAPI plug-in is usually cross-process, so the browser can draw web pages without the need to lock, while the plug-in process can draw new results in the background.

PPAPI plug-ins can run in two modes: trusted plug-ins and untrusted plug-ins. For a trusted PPAPI plug-in, it can run in the Renderer process or across processes. In the implementation of the new version, the architecture design is based on IPC. For non-trusted PPAPI plug-ins, NativeClient technology is used to run them securely. For trusted plug-ins, they are platform-related and may call platform-related interfaces. For non-trusted plug-ins, they are platform-independent code. They call the limited interface provided by NativeClient and cannot call any interface.

NativeClient, also referred to as NaCl, is a sandbox technology that provides platform-independent, untrusted code, a secure runtime environment for computing-intensive needs, for example, game engines, visual computing, big data analysis, 3D graphics rendering, and other requirements, they need to access some limited local interfaces, so that they do not need to be computed through network services, to avoid extra bandwidth resources. It is similar to WebGL, WebAudio and other technologies that solve problems, but the approaches are different because they are standards, while NativeClient technology is proposed by Google, using NativeClient can easily provide the capabilities of many local libraries to web pages, without complicated porting processes, which makes reuse very convenient.

PPAPI and NativeClient are not necessarily related. They solve different problems, but currently NativeClient is implemented based on the PPAPI. In fact, NativeClient was previously implemented based on the NPAPI interface, so it can run in Firefox, Safari, and operabrowser.

Because NativeClient uses PPAPI to provide a secure runtime environment, it is also a PPAPI plug-in, which is a PPAPI plug-in Chrome browser-NativeClient. Unlike other PPAPI plug-ins, PPAPI is a plug-in that runs in the Renderer process. in the figure, "Type: PPAPI (in-process)" is displayed )".


Chromium Extension mechanism (to avoid name confusion with the general "JavaScript Extension mechanism", which will be called Chromium Extension Mechanism later) was originally a Technology launched by Chromium, this mechanism can expand the capabilities of the browser. For example, an extended instance called "switchy proxy" used by the author can help users conveniently switch the proxy of the Chromium browser. That's all. In essence, it is actually a simple extension of browser capabilities. For some local functions, such as bookmarks, USB, Bluetooth, and power management, it does not have such capabilities.

An example of Chromium Extension is actually a webpage with JavaScript code and CSS. Of course, in Extension, developers can also use the NPAPI plug-in, PPAPI, And the NaCl mechanism technology to expand web page capabilities, therefore, it does not conflict with these technologies. On the contrary, Extension may need these technologies to provide certain functions.

Of course, the goal of the Chromium Extension mechanism is far from that simple. Extension of extended browser functions is only a small feature. With the continuous development of this mechanism, the Extension mechanism has been used to support Web applications, that is, to develop applications using HTML5, JavaScript, and CSS technologies and run them using Chromium browsers, of course, the user experience is very similar to that of local applications. Chromium is a Web-dependent operating platform. Web pages using extended mechanisms can be called Web applications. If you think the function is not enough, you can also understand it as a preliminary stage, but it actually extends the web page to the scope of web applications. In Google's Web Store, readers can find two categories, including traditional Extension and Web applications. From the user's point of view, the difference between a common Extension and a Web application is that a common Extension only runs in the current window (of course, it is not absolute, but the working mechanism is indeed different), and Web applications are an independent window.

It is the Extensions (Google Docs) and Cut theRope installed in the Chrome browser. You can enter chrome: // extensions/in the address bar to view them.


1. http://www.chromium.org/developers/design-documents/pepper-plugin-implementation

2. http://www.chromium.org/nativeclient

3. http://www.chromium.org/developers/design-documents/extensions

By yongsheng@chromium.org


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.