Google Chrome

As everyone already knows, Google released a new open-source web browser called Chrome.

Having interest in code reuse, I downloaded the source code and examined all the open-source libraries used.

Google Chrome browser shows excellent example of code reuse. I found that they use at least 25 different software libraries!

Here is the full list of libraries, along with relative paths to source code and short library descriptions. Many of the libraries have been patched by googlers; look for README.google files in each library directory for information about changes.

Library

Relative Path

Description

Google Breakpad

/src/breakpad

An open-source multi-platform crash reporting system.

Google URL

/src/googleurl

A small library for parsing and canonicalizing URLs.

Skia

/src/skia

Vector graphics engine.

Google v8

/src/v8

Google's open source JavaScript engine. V8 implements ECMAScript as specified in ECMA-262, 3rd edition, and runs on Windows XP and Vista, Mac OS X 10.5 (Leopard), and Linux systems that use IA-32 or ARM processors. V8 can run standalone, or can be embedded into any C++ application.

Webkit

/src/webki

Open source web browser engine.

Netscape Portable Runtime (NSPR)

/src/base/third_party/nspr

Netscape Portable Runtime (NSPR) provides a platform-neutral API for system level and libc like functions.

Network Security Services (NSS)

/src/base/third_party/nss

Network Security Services (NSS) is a set of libraries designed to support cross-platform development of security-enabled client and server applications. Applications built with NSS can support SSL v2 and v3, TLS, PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME, X.509 v3 certificates, and other security standards.

Hunspell

/src/chrome/third_
party/hunspell

Spell checker and morphological analyzer library and program designed for languages with rich morphology and complex word compounding or character encoding.

Windows Template Library

/src/chrome/third_party/wtl

C++ library for developing Windows applications and UI components. It extends ATL (Active Template Library) and provides a set of classes for controls, dialogs, frame windows, GDI objects, and more.

Google C++ Testing Framework

/src/testing/gtest

Google's framework for writing C++ tests on a variety of platforms (Linux, Mac OS X, Windows, Windows CE, and Symbian). Based on the xUnit architecture. Supports automatic test discovery, a rich set of assertions, user-defined assertions, death tests, fatal and non-fatal failures, various options for running the tests, and XML test report generation.

bsdiff and bspatch

/src/third_party/bsdiff and /src/third_party/bspatch

bsdiff and bspatch are tools for building and applying patches to binary files.

bzip2

/src/third_party/bzip2

bzip2 compresses files using the Burrows-Wheeler block sorting text compression algorithm, and Huffman coding.

International Components for Unicode (ICU)

/src/third_party/icu38

ICU is a mature, widely used set of C/C++ and Java libraries providing Unicode and Globalization support for software applications.

libjpeg

/src/third_party/libjpeg

Library for handling the JPEG (JFIF) image format.

libpng

/src/third_party/libpng

PNG image format library. It supports almost all PNG features, is extensible, and has been extensively tested for over 13 years.

libxml

/src/third_party/libxml

XML C parsing library.

libxslt

/src/third_party/libxslt

XSLT C library.

LZMA

/src/third_party/lzma_sdk

LZMA is the default and general compression method of 7z format in the 7-Zip program.

stringencoders

/src/third_party/modp_b64

A collection of high performance c-string transformations (in this case, base 64 encoding/decoding), frequently 2x faster than standard implementations (if they exist at all).

Netscape Plugin Application Programming Interface (NPAPI)

/src/third_party/npapi

Cross-platform plugin architecture used by many web browsers.

Pthreads-w32

/src/third_party/pthread

Application programming interface (API) for writing multithreaded applications

SCons - a software construction tool

/src/third_party/scons

Open Source software construction tool—that is, a next-generation build tool. Think of SCons as an improved, cross-platform substitute for the classic Make utility with integrated functionality similar to autoconf/automake and compiler caches such as ccache.

sqlite

/src/third_party/sqlite

Software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine.

TLS Lite

/src/third_party/tlslite

Free Python library that implements SSL 3.0, TLS 1.0, and TLS 1.1. TLS Lite supports non-traditional authentication methods such as SRP, shared keys, and cryptoIDs in addition to X.509 certificates. Note: Python is not a part of Chrome. It's used for testing various parts of Chrome browser, such as code coverage, dependencies, measures page load times, compares generated html, etc.

zlib

/src/third_party/zlib

zlib is designed to be a free, general-purpose, legally unencumbered -- that is, not covered by any patents -- lossless data-compression library for use on virtually any computer hardware and operating system.

They have done a really good job making these libraries work together. As someone said, "good coders code, great reuse."

I also found some other exciting things in the source, which I will soon post about. I recommend that you subscribe to my rss feed, if you are interested!

Talking about Chrome, I am waiting for Google to add capability to write extensions for their browser! I already made a list of extensions that I will try to create as soon as they add this feature.

Comments

September 05, 2008, 10:20

Excellent collection of data.

Inspiring too. Yep, that guy said it well when he said "Good coders code, great reuse!" :)

Just curious, who said it?

Peter Hickman Permalink
September 05, 2008, 10:23

You have listed Netscape Portable Runtime (NSPR) twice, once at 6 and again at 8.

September 05, 2008, 10:54

Srikanth, I don't know who said that! I just remember that I read somewhere "good coders code, great reuse" and it stuck in my memory. When I created my blog, I tried searching for the article but could not find it anymore!

Peter, thanks, I corrected that mistake.

Vipsy Permalink
September 05, 2008, 10:59

I found several other libraries too in code.
Dont know, if they are used directly or required by other tools/libs.
Not sure why you did not mention them.

bsdiff
bspatch
lighttpd
pthread
cygwin

September 05, 2008, 11:11

Vipsy, I surely did mention bsdiff, bspatch and pthread! I did not mention cygwin and lighttpd as they are not libraries...

Vipsy Permalink
September 05, 2008, 11:40

My Bad..
I did not read it thoroughly.

Grrr Permalink
September 05, 2008, 11:46

"Windows Template Library" links to hunspell.

September 05, 2008, 11:53

Grrr, oops, this is what happens when copying and pasting pieces of html code repeatedly... Corrected now! Thanks!

September 05, 2008, 11:58

Umm, but they just copied the libraries inside their own tree? That's good?

September 05, 2008, 13:19

v, the licenses of the libraries they used allowed Google to include them in their source tree!

September 05, 2008, 13:26

s/scr/src/g

September 05, 2008, 13:34

me, hehe, collaborative mistake correction is going on here. Thanks, I s/scr/src/g'ed.

AuburnFan Permalink
September 05, 2008, 13:48

Excellent blog post!!

Do you see anywhere in the code where Google collects browsing habits of the user?

September 05, 2008, 14:08

hi there,

I look forward to your list of plugins you want to develop for Google Chrome.

BR,
~A

September 05, 2008, 15:15

http://code.google.com/chromium/terms.html

September 05, 2008, 15:22

Thanks for your comment, Dmitry. I did know about this page before I posted... Only later did I find out it existed (from reddit comments)!

Jim Jones Permalink
September 05, 2008, 15:37

I played with Chrome all day yesterday and my conclusion is that FireFox3 kicks Chrome to the curb!

Jeff
[spammy url removed]

ulzha Permalink
September 05, 2008, 15:55

Labais

September 05, 2008, 16:21

Great read.

jon Permalink
September 05, 2008, 16:46

um...hows this reuse different from most other FOSS projects? Or is this another one of those "hey look at what everyone already knows" blogs

September 05, 2008, 16:57

jon, you are welcome to see if it is one of the "what everyone knows blogs" by browsing around a little!

300baud Permalink
September 05, 2008, 17:50

A Python library, but no libpython? How does that work? Do they compile it to their JS VM's bytecode?

September 05, 2008, 18:05

An add-op API was the first thing I was looking for and I was pretty disappointed to find none. I hope this was at least taken into account during their design otherwise I don't think it will be easy to come up with a good add-on API and framework later. There are some concerns with their EULA too...

September 05, 2008, 18:19

300 baud, I should have been more precise in my post. They use a lot of Python for testing various parts of Chrome, such as code coverage, dependencies, measures page load times, compares generated html, etc. I am updating the post now

300baud Permalink
September 05, 2008, 18:26

I guess I should have figured out that the build time required python by the presence of scons. Was just hoping there was a python interpreter buried in the browser someplace.

September 05, 2008, 18:42

You list "gzip2", but I think you meant bzip2...

September 05, 2008, 18:46

Does skia mean it handles svg natively?

September 05, 2008, 19:14

I think you are just stroking Google's ego. Many applications written for Linux use most of these libs. Rather, you might as well change your article's title to "Google Chrome Browser uses many libraries".

September 05, 2008, 19:15

Adam, I have not yet examined skia that closely, as it seems that it was first released just with Chrome. I will look into it in the next few days.

Thanks for noticing the mistake, i corrected that!

Greg Permalink
September 05, 2008, 21:06

Talent imitates, but genius steals. - T.S. Elliott.

September 05, 2008, 22:11

Wow, very nice summary of the programming aspect of Chrome. Wonder why lighttpd is being used?

September 05, 2008, 23:45

I really like the huge techie/blogger reaction that Google Chrome has caused. Everyone is tinkering and reviewing it.

Bob Foster Permalink
September 06, 2008, 01:24

That's along the lines of "Good designers borrow; great designers steal."

September 06, 2008, 09:29

The quote is, "Good composers borrow, great composers steal." It's attributed to Igor Stravinsky. Stravinsky, true to his word, stole the phrase from T.S. Eliot, who wrote, "Good poets borrow, great poets steal." Or perhaps from Pablo Picasso, who is reported to have said, "Good artists copy, great artists steal."

September 08, 2008, 19:44

You folks are missing the point. The original (and unsourced) quote attributed to Picaso has lost its meaning in the translation. When he said "good artists copy, great artists steal" it was saying that good artists make a copy of the subject as they see it, but a great artist takes the subject and makes it their own through their own interpretation, enhancements, etc. To reuse a library is simply to borrow, and is naught but a nod toward expedience. Taking those libraries and improving on them or using them in a synergistic way that goes beyond their original purpose, that would be great artistry.

September 12, 2008, 09:30

hello.
in there,chrome tips and tricks collections.
http://eurekatips.com/2008/09/10/google-chrome-tips-and-tricks-collections/

Akash Jee Permalink
September 13, 2008, 04:49

Chrome Browser very good Browser,
i like it,
Thanks for make it.

September 16, 2008, 13:08

i keep learning about more and more little advantages and features with Chrome, with privacy, for example; now if only they would take care of it's cookie management glitches...

September 21, 2008, 00:09

it's funny, the more i use Chrome (for windows), the more unstable it seems to get... crashes a lot more, can't handle sites with flash, hangs every time i close a tab... all that to say, i'm switching back to Firefox

Lewis Permalink
September 26, 2008, 14:04

I keep reading Good Artist... Talent imitates... and stealing. I see that Chrome, although it hasn't replace firefox... yet, has some great potential. But I think it's also created with a conscience, you cannot steal what is given away freely.

October 13, 2008, 14:14

They're using Mozilla's code which they're using against them actually because Chrome will take over Mozilla's market once it's fully developed.

December 05, 2008, 18:17

Peter, How can I miss this famous post; really a great collection of data. Thanks mate.

December 18, 2008, 19:50

Chrome Browser very good Browser,
i like it!!!

Axel

December 29, 2008, 14:54

Yes, code reuse is great when you know the code (so you can assure its good code) or when it comes from Google (haha just kidding)!

Nice set of toolkits at the Chrome browser! C++ is beautiful

shohug Permalink
December 31, 2008, 08:19

i want to change the chache directory of chrome using c/c++. i will be gratefull if anyone help me with code.

top Permalink
February 08, 2009, 21:40

ya " Nice set of toolkits at the Chrome browser! C++ is beautiful "

thanku man thanks to google

February 25, 2009, 11:51

Well, technically, Google chrome *isn't* performing code reuse. It both is and it isn't.

Googles 'reuse' is right on par ( as far as linux is concerned at least ) with people copy-pasting code all over their program, and this really is poor.

I downloaded the source a while back when it first came out and discovered lots of the libraries included with it, but this is *not* the way to do things.

At that stage the backend was alleged to compile, but their methodology was completely back to front. Their build system mostly entails rebuilding all those libraries they bundled in with chrome, albeit with their special build system, with their special patches to these libraries.

And this is something most windows centric devs just don't understand, because they don't have much of a concept of shared libraries and what they bring to the party.

Building google-special versions of dozens of libraries does nothing but send opensource development backwards, because it increases the number of copies of libraries with the exact same name, and the exact same purpose on your system needlessly, which both 1) wastes lots of build time 2) wastes disk space, 3) wastes memory with the multiple copies of libraries in ram 4) reduces security by not working with the *existing* system libraries which are tailored to the system.

Granted on windows you're not likely to have all the dependencies needed to make it tick, but there's no good reason to bundle these in chromes source.

They should be installed separately, possibly as a bundle, and built against the sources, that are provided pristine from upstream, and if something in a library is not to your liking, report a bug, get it fixed, and help the rest of us out instead of just going out and doing things different in progressively backwards and unmaintainable ways.

We people on Linux have solved the issue of 3rd party libraries years ago, so just put in dependences and let the distros install them and then use those.

sorry, can't continue line of thought, distractions broke the rant, so it may lose coherence near the end.

March 29, 2009, 00:06

Chrome Browser very good Browser,
i like it!!!

April 16, 2009, 16:09

Chrome Browser very good Browser,
i like it!!!

May 24, 2009, 21:26

ya ” Nice set of toolkits at the Chrome browser! C++ is beautiful ”

thanku man thanks to google

August 06, 2009, 17:18

Yeah, I read about it a while ago. Still, Chrome rocks!

David

Martin Permalink
January 14, 2010, 18:00

@Kent Fredric:

Great comment! I understand your point, what google just did is they made a rod for their own back. If some serious bug will be discovered in those libraries, or some great advancments will be done, they will have two incompatible versions, and they will have to do much on their own to fix or change the library.

June 21, 2010, 13:26

Thanks for posting all of this!

July 13, 2010, 22:56

Thanks for posting all of this source code, very helpful! :-)

Orfebre Permalink
July 31, 2010, 03:38

Understand your point, what google just did is they made a rod for their own back.

Steven Horton Permalink
September 26, 2011, 17:27

The last three comments on this comment are utterly bizarre.

Anyways, thanks for the article, I didn't understand what your title quote meant until now. :)

January 07, 2014, 17:25

want to edit code of chrome about CSP & Same Origin Policy how to find those file-no where mentioned which function is where

I could not find proper documentation which explains it clearly
now I am playing guessing game and even I look at the Content security policy code how would I know that I am reading that.

Leave a new comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Type the word "server_93": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.

Advertisements