Chromium Developer Documentation

Google Chrome is built with open source code from Chromium.

Except as otherwise noted, the content of this page is licensed under a Creative Commons Attribution 2.5 license, and examples are licensed under the BSD License.

Contributing Code


If you want to contribute code to Chromium, there are a few things you can do to make the process flow smoothly.

Communicate

  • Whether you're writing a new feature or fixing an existing bug, it pays to get a second opinion before you get too far. If it's a new feature idea, post to the appropriate discussion group and propose it.
  • Not all bugs in our bug system are assigned, but if the one you're interested in fixing is, send a note to the person it's assigned to and ask if they would like a patch.
  • All work done should be tracked in the bug system. Please file a bug and describe what you're doing if there isn't one already.

Get your code ready

  • Code must conform to the Chromium style guidelines.
  • Code must be tested, preferably with unit tests.
  • Patches should be a reasonable size to review. Giant patches are unlikely to get reviewed quickly.
  • Run the unit tests and the UI tests to make sure you haven't broken anything.
  • You must complete the Individual Contributor License Agreement. You can do this online, and it only takes a minute. If you are contributing on behalf of a corporation, you must fill out the Corporate Contributor License Agreement and send it to us as described on that page.
  • If you've never submitted code before, you must add your (or your organization's) name and contact info to the AUTHORS file.

Request a review

1. Find a reviewer. Ideally, the reviewer is someone who is familiar with the area of code you are touching. If you have doubts, look at the blame for the file to see who else has been editing it. Failing that, ask on #chromium on irc.freenode.net. You can also just request review from chromium-reviews@googlegroups.com, but more specific review requests will be attended to sooner.

2. Create a changelist. We use Subversion, but use some tools on top of it for the review and committing process. Make a changelist with the gcl change command. The changelist name is only to help you refer to it on your local computer, so call it whatever you want:

    C:\code\src\chromium> gcl change mychange

This will open your text editor. Write the change description at the top of the file. The description should describe what your patch changes and why. This is important for people who are looking at commit logs in the future to track down an issue: they should be able to see why you changed it without going anywhere else. You should also add a BUG=bug_number line at the end of the description so they can find the associated bug. Example:

    Increase the goat teleporter timeout threshold to 100 because the old
    value of 10 caused problems for extremely overweight goats. Tests show
    that the largest goat in existence should be teleported in 50ms, so...

    BUG=112358

Cut and paste the filenames above or below the divider to add files to or remove files from the changelist. You can use the gcl opened command to see your changed files and changelists:

    C:\code\src\chromium> gcl opened
    M       browser\browser.vcproj        this is a modified file not in any changelist

    --- Changelist mychange:
    M       browser\browser.cc

3. Upload your change. Use the gcl upload command:

    C:\code\src\chromium> gcl upload mychange
    Issue created. URL: http://codereview.chromium.org/123456
    Uploading browser\browser.cc (1/1)

You may have to enter a Google Account username and password (for example, your Gmail credentials). The URL it gives you is the page where the review can be accessed. If you want to upload a new copy of your patch, optionally add or remove files using gcl change and upload it again using the same gcl upload command.

Once you've uploaded your change and know its patch URL, add that to the bug comments.  That way someone coming along later can make comments or see how the bug was fixed.

4. Request review. Go to the supplied URL or just go to the main Chromium code review page and click Issues created by me.  Select the change you want to submit for review and click Edit Issue.  Enter at least one reviewer's email address and click Update Issue.  Now click on Publish+Mail Comments, add any optional notes, and send your change off for review. All Chromium code reviews are automatically cc'd to the chromium-reviews@googlegroups.com group, so that everyone has an opportunity to see and comment on the changes being made.

Note: If you don't see editing commands on the review page, click Log In in the upper right.

The review process

Chromium reviewers try to review code that conforms to these guidelines as quickly as possible. You should hear back within 24-48 hours. Remember though, if you submit a giant patch, or do a bunch of work without discussing it with the relevant people, you may have a hard time convincing anyone to review it! Speak with others early and often. Sometimes, the tree will be locked down and certain types of changes won't be allowed. This is true when we're preparing a release. During times like these, reviewers may be focused on fixing the bugs required to get the release out the door.

Remember that code reviews are an important part of the engineering process. The reviewer will almost always have suggestions or style fixes for you, and it's important not to take such suggestions personally or as a commentary on your abilities or ideas. This is a process where we work together to make sure that the highest quality code gets submitted!

You will likely get email back from the reviewer with comments. Fix these and update the patch set in the issue by re-running gcl upload as above. Once you're ready for another review, use Publish+Mail Comments again to send another notification (you can say something like "new snapshot uploaded").  When the reviewer is happy with your patch, they will say something like "OK" or "LGTM" ("Looks Good To Me").

Note: As you work through the review process, both you and your reviewers should converse using the code review interface, and send notes using Publish+Mail Comments.  Avoid the temptation to respond directly to review mails (or, for reviewers, to send review comments) directly from your email client; doing that won't add your comments to the online record for the issue under review, and can make it hard for others to understand later what the history of a patch was.

Check in your changes

  • If you have access to commit to the repository, once you've got a positive review ("OK" or "LGTM") you can go ahead and check in your code. Do this by running

        gcl commit changelist_name

    Resist the temptation to just run svn commit, since (a) this will by default submit everything modified and not just your changelist, and (b) gcl commit will automatically create a log message based on your issue description. The descriptions are very important for tracking which bugs were fixed and why a certain change was made.

  • If the most recent set of changes to the repository breaks Chromium, we say the tree is red, or closed.  You cannot check in your changes until it is green again.  Check  the BuildBot waterfall to see that the first three columns are green before checking in your changes.  Otherwise, you will not know if your changes break Chromium or not.

  • If you can't commit, ask the reviewer to commit your fix for you. They will patch their working copy with your changelist and commit it for you.

  • Reviewers: If you are committing a fix for a contributor who cannot do it themselves, you should credit the contributor in the log comment, e.g. "Patch by Joe Smith <foo@bar.com>". Make sure they're added to the AUTHORS file too.

Be responsible

  • Once you've checked something in, you're on the hook for making sure the BuildBot waterfall stays healthy, so stick around and watch them until everything cycles green. If you break something, you have to fix it. This includes tests and performance regressions. If you don't fix these things in a timely fashion, your change may be removed.
  • If you don't immediately know what's wrong, be pro-active and back out your change. Other engineers shouldn't have to wait for you to debug. When the tree is red, everyone is blocked. People can't check in, and people can't sync.
  • If you worked with a reviewer to commit your change, be on hand to address problems should they arise when the reviewer checks in your code.
  • Be available online (IRC and IM work) so that the sheriff can contact you if something goes wrong. The sheriff is responsible for keeping the tree open and changes moving through the system, which means correcting issues when they arise.

  Sign in   Home   Sitemap   Terms   Report Abuse   Print  |  Powered by Google Sites