{"id":432,"date":"2019-01-17T09:12:53","date_gmt":"2019-01-17T09:12:53","guid":{"rendered":"http:\/\/blogs.igalia.com\/gyuyoung\/?p=432"},"modified":"2019-01-17T09:12:53","modified_gmt":"2019-01-17T09:12:53","slug":"the-story-of-the-webos-chromium-contribution-over-the-past-year","status":"publish","type":"post","link":"https:\/\/blogs.igalia.com\/gyuyoung\/2019\/01\/17\/the-story-of-the-webos-chromium-contribution-over-the-past-year\/","title":{"rendered":"The story of the webOS Chromium contribution over the past year"},"content":{"rendered":"<p>In this article, I share how I started webOS Chromium upstream, what webOS patches were contributed by LG Electronics, and how I&#8217;ve contributed to Chromium.<\/p>\n<p>First, let&#8217;s briefly describe the history of the webOS. WebOS was created by Palm, Inc. Palm Inc. was acquired by HP in 2010 and HP made the platform open source, so it then became open webOS. In January 2014 the operation system was sold to LG Electronics. LG Electronics has been shipping the webOS for their TV and signage products since. LG Electronics has also been spreading the webOS to more of their products.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blogs.igalia.com\/gyuyoung\/files\/2019\/01\/webos-logo-300x60.png\" alt=\"\" width=\"300\" height=\"60\" class=\"alignnone size-medium wp-image-536\" srcset=\"https:\/\/blogs.igalia.com\/gyuyoung\/files\/2019\/01\/webos-logo-300x60.png 300w, https:\/\/blogs.igalia.com\/gyuyoung\/files\/2019\/01\/webos-logo-768x152.png 768w, https:\/\/blogs.igalia.com\/gyuyoung\/files\/2019\/01\/webos-logo-1024x203.png 1024w, https:\/\/blogs.igalia.com\/gyuyoung\/files\/2019\/01\/webos-logo.png 1920w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/>   <img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blogs.igalia.com\/gyuyoung\/files\/2019\/01\/LG_webOS.jpg\" alt=\"\" width=\"421\" height=\"236\" class=\"alignnone size-full wp-image-532\" srcset=\"https:\/\/blogs.igalia.com\/gyuyoung\/files\/2019\/01\/LG_webOS.jpg 421w, https:\/\/blogs.igalia.com\/gyuyoung\/files\/2019\/01\/LG_webOS-300x168.jpg 300w\" sizes=\"auto, (max-width: 421px) 100vw, 421px\" \/><\/p>\n<p>The webOS uses Chromium to run web applications.  So, Chromium is a very important component in the webOS. As other Chromium embedders, the webOS also has many downstream patches. So, LG Electronics has tried to contribute own downstream patches to the Chromium open source project to reduce the effort to catch up to the latest Chromium version as well as to improve the quality of the downstream patches. As one of LG Electronics contractors for the last one and half years, I&#8217;ve started to work on the webOS Chromium contribution since September 2017. So, let&#8217;s start to explain the process of contributing:<\/p>\n<h3><strong>1. The Corporate CLA<\/strong><\/h3>\n<p>The Chromium project only accepts patches after the contributor signs a Contributor License Agreement (CLA). There are two kinds of CLA, one for individual and one corporate contributors. If a company signs the corporate CLA, then the individual contributors are exempt from signing an individual CLA, however, they must use their corporate email address as well as join the google group which was created when the corporate CLA was signed. LG Electronics signed up the corporate CLA and they were added to <a href=\"https:\/\/cs.chromium.org\/chromium\/src\/AUTHORS?q=author&amp;sq=package:chromium&amp;dr=C&amp;l=1012\">AUTHOR<\/a> file.<\/p>\n<ul>\n<li><strong><em>Corporate Contributor License Agreement<\/em><\/strong> (<a href=\"https:\/\/cla.developers.google.com\/about\/google-corporate\">Link<\/a>)<br \/>\n                                     <img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blogs.igalia.com\/gyuyoung\/files\/2018\/12\/CCLA-1024x542.jpg\" alt=\"\" width=\"640\" height=\"339\" class=\"alignnone size-large wp-image-438\" srcset=\"https:\/\/blogs.igalia.com\/gyuyoung\/files\/2018\/12\/CCLA-1024x542.jpg 1024w, https:\/\/blogs.igalia.com\/gyuyoung\/files\/2018\/12\/CCLA-300x159.jpg 300w, https:\/\/blogs.igalia.com\/gyuyoung\/files\/2018\/12\/CCLA-768x406.jpg 768w, https:\/\/blogs.igalia.com\/gyuyoung\/files\/2018\/12\/CCLA.jpg 1151w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<\/li>\n<li>\n<p><strong><em>Individual Contributor License Agreement<\/em><\/strong> (<a href=\"https:\/\/cla.developers.google.com\/about\/google-individual\">Link<\/a>)<br \/>\n                                     <img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blogs.igalia.com\/gyuyoung\/files\/2018\/12\/ICLA-1024x572.jpg\" alt=\"\" width=\"640\" height=\"358\" class=\"alignnone size-large wp-image-441\" srcset=\"https:\/\/blogs.igalia.com\/gyuyoung\/files\/2018\/12\/ICLA-1024x572.jpg 1024w, https:\/\/blogs.igalia.com\/gyuyoung\/files\/2018\/12\/ICLA-300x167.jpg 300w, https:\/\/blogs.igalia.com\/gyuyoung\/files\/2018\/12\/ICLA-768x429.jpg 768w, https:\/\/blogs.igalia.com\/gyuyoung\/files\/2018\/12\/ICLA.jpg 1127w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<\/li>\n<\/ul>\n<h3><strong>2. List upstreamable patches in webOS<\/strong><\/h3>\n<p>After finishing the registration of the corporate CLA, I started to list up upstreamable webOS patches. It seemed to me that there were two categories in the patches. One was new features for the webOS. The other one was bug fixes. In the case of new features, the patches were mainly to improve the performance or to make LG products like TV and signage use less memory. I tried to list upstreamable patches among those patches. The patch criteria was either to improve the performance or obtain a benefit on the desktop. I thought this would allow owners to accept and merge the patch into the mainline more easily.<\/p>\n<h3><strong>3. What patches have been merged to Chromium mainline?<\/strong><\/h3>\n<p>Before uploading webOS patches, I merged the patches to replace deprecated WTF or base utilities (WTF::RefPtr, base::MakeUnique) with c++ standard things. I thought that it would be good to show that LG Electronics started to contribute to Chromium. After replacing all of them, I could start to contribute webOS patches in earnest. I&#8217;ve since merged webOS patches to reduce memory usage, release more used memory under OOM, add a new content API to suspend\/resume DOM operation, and so on. Below is the list of the main patches I successfully merged.<\/p>\n<ol>\n<li><strong>New content API to suspend\/resume DOM operation<\/strong>\n<ul>\n<li><strong>Note:<\/strong> I added a content API to suspend\/resume DOM operation &#8211; <a href=\"https:\/\/cs.chromium.org\/chromium\/src\/content\/public\/browser\/webcontents.h?sq=package:chromium&amp;dr=CSs&amp;g=0&amp;l=910\">void PausePageScheduledTasks(bool paused)<\/a>. Embedders who only use the content API as the webOS can suspend or resume DOM operation using the PausePageScheduledTasks. The webOS has been using the API to suspend when web an application goes to the background. Then, it resumes the paused web application when it comes to the foreground. This API will be also useful for other embedders who only use the content API like the webOS.\n<ul>\n<li><a href=\"https:\/\/chromium-review.googlesource.com\/c\/chromium\/src\/+\/952642\">Support to suspend\/resume active page tasks of blink in the content layer<\/a> <\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong>Release more used memory under an out-of-memory situation<\/strong>\n<ul>\n<li><strong>Note:<\/strong> According to the Chromium performance bot, the patches to reduce the memory usage in RenderThreadImpl::ClearMemory could reduce the memory usage until 2MB in the background.<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blogs.igalia.com\/gyuyoung\/files\/2019\/01\/memory-reduce-lge-patch.png\" alt=\"\" width=\"950\" height=\"357\" class=\"alignnone size-full wp-image-467\" srcset=\"https:\/\/blogs.igalia.com\/gyuyoung\/files\/2019\/01\/memory-reduce-lge-patch.png 950w, https:\/\/blogs.igalia.com\/gyuyoung\/files\/2019\/01\/memory-reduce-lge-patch-300x113.png 300w, https:\/\/blogs.igalia.com\/gyuyoung\/files\/2019\/01\/memory-reduce-lge-patch-768x289.png 768w\" sizes=\"auto, (max-width: 950px) 100vw, 950px\" \/><\/p>\n<ul>\n<li><a href=\"https:\/\/chromium-review.googlesource.com\/c\/chromium\/src\/+\/910732\">Purge more cache data in RenderThreadImpl::ClearMemory<\/a><\/li>\n<li><a href=\"https:\/\/chromium-review.googlesource.com\/c\/chromium\/src\/+\/945748\">Make RenderThreadImpl::ReleaseFreeMemory call RenderThreadImpl::ClearMemory<\/a><\/li>\n<li><a href=\"https:\/\/chromium-review.googlesource.com\/c\/chromium\/src\/+\/1049414\">Call blink::WebMemoryCoordinator::OnPurgeMemory in RenderThreadImpl::ReleaseFreeMemory<\/a><\/li>\n<\/ul>\n<\/li>\n<li><strong>Note:<\/strong> OnMemoryPressure listener was added to the compositor layers through these patches. So, the compositor has been releasing more used memory under OOM through the OOM handler. In my opinion, this is very good contribution from the webOS.\n<ul>\n<li><a href=\"https:\/\/chromium-review.googlesource.com\/c\/chromium\/src\/+\/1000193\">Handle a low memory situation in LayerTreeHostImpl<\/a><\/li>\n<li><a href=\"https:\/\/chromium-review.googlesource.com\/c\/chromium\/src\/+\/1114559\">CC: Support the memory pressure handler in StagingBufferPool<\/a><\/li>\n<li><a href=\"https:\/\/chromium-review.googlesource.com\/c\/chromium\/src\/+\/1121949\">CC: Support the memory pressure handler in ResourcePool<\/a><\/li>\n<li><a href=\"https:\/\/chromium-review.googlesource.com\/c\/chromium\/src\/+\/1122016\">CC: Support the memory pressure handler in SoftwareImageDecodeCache<\/a><\/li>\n<li><a href=\"https:\/\/chromium-review.googlesource.com\/c\/chromium\/src\/+\/1121952\">CC: Support the memory pressure handler in GpuImageDecodeCache<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong>Introduce new command line switches for embedded devices<\/strong>\n<ul>\n<li><strong>Note:<\/strong> I&#8217;ve added command-line switches to tune memory limit or disk cache size through these patches. Other embedders can also customize the memory usage and disk cache size for their devices. The webOS has been tuned by using the command-line switches.\n<ul>\n<li><a href=\"https:\/\/chromium-review.googlesource.com\/c\/chromium\/src\/+\/968006\">Pass the skia resource cache limit in the command line to renderer processes.<\/a><\/li>\n<li><a href=\"https:\/\/chromium-review.googlesource.com\/c\/chromium\/src\/+\/989382\">Support to set the maximum decoded image bytes through a command line<\/a><\/li>\n<li><a href=\"https:\/\/chromium-review.googlesource.com\/c\/chromium\/src\/+\/961745\">Pass the skia font cache limit in the command line to renderer processes<\/a><\/li>\n<li><a href=\"https:\/\/chromium-review.googlesource.com\/c\/chromium\/src\/+\/974804\">Pass the maximum disk cache size of appcache in the command line to appcache thread<\/a><\/li>\n<li><a href=\"https:\/\/chromium-review.googlesource.com\/c\/chromium\/src\/+\/1282685\">AppCache: Add command-line flags for default quota and disk size.<\/a><\/li>\n<li><a href=\"https:\/\/chromium-review.googlesource.com\/c\/chromium\/src\/+\/1107517\">Pass the cache size in the command line to the ShaderDiskCache::CacheSizeBytes<\/a><\/li>\n<li><a href=\"https:\/\/chromium-review.googlesource.com\/c\/chromium\/src\/+\/1090512\">Introduce a new command-line switch to set the network timeout in FMP<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h3><strong>4. Trace LG Electronics contribution stats<\/strong><\/h3>\n<p>As more webOS patches have been merged to Chromium mainline, I thought that it would be good if we run a tool to chase all LG Electronics Chromium contributions so that LG Electronics&#8217;s Chromium contribution efforts are well documented. To do this I set up the LG Electronics Chromium contribution stats using the <a href=\"https:\/\/github.com\/tomgi\/git_stats\">GitStats<\/a> tool. The tool has been generating the stats every day.<\/p>\n<ul>\n<li><strong>The chart shows all contribution activity done by LG developers by date.<\/strong><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blogs.igalia.com\/gyuyoung\/files\/2019\/01\/chart-1.jpeg\" alt=\"\" width=\"1200\" height=\"800\" class=\"alignnone size-full wp-image-544\" srcset=\"https:\/\/blogs.igalia.com\/gyuyoung\/files\/2019\/01\/chart-1.jpeg 1200w, https:\/\/blogs.igalia.com\/gyuyoung\/files\/2019\/01\/chart-1-300x200.jpeg 300w, https:\/\/blogs.igalia.com\/gyuyoung\/files\/2019\/01\/chart-1-768x512.jpeg 768w, https:\/\/blogs.igalia.com\/gyuyoung\/files\/2019\/01\/chart-1-1024x683.jpeg 1024w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/li>\n<li><strong>The table shows LGE Chromium authors<\/strong><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blogs.igalia.com\/gyuyoung\/files\/2019\/01\/lge-chromium-stats.jpg\" alt=\"\" width=\"773\" height=\"746\" class=\"alignnone size-full wp-image-548\" srcset=\"https:\/\/blogs.igalia.com\/gyuyoung\/files\/2019\/01\/lge-chromium-stats.jpg 773w, https:\/\/blogs.igalia.com\/gyuyoung\/files\/2019\/01\/lge-chromium-stats-300x290.jpg 300w, https:\/\/blogs.igalia.com\/gyuyoung\/files\/2019\/01\/lge-chromium-stats-768x741.jpg 768w\" sizes=\"auto, (max-width: 773px) 100vw, 773px\" \/><\/li>\n<li><strong>URL of the tool. You can see the stats in the URL<\/strong><br \/>\n<a href=\"https:\/\/lgsvl.github.io\/lge-cr-stats\/authors\/lge_authors.html\">https:\/\/lgsvl.github.io\/lge-cr-stats\/authors\/lge_authors.html<\/a><\/li>\n<\/ul>\n<p>I was happy to work on the webOS upstream project over the past year.  It was challenging work because the downstream patch should show some benefits in Chromium mainline. I&#8217;m sure that LG Electronics will continue to keep contributing good patches to webOS and I hope they&#8217;re going to become a good partner as well as a contributor in Chromium.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, I share how I started webOS Chromium upstream, what webOS patches were contributed by LG Electronics, and how I&#8217;ve contributed to Chromium. First, let&#8217;s briefly describe the history of the webOS. WebOS was created by Palm, Inc. Palm Inc. was acquired by HP in 2010 and HP made the platform open source, [&hellip;]<\/p>\n","protected":false},"author":52,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-432","post","type-post","status-publish","format-standard","hentry","category-igalia-chromium"],"_links":{"self":[{"href":"https:\/\/blogs.igalia.com\/gyuyoung\/wp-json\/wp\/v2\/posts\/432","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.igalia.com\/gyuyoung\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.igalia.com\/gyuyoung\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.igalia.com\/gyuyoung\/wp-json\/wp\/v2\/users\/52"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.igalia.com\/gyuyoung\/wp-json\/wp\/v2\/comments?post=432"}],"version-history":[{"count":177,"href":"https:\/\/blogs.igalia.com\/gyuyoung\/wp-json\/wp\/v2\/posts\/432\/revisions"}],"predecessor-version":[{"id":621,"href":"https:\/\/blogs.igalia.com\/gyuyoung\/wp-json\/wp\/v2\/posts\/432\/revisions\/621"}],"wp:attachment":[{"href":"https:\/\/blogs.igalia.com\/gyuyoung\/wp-json\/wp\/v2\/media?parent=432"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.igalia.com\/gyuyoung\/wp-json\/wp\/v2\/categories?post=432"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.igalia.com\/gyuyoung\/wp-json\/wp\/v2\/tags?post=432"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}