Native Client Brings Sandboxed Native Code to Chrome Web Store Apps

Thursday, August 18, 2011

Labels:

Wouldn’t it be great if you could create web apps using your existing C and C++ code? Native Client lets you do just that, and it is now enabled for Chrome Web Store apps in Google Chrome’s beta channel.

Native Client apps live on the web platform, so you don’t need to create separate versions of your app for each operating system. Rather than relying on OS-specific APIs, Native Client apps use Pepper, a set of interfaces that provide C and C++ bindings to the capabilities of HTML5. This means that once you’ve ported your code to Native Client, it will work across different operating systems, and you only need to maintain one code base.

Today Native Client supports the Pepper APIs for 2D graphics, stereo audio, URL fetching, sandboxed local file access (File API), and asynchronous message passing to and from JavaScript. In future releases we will be adding support for hardware accelerated 3D graphics (OpenGL ES 2.0), fullscreen mode, networking (WebSockets and peer-to-peer connections), and much more. As new capabilities are added to HTML5 and Pepper, they will become available to Native Client.

This functionality does not come at the expense of security. To ensure that Native Client is as safe as JavaScript, Native Client code is isolated from the operating system by two nested security sandboxes: the Native Client sandbox and the Chrome sandbox. And unlike NPAPI plugins or ActiveX controls, Native Client apps do not have access to the underlying OS APIs.

We encourage you to start developing apps with Native Client. You can download the SDK and find tutorials, examples, API documentation, and our FAQ on the Native Client site. Once version 14 of Chrome hits stable channel, you’ll be able to upload your Native Client apps to the Chrome Web Store, where you can reach Chrome’s 160 million users.

The next milestone for Native Client is architecture independence: Portable Native Client (PNaCl) will achieve this by using LLVM bitcode as the basis for the distribution format for Native Client content, translating it to the actual target instruction set before running. Until then the Chrome Web Store will be the only distribution channel for Native Client apps. This will help us ensure that all Native Client apps are updated to PNaCl when it’s ready – and in the meantime avoid the spread of instruction set architecture dependent apps on the web. We’ll be providing updates on the progress of PNaCl on this blog.

9 comments:

Mmmbacon said...

I keep hearing this is a game changer, and I almost grasp the concept of the native client, but can you point us to any examples to try (in the dev or canary vers. of course). Thanks!

Peter Kasting said...

@Mmmbacon: http://www.naclbox.com/

William said...

The Native Client plugin, is MIA
in Chrome OS.... No fair :(

easylift said...

Thank you for making the effort and spreading this information with all of us. It was indeed very useful and informative while being straight forward and to the point.
Appliance Repair

Ray Cast said...

The latest chrome dev version is a mess. I hate how it tries to push me to the app store. But even worse, it gives me a "blue screen" (browser only) on various sites that use Google Maps, making them unusable.
And I cannot close various tabs via the x button on the window, but have to use the keyboard or context menu.
So far, this has been the worst chrome version ever.

Chris Zalcman said...

Very bad news :(

Does this mean that in the future NPAPI plugins will not work in Chrome?

I hope Firefox will not make such restrictions.

Capt'n Corrupt said...

I wouldn't be surprised if ChromeOS was restricted to Pepper plugins, though Chrome will likely continue support for NPAPI. NPAPI is (as I understand it) is a little to exposing of the underlying OS and would be a point of compromise for the ChromeOS system.

Anyway, NaCl largely removes the need to use plugins in the first place.

Assaf Raman said...

This comment has been removed by the author.

Assaf Raman said...

A good blog post.
It inspired me to port OGRE(Object-Oriented Graphics Rendering Engine) to NaCl.
You can see OGRE running on NaCl on this page.

As of this date (Aug 2011) Google Chrome Beta doesn't enable NaCl by default, moreover - you have to set command line parameters, environment parameters and such for it to run. This really makes it hard for developers like me to share webpages that use NaCl with other people.

The biggest disadvantaged for developing with the NaCl SDK was the lack of Visual Studio IDE support, so I added it while porting OGRE.

You can read the full story how I ported OGRE to NaCl here.