This article is more than 1 year old

Google defends native code Chrome play

'Don't ditch The Good for The Perfect'

Google has defended its decision to run native code inside its Chrome browser, while calling its Native Client plug-in a "very important part" of the company's Chrome OS strategy.

In unveiling its Cr-48 beta Chrome OS machine on Tuesday in San Francisco, Google did not mention Native Client. But when we asked what role the plug-in would play in the company's all-web-all-the-time OS, Google engineering director Linus Upson made it quite clear that Native Client — aka NaCL — isn't just a side experiment.

"Native Client is a very important part of our [Chrome OS] strategy," Upson said. "While the [Chrome] team has made JavaScript tremendously faster over the last two years, there's a lot of applications out there that have existing audiences that are [written in native code, such as C and C++], and there are a few that are specialized applications that need every last bit of performance the hardware can offer. Native Client is a way of addressing both those issues."

Asked if a final version of Native Client would ship with the first Chrome OS netbooks, due in "mid-2011," Upson was non-committal. But he did say that Native Client was "pretty far along." And he said that the plug-in would be turned on in the stable version of the company's Chrome browser — the basis for Chrome OS — "early next year." And he pointed out that after you purchase a Chrome OS machine, Google will continually update the operating system with new tools via the net.

He said that eventually, "you'll be able to take existing seasoned [native code] and run it securely across all platforms, including Chrome OS." But by all platforms, he means all Chrome platforms. Native Client has not been adopted by any other major browser vendors, and some have questioned whether the plug-in undermines the movement towards applications based entirely on web standards.

Mozilla has said quite plainly that its browser will not run native code, and Opera is similarly down on the idea. "That's not something we're pursuing. We really believe in HTML, and this is where we want to focus," Mozilla vice president of products Jay Sullivan told The Reg this summer at a Silicon Valley conference dedicated to net infrastructure. "

But speaking with us on Tuesday, Google's Upson strongly defended the concept. The first thing he said was that Native Client is open source. "We don't want to do anything proprietary," he said. But then he moved on to meatier matters. Upson said the in his conversions with the likes of Opera and Mozila, those browser makers have been pleased with the way Native Client handles security, and he believes they will start using it to secure their own code.

Native Client is designed to ensure that each application module meets a set of structural criteria that allow it to dissemble instructions, and that it can't contain certain instruction sequences. "This framework aims to enable our runtime to detect and prevent potentially dangerous code from running and spreading," Google said when announcing Native Client.

Upson said that Google is using Native Client to help build Chrome itself. "We're starting to use Native Client internally in Chrome to help secure more and more of the browser. I wouldn't be surprised if more and more browser vendors do the same," he said. "What Native Client can do is to make it so that if you write a bug in your code — we all write bugs — it doesn't become a security vulnerability. It's an additional layer of security."

But what about using Native Client to run web applications? But about web standards? "When it comes to running programs over the web in Native Client, we're very sensitive to maintaining the qualities of the web that have made it so successful," Upson said. "One of those things is that you can write applications that can run on any computer. One of the reasons we haven't widely deployed Native Client so far is we're working on something called Portable Native Client, so you're not tied to any one particular instruction set, so people can build whole new CPUs, whole new chip architectures, and [applications] won't get tied to those."

Portable Native Client — aka PNaCl, pronounced "pinnacle" — is a means of distributing portable versions of Native Code executables across all processors. The idea is to compile C, C++, and other languages into the Low Level Virtual Machine (LLVM) bitcode format, which allows for client-side translation into the client's native instruction set.

OK. But for this to work across the web, other browser makers will still have to add the Native Client plug-in to their browsers. And it doesn't look like this will happen — at least not anytime soon. Portable or not, Native Client is not HTML, JavaScript, or CSS.

Opera chief standards officer Charles McCathieNevile argues that Native Client isn't a viable long-term technology because it runs counter to the web mission. One of the core notion of the web, MCathieNevile said, is to offer developers a relatively small set of tools they can use to build applications that run across as many machines as possible. If you native code into the mix, you lose the simplicity that comes from using a contained set of standards.

Mozilla argues that JavaScript is already approaching the speed of native code and that the gap is shirking rapidly.

Upson said he's sympathetic to such concerns. But he indicated that Google's main aim is to ensure that the web isn't dominated by proprietary technologies. "We don't want proprietary application platforms to take over [and this could happen if we] make the perfect the enemy of the good," he said. Presumably, "the perfect" is a world where applications are written in nothing but web standards, and "the good" is Native Client.

"We have a lot of C++ out there. We want to be able to use that without having to rewrite everything. Take a game that's already running on several platforms. You're not going to go and rewrite that in JavaScript. But what if you could very easily port that native code to the browser? We want to make that possible."

But unless the other browser-makers embrace the thing, you're only serving a portion of the web. ®

More about

TIP US OFF

Send us news


Other stories you might like