1. 1Samsung Open Source Group
Chromium Contribution Process
Explained
a.k.a. Writing good patches
Adenilson Cavalcanti
MSc. BSc.
Samsung Open Source Group
a.cavalcanti@samsung.com (or
cavalcantii@chromium.org)
2. 2Samsung Open Source Group
Why Are We Here?
l Share some lessons learned while contributing to
Blink/Chromium (and other open source projects).
l Start the discussion about good practices.
l Explain some cultural aspects of the Chromium
community.
l Present tips and tricks of the trade.
3. 3Samsung Open Source Group
Presentation Structure
l Chromium contribution workflow explained.
l 5 Principles to make good contributions.
l Tips.
l Best practices working with Chromium team.
5. 5Samsung Open Source Group
The Workflow in a Nutshell
l Associate your @company email to a Google
account.
l Checkout and build.
l Implement a change.
l Create a branch.
l Run the tests.
l Push to remote.
l Kick the bots (or ask someone to do it).
l Ask for review.
6. 6
Create a Google Account
• Visit: https://accounts.google.com/SignUp
• Use your @company.com account.
• You will receive the validation link through your
email.
• The password can (and should) be different.
Samsung Open Source Group
10. 10Samsung Open Source Group
Patching
l Make a change, create a branch and commit:
l git checkout –b myFeature
l git commit -a -m “It does something.”
11. 11Samsung Open Source Group
Running Tests + Upload
l Layout tests:
l ./Tools/Scripts/run-webkit-tests --debug css3/filters
l Content tests:
l ./out/Debug/content_unittests | unit_tests
l If everything is ok (i.e. no regressions), upload
the patch:
l git cl upload
l Kick the bots:
l git cl try #Alternatively, use a browser to select bots
13. 13Samsung Open Source Group
Watching the Bots
Bots are computers that will apply your patch on
top of master and test (i.e. compilation, layout
tests, etc)
l You should receive emails about bot status.
l Investigate if a bot is red.
14. 14Samsung Open Source Group
Blink/Chromium: Gaining Status
Committer:
• Same as WebKit (30~40 non-trivial patches).
• Bonus if already a WebKit committer.
Owner:
• Have provided high quality reviews / design feedback.
• Be a Chromium project member for at least 6 months.
• Have submitted a substantial number of non-trivial changes.
• Had made changes to the affected directory within 90 days.
• Bandwidth to contribute with other owners.
16. 16Samsung Open Source Group
The Magic Secret to a Good Patch
l Answer these 5 questions.
17. 17Samsung Open Source Group
The 5 Magical Questions
l Does it improve performance?
l Is it an enabler for others?
l Is it spec compliant?
l Is it innovative?
l Does it fit the project architecture?
18. 18Samsung Open Source Group
If Everything Fails…
l Does it improve the performance?
l Is it an enabler for others?
l Is it spec compliant?
l Is it innovative?
l Does it fit the project architecture?
Does it at least cleanup the code remarkably?
19. 19
If the Answer is No…
Give up and try something different.
Samsung Open Source Group
20. 20Samsung Open Source Group
Final Consideration
l Submit something you are proud of.
l Put yourself in the reviewer’s shoes.
21. 21Samsung Open Source Group
Final Consideration
l Submit something you are proud of.
l Put yourself in the reviewer’s shoes.
Remember: you are putting your name on
the line in addition to your company image.
23. 23Samsung Open Source Group
Writing Good Commit Logs
l To be useful, a log must foremost describe why a
change was made (the what is obvious by
reading the code).
l Programmer types:
l poor programmers don’t write logs;
l good programmers write logs that need the code to
be understood;
l great programmers write logs that are self
explanatory and may include references to external
documentation.
24. 24Samsung Open Source Group
Writing Good Commit Logs
l Bad log: “fix bug and refactor.”
l Good log example:
25. 25Samsung Open Source Group
Commits Must Be Atomic
l Do one change (e.g. implementing one feature)
and resist the urge to add non-related things (e.g.
aesthetics, typos, etc).
l If you identified something else, open a new bug
to track the issue and submit another patch later.
26. 26Samsung Open Source Group
Quality X Quantity
l 3 good patches are much better than 15 obvious
ones.
28. 28Samsung Open Source Group
Self-Review Your Code
l When you are done, look for possible areas for
improvement.
l Try to find cases where it would fail.
l Does it scale up? Does it scale down?
29. 29Samsung Open Source Group
Know Thy Browser
l Have all browsers handy and know their behavior
for what you working on.
30. 30Samsung Open Source Group
Know the Code Style
l Before starting anything, read:
l https://www.chromium.org/developers/coding-style
l https://www.chromium.org/blink/coding-style
l Fix the mistakes pointed by ‘git cl upload’.
32. 32Samsung Open Source Group
Communication is King
l Think twice and formulate your thoughts in an
articulated way.
l If you have difficulties with English, prefer async
comm (e.g. mailing list).
l Go straight to the point, time is valuable.
l The way you speak may affect how reviewers
may perceive your ideas.
When using IRC:
33. 33Samsung Open Source Group
How to Ask Smart Questions*
l Do your homework:
l research;
l read available documentation;
l ask your team members;
l Write the question with a clear title.
l Proof read before posting.
l Add links to each relevant info you found (to
prove that at least you tried to find answers).
*Reference: http://catb.org/~esr/faqs/smart-questions.html
34. 34Samsung Open Source Group
Know the Time Zones
l The team is distributed (from Korea):
l California is 16 hours behind.
l Europe (UK) is 8 hours behind.
l Sometimes you will have to wake up earlier (or
wait for late night) to reach the right person.
35. 35Samsung Open Source Group
Observe Cultural Differences
l Code review is straight and to the point.
l The criticism is directed at the code, not at you as
a person.
l Any accepted contribution brings a cost for
maintenance and has to be within the high
standards of the project.
36. 36Samsung Open Source Group
Observe Cultural Differences
l USA: it is alright, OK.
l Russia: zero.
l Brazil: insult!
37. 37Samsung Open Source Group
Choose an Area and a Reviewer
l Select an area/subsystem to work on.
l Develop a relationship with one or two reviewers.
l Avoid jumping from one area to another as it will
impact your productivity and your potential
nomination to become a committer in the future.
38. 38Samsung Open Source Group
Use Bots Sparingly
l Bots consume resources and many queued jobs
slows down every single contributor.
l Only select 3 or 4 bots (e.g. mac, windows,
android, linux-debug) and submit the job if you
have tested it locally.
l Recently a developer almost had bot permissions
blocked because he was ‘trigger happy’.
40. 40Samsung Open Source Group
When to Duck
l Generally, the reviewers are right when they ask
for changes.
l Be grateful for the feedback and implement all
changes.
l Don’t push back or stall (especially if you are not
used to the subsystem you are working).
l Again: the reviewers are doing you a favor by
reviewing your patch.
42. 42Samsung Open Source Group
When to Hold Your Ground
l If you truly believe your idea makes sense and
have done great research.
l If you have data (e.g. benchmarks).
l When you can point to specs (W3C, WHATWG).
l When other browsers implement the same
behavior.
43. 43Samsung Open Source Group
The Job is Never Completed
l After a patch has landed, keep watching the bots
for any regressions:
l http://build.chromium.org/p/chromium/waterfall
l If you noticed that your patch is responsible for a
regression, ping the reviewer in IRC and discuss
what to do next.
44. 44Samsung Open Source Group
Check Your Email on the Weekends*
l It may happen that your contribution triggered a
regression and in such case you will be notified by
email.
l Promptly answer the email and start
investigating.
l If not possible, suggest to rollback the patch and
explain when you can start looking into the
subject.
*if you can’t, time your patches with
weekdays (e.g. Tuesday/Wednesday).
45. 45Samsung Open Source Group
Check Your Email on the
Weekends
This happened
in a Friday at 23hs!
46. 46Samsung Open Source Group
Follow the Mailing List
l Be aware of what is happening in the project as a
whole.
l Sign in to blink-dev and chromium-dev.
l Before starting something bigger, ask reviewers
what they think about it.