第一章
webkit內核特征:
HTML解釋器,CSS解釋器,佈局,JavaScript引擎,繪圖、
看到的圖像:
HTML/CSS/JavaScript —-> 瀏覽器渲染引擎 —-> 圖像
1.3 webkit內核
1 介紹 webkit誕生於蘋果公司,從webkit分裂谷歌chromium出來Blink,
第 二 章 :HTML網頁和結構
1 網頁構成
1.1 基本元素
HTML網頁因為現在大多需要動態的,所以需要CSS和JavaScript,CSS:描述網頁顯示的信息,
JavaScript:控制網頁內部邏輯,一個完整的HTM網頁包括HTML、CSS、JavaScript。
1.2HTML5 新特性
最重要的是加入2D和3D圖形以及多媒體的支持,引入新元素“video”,以前我們需要Flash插件,現在隻需要加上
<video src="avidoe.mp4"></video>
2 網頁結構
2.1 框結構:將頁面分成幾個框,優點:對應關系清晰,缺點是不適合移動領域
層次結構:為新元素建新層,為瞭渲染方便和高效
2.2 webkit網頁渲染過程
渲染過程分三個階段,
第一:從網頁的URL到構建完DOM樹
二:從DOM樹到webkit的繪圖上下文,
三:從繪圖上下文到生成最終圖像
理解渲染過程
第 三章 webkit架構和模塊
3.1
1 webkit支持不同的操作系統,windows、mac OS、linux、Android
2 操作系統之上是各種第三方庫,包括2D、3D圖形庫、網絡庫、存儲、音頻、視頻庫
3 webCore是個各個瀏覽器使用webkit的共享部分:
主要是HTML解釋器、CSS解釋器、DOM、調試網頁、渲染樹
4 webkit中javascript引擎在chromium中被替換成V8
5 webkit ports為非共享部分
6 狹義webkit和webkit2接口
3.2基於Blink的chromium的瀏覽器架構
1
主要內容在content模塊
2 多進程模型:防止一個進程奔潰導致其他進程也無法工作
2.1 Renderer進程
網頁渲染進程,可配置渲染網頁的個數
2.2 NPAPI進程
NPAPI進程插件
2.3 GPU進程
對3D圖形加速調用
2.4 Pepper進程
為Pepper插件而創建
3 content接口
代碼:
drwxr-xr-x 15 yang.cao domain users 4096 Oct 25 08:55 .
drwxr-xr-x 61 yang.cao domain users 4096 Dec 26 20:54 ..
drwxr-xr-x 7 yang.cao domain users 4096 Oct 10 14:08 app
drwxr-xr-x 50 yang.cao domain users 12288 Oct 10 14:09 browser
-rw-r–r– 1 yang.cao domain users 3251 Oct 10 14:08 BUILD.gn
drwxr-xr-x 16 yang.cao domain users 12288 Oct 10 14:09 child
drwxr-xr-x 21 yang.cao domain users 12288 Oct 10 14:09 common
-rw-r–r– 1 yang.cao domain users 2298 Oct 10 14:09 content_app.gypi
-rw-r–r– 1 yang.cao domain users 114264 Oct 10 14:09 content_browser.gypi
-rw-r–r– 1 yang.cao domain users 3930 Oct 10 14:09 content_browsertests.isolate
-rw-r–r– 1 yang.cao domain users 14829 Oct 10 14:09 content_child.gypi
-rw-r–r– 1 yang.cao domain users 45700 Oct 10 14:09 content_common.gypi
-rw-r–r– 1 yang.cao domain users 1942 Oct 10 14:09 content_common_mojo_bindings.gyp
-rw-r–r– 1 yang.cao domain users 1642 Oct 10 14:09 content_gl_tests.isolate
-rw-r–r– 1 yang.cao domain users 403 Oct 10 14:09 content.gni
-rw-r–r– 1 yang.cao domain users 1069 Oct 10 14:09 content_gpu.gypi
-rw-r–r– 1 yang.cao domain users 21680 Oct 10 14:09 content.gyp
-rw-r–r– 1 yang.cao domain users 3794 Oct 10 14:09 content_jni.gypi
-rw-r–r– 1 yang.cao domain users 1231 Oct 10 14:09 content_nacl_nonsfi.gyp
-rw-r–r– 1 yang.cao domain users 1607 Oct 10 14:09 content_plugin.gypi
-rw-r–r– 1 yang.cao domain users 1150 Oct 10 14:09 content_ppapi_plugin.gypi
-rw-r–r– 1 yang.cao domain users 44280 Oct 10 14:09 content_renderer.gypi
-rw-r–r– 1 yang.cao domain users 7338 Oct 10 14:09 content_resources.grd
-rw-r–r– 1 yang.cao domain users 847 Oct 10 14:09 content_resources.gypi
-rw-r–r– 1 yang.cao domain users 749 Oct 10 14:09 content_shell_and_tests.gyp
-rw-r–r– 1 yang.cao domain users 42600 Oct 25 08:55 content_shell.gypi
-rw-r–r– 1 yang.cao domain users 754 Oct 10 14:09 content_shell_test_apk.isolate
-rw-r–r– 1 yang.cao domain users 95626 Oct 10 14:09 cont
4 chromium代碼結構
代碼:
drwxr-xr-x 17 yang.cao domain users 4096 Oct 10 14:08 android_webview
drwxr-xr-x 3 yang.cao domain users 4096 Oct 10 14:08 apps
drwxr-xr-x 30 yang.cao domain users 4096 Oct 10 14:08 ash
-rw-r–r– 1 yang.cao domain users 24976 Oct 10 14:08 AUTHORS
drwxr-xr-x 32 yang.cao domain users 12288 Oct 23 11:40 base
drwxr-xr-x 5 yang.cao domain users 4096 Oct 10 14:08 blimp
drwxr-xr-x 3 yang.cao domain users 4096 Oct 10 14:08 blink
drwxr-xr-x 4 yang.cao domain users 4096 Oct 10 14:08 breakpad
drwxr-xr-x 17 yang.cao domain users 4096 Oct 10 15:28 build
-rw-r–r– 1 yang.cao domain users 36667 Oct 10 14:08 BUILD.gn
drwxr-xr-x 18 yang.cao domain users 4096 Oct 10 14:08 cc
drwxr-xr-x 19 yang.cao domain users 4096 Oct 10 14:08 chrome
drwxr-xr-x 17 yang.cao domain users 4096 Oct 10 14:08 chromecast
drwxr-xr-x 5 yang.cao domain users 4096 Oct 10 14:08 chrome_elf
drwxr-xr-x 20 yang.cao domain users 4096 Oct 10 14:08 chromeos
-rw-r–r– 1 yang.cao domain users 1085 Oct 10 14:08 .clang-format
drwxr-xr-x 6 yang.cao domain users 4096 Oct 10 14:08 cloud_print
-rw-r–r– 1 yang.cao domain users 683 Oct 10 14:08 codereview.settings
drwxr-xr-x 144 yang.cao domain users 12288 Oct 10 14:08 components
drwxr-xr-x 15 yang.cao domain users 4096 Oct 25 08:55 content
drwxr-xr-x 4 yang.cao domain users 4096 Oct 10 14:09 courgette
drwxr-xr-x 3 yang.cao domain users 4096 Oct 10 14:09 crypto
drwxr-xr-x 2 yang.cao domain users 4096 Oct 10 14:09 dbus
-rw-r–r– 1 yang.cao domain users 25028 Oct 10 14:08 DEPS
drwxr-xr-x 14 yang.cao domain users 4096 Oct 10 14:09 device
drwxr-xr-x 2 yang.cao domain users 4096 Oct 10 14:09 docs
drwxr-xr-x 10 yang.cao domain users 4096 Oct 10 14:09 extensions
drwxr-xr-x 7 yang.cao domain users 4096 Oct 10 14:09 gin
-rw-r–r– 1 yang.cao domain users 305 Oct 10 14:08 .gitattributes
-rw-r–r– 1 yang.cao domain users 12726 Oct 10 14:08 .http://gitignore.org
-rw-r–r– 1 yang.cao domain users 7037 Oct 10 14:08 .gn
drwxr-xr-x 7 yang.cao domain users 4096 Oct 10 14:09 google_apis
drwxr-xr-x 2 yang.cao domain users 4096 Oct 10 14:09 google_update
drwxr-xr-x 13 yang.cao domain users 4096 Oct 10 14:09 gpu
drwxr-xr-x 4 yang.cao domain users 4096 Oct 10 14:09 infra
drwxr-xr-x 11 yang.cao domain users 4096 Oct 10 14:09 ios
drwxr-xr-x 3 yang.cao domain users 12288 Oct 10 14:09 ipc
drwxr-xr-x 4 yang.cao domain users 4096 Oct 10 14:09 jingle
-rw-r–r– 1 yang.cao domain users 1559 Oct 10 14:08 LICENSE
-rw-r–r– 1 yang.cao domain users 1571 Oct 10 14:08 LICENSE.chromium_os
drwxr-xr-x 6 yang.cao domain users 4096 Oct 10 14:09 mandoline
drwxr-xr-x 18 yang.cao domain users 4096 Oct 10 14:09 media
drwxr-xr-x 23 yang.cao domain users 4096 Oct 10 14:09 mojo
drwxr-xr-x 14 yang.cao domain users 4096 Oct 10 14:09 native_client
drwxr-xr-x 4 yang.cao domain users 4096 Oct 10 14:09 native_client_sdk
drwxr-xr-x 31 yang.cao domain users 4096 Oct 10 14:09 net
drwxr-xr-x 6 yang.cao domain users 4096 Dec 25 21:21 out
-rw-r–r– 1 yang.cao domain users 299 Oct 10 14:08 OWNERS
drwxr-xr-x 3 yang.cao domain users 4096 Oct 10 14:09 pdf
drwxr-xr-x 17 yang.cao domain users 4096 Oct 10 14:09 ppapi
-rw-r–r– 1 yang.cao domain users 71217 Oct 10 14:08 PRESUBMIT.py
-rw-r–r– 1 yang.cao domain users 3773 Oct 10 14:08 PRESUBMIT_test_mocks.py
-rwxr-xr-x 1 yang.cao domain users 35965 Oct 10 14:08 PRESUBMIT_test.py
drwxr-xr-x 5 yang.cao domain users 4096 Oct 10 14:09 printing
-rw-r–r– 1 yang.cao domain users 263 Oct 10 14:09 readme.gyp
drwxr-xr-x 15 yang.cao domain users 4096 Oct 10 14:09 remoting
drwxr-xr-x 9 yang.cao domain users 4096 Oct 10 14:09 rlz
drwxr-xr-x 5 yang.cao domain users 4096 Oct 10 14:09 sandbox
drwxr-xr-x 8 yang.cao domain users 4096 Oct 10 14:09 sdch
drwxr-xr-x 6 yang.cao domain users 4096 Oct 23 11:40 skia
drwxr-xr-x 4 yang.cao domain users 4096 Oct 10 14:09 sql
drwxr-xr-x 59 yang.cao domain users 4096 Jan 7 16:53 sraf
drwxr-xr-x 21 yang.cao domain users 4096 Jan 7 16:53 sraf_hbbtv
drwxr-xr-x 7 yang.cao domain users 4096 Jan 22 10:32 sraf_lms_client
drwxr-xr-x 4 yang.cao domain users 4096 Oct 10 14:09 storage
drwxr-xr-x 3 yang.cao domain users 4096 Oct 10 14:09 styleguide
drwxr-xr-x 14 yang.cao domain users 4096 Oct 10 14:09 sync
-rw-r–r– 1 yang.cao domain users 344 Dec 20 17:59 tags
drwxr-xr-x 13 yang.cao domain users 4096 Oct 10 14:09 testing
drwxr-xr-x 172 yang.cao domain users 4096 Oct 10 14:10 third_party
drwxr-xr-x 81 yang.cao domain users 4096 Oct 10 14:10 tools
drwxr-xr-x 36 yang.cao domain users 4096 Oct 10 14:10 ui
drwxr-xr-x 4 yang.cao domain users 4096 Nov 1 11:09 url
drwxr-xr-x 12 yang.cao domain users 4096 Oct 10 14:10 v8
-rw-r–r– 1 yang.cao domain users 70099 Oct 10 14:08 WATCHLISTS
drwxr-xr-x 6 yang.cao domain users 4096 Oct 10 14:10 win8
第4章 資源加載和網絡棧
1 資源:
HTML頁面
javascript代碼
圖片
視頻等
2 資源以URL為關鍵字來查找,相同的資源,不通URL,也認為不同的資源
3 資源加載器(webkit這樣設計,是想將復雜的資源分為多個簡單的步驟)
3.1 特定資源加載器,特點:隻加載一種資源
3.2 資源緩存機制的資源加載器-CacheResourceLoader,用來查找和插入緩存資源
3.3 通用加載器-ResourceLoader
4資源生命周期
4.1采用LRU(最近最少用算法)