现在的位置: 首页 > 综合 > 正文

初步了解Google Blink

2017年01月23日 ⁄ 综合 ⁄ 共 2235字 ⁄ 字号 评论关闭
Chromium Blink基于WebKit而来,从2008年Google开发自己的浏览就选择参与了WebKit社区。当自己还弱小时最优的方式就是与WebKit保持同步。最明确的证据就是在自立门户之前buildbot上提供了chrome-release-webkit-latest功能, 自动使用最新的WebKit进行编译。
在实现上,尽量利用WebKit的各式client完成功能,再通过一层WebKit Glue (现在是Blink Public API)来封装,以便上层使用。这样就将WebKit包成了一个对外透明的模块。相对整个WebKit工程的目录结构如下:
          
但当两年过去,Goolge工程师渐渐成了WebKit社区的主要贡献者,再后面都超越了WebKit的东家:Apple。有下图为证(WebKit通过Review的提交数量):
Google的团队就这样长大了!
于是他们发现Apple管得太严了,兼容各类平台导致代码改动困难。还有Google不想将自己实现的多进程架构贡献给WebKit,反正各种不爽!是时候了,于是Google在2013年4月,Blink就诞生了。 一家老牌的浏览器开发商Opera随后就表示将使用Blink进行浏览器开发(PC版),和当年Google一样觉得背靠大树好乘凉啊。(其后不久, Mozilla也宣布与Sumsung联合研发下一代渲染引擎Servo。)
Blink的推进步骤是先移除自己不需要的代码(毕竟WebKit的贡献者比较多,兼容很多平台),可谓轻装上阵,然后再将代码稳定到一定程度:
we anticipate that we’ll be able to remove 7 build systems and delete more than 7,000 files—comprising more than 4.5 million lines—right off the bat. Over the long term a healthier codebase leads to more stability and fewer bugs.
然后再推动一系列结合自身需求的创新:
1. Out-Of-Process iFrames (进行中)
2. Fix networking code to be faster and simpler (已经算是比较完整的实现了)
3. Move DOM in JS (进行中)
4. Others:
  • Move code to use the sandbox Platform API directly instead of WebCore/platform where possible (DONE)
  • Establish a simpler, stricter tree-gardening system that does not require 2 full time engineers per day (DONE)
  • Replace WebKitIDL with WebIDL (DONE)
  • Teach WebCore about multi-process history (currently it assumes same-process synchronous History access)
  • Delete the Widget tree (a Mac WebKit1 constraint)
  • Split WebCore into modules
  • Experiment with moving the DOM into the JS heap
  • Increase multicore use (e.g., html parser, style engine, javascript parser)
  • Remove obscure parts of the DOM and make backwards-incompatible changes to obscure parts of the DOM that benefit performance or remove complexity.
  • Use a modern, faster tcmalloc throughout all of Mac chrome
  • Experiment with incremental or parallel layout
  • Fix memory leaks by removing the ScriptValue/ScriptState abstractions now that there’s only one JavaScript engine.
  • Remove custom JavaScript bindings code
  • Bring WebCore up to speed with DOM3 Events / [DOM] UI Events.
Blink团队也意识到最大的问题开源于推动Web技术发展与保持兼容性之间的矛盾。他们通过分别评估,最终加以平衡的方法来时行决策。最理想的情况当然是既推动了Web技术发展,又没有任何兼容性风险。
从Blink的演变过程来看,和咱们中国的技术拷贝过程是相似的。能力弱的时候参与到社区中,充分利用别人的成果(拿来主义)。当时机成熟后(团队培养好了,未来规划也完备了),另起炉灶。国内选择基于Chromium进行开发的团队越来越多,但不是所有人都能像Google那样进展到第二步的。项目是开源的,一切都是自由的,至于能得到什么,拼的还是实力,特别是团队整体的实力!
参考:
Blink’s Mission:
To improve the open web through 
technical innovation and good citizenship

抱歉!评论已关闭.