编译参数调整

使用指定分支同步仓库。

gclient config --unmanaged --name=src https://chromium.googlesource.com/chromium/src.git@refs/tags/49.0.2623.112

GYP 工程环境参数。

rem 创建 ninja 工程,创建用于调试的 vs 工程。
set GYP_GENERATORS = ninja,msvs-ninja

rem 2623 版本推荐使用 vs2013u4 或者 vs2015u1,由于 2015 问题较多,这里使用 2013 编译。
set GYP_MSVS_VERSION=2013
set GYP_MSVS_OVERRIDE_PATH=C:\Program Files (x86)\Microsoft Visual Studio 12.0

rem ninja 工程参数
rem properietary_codecs=1 开启私有解码器
rem ffmpeg_branding=Chrome 使用 Chrome 的 ffmpeg 设置,以支持 mp4。
set GYP_DEFINES=proprietary_codecs=1 ffmpeg_branding=Chrome

build\toolchain\win\BUILD.gn 修改 cc 和 cxx 编译选项

移除 /showIncludes 参数,增加 /WX- 参数强制关闭警告视为错误。

额外编译参数 /wd"4828" /wd"4819" /wd"4334"

如果使用 gpy 构建。修改 tools\gpy 工程默认编译参数。

diff --git a/pylib/gyp/generator/ninja.py b/pylib/gyp/generator/ninja.py
index d8a45c7d..e2e81f31 100644
--- a/pylib/gyp/generator/ninja.py
+++ b/pylib/gyp/generator/ninja.py
@@ -2013,12 +2022,12 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params,
     # By making the rules target separate pdb files this might be avoided.
     cc_command = ('ninja -t msvc -e $arch ' +
                   '-- '
-                  '$cc /nologo /showIncludes /FC '
-                  '@$out.rsp /c $in /Fo$out /Fd$pdbname_c ')
+                  '$cc /nologo /FC '
+                  '@$out.rsp /c $in /Fo$out /Fd$pdbname_c /wd"4828" /wd"4819" /wd"4334"')
     cxx_command = ('ninja -t msvc -e $arch ' +
                    '-- '
-                   '$cxx /nologo /showIncludes /FC '
-                   '@$out.rsp /c $in /Fo$out /Fd$pdbname_cc ')
+                   '$cxx /nologo /FC '
+                   '@$out.rsp /c $in /Fo$out /Fd$pdbname_cc /wd"4828" /wd"4819" /wd"4334"')
     master_ninja.rule(
       'cc',
       description='CC $out',

如果使用 gn 构建。修改默认编译配置。

diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index ab0d6c5f06a9..c0d528b8234b 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -744,6 +744,11 @@ config("default_warnings") {
       "/wd4457",
       "/wd4458",
       "/wd4459",
+
+      # Ignore warning.
+      "/wd4828",
+      "/wd4819",
+      "/wd4334",
     ]

     if (visual_studio_version == "2015") {
diff --git a/build/toolchain/win/BUILD.gn b/build/toolchain/win/BUILD.gn
index 4fb72797d5f2..0cafab919650 100644
--- a/build/toolchain/win/BUILD.gn
+++ b/build/toolchain/win/BUILD.gn
@@ -74,7 +74,7 @@ template("msvc_toolchain") {
       rspfile = "{{output}}.rsp"
       precompiled_header_type = "msvc"
       pdbname = "{{target_out_dir}}/{{label_name}}_c.pdb"
-      command = "ninja -t msvc -e $env -- $cl /nologo /showIncludes /FC @$rspfile /c {{source}} /Fo{{output}} /Fd$pdbname"
+      command = "ninja -t msvc -e $env -- $cl /nologo /FC @$rspfile /c {{source}} /Fo{{output}} /Fd$pdbname"
       depsformat = "msvc"
       description = "CC {{output}}"
       outputs = [
@@ -89,7 +89,7 @@ template("msvc_toolchain") {

       # The PDB name needs to be different between C and C++ compiled files.
       pdbname = "{{target_out_dir}}/{{label_name}}_cc.pdb"
-      command = "ninja -t msvc -e $env -- $cl /nologo /showIncludes /FC @$rspfile /c {{source}} /Fo{{output}} /Fd$pdbname"
+      command = "ninja -t msvc -e $env -- $cl /nologo /FC @$rspfile /c {{source}} /Fo{{output}} /Fd$pdbname"
       depsformat = "msvc"
       description = "CXX {{output}}"
       outputs = [

增加解码器支持

修改 third_party/ffmpeg 工程宏定义。

diff --git a/chromium/config/Chrome/win/ia32/config.asm b/chromium/config/Chrome/win/ia32/config.asm
index c8f9b45109..fbe7a8d94a 100644
--- a/chromium/config/Chrome/win/ia32/config.asm
+++ b/chromium/config/Chrome/win/ia32/config.asm
@@ -689,7 +689,7 @@
 %define CONFIG_G2M_DECODER 0
 %define CONFIG_GIF_DECODER 0
 %define CONFIG_H261_DECODER 0
-%define CONFIG_H263_DECODER 0
+%define CONFIG_H263_DECODER 1
 %define CONFIG_H263I_DECODER 0
 %define CONFIG_H263P_DECODER 0
 %define CONFIG_H264_DECODER 1
@@ -728,7 +728,7 @@
 %define CONFIG_MPEG_XVMC_DECODER 0
 %define CONFIG_MPEG1VIDEO_DECODER 0
 %define CONFIG_MPEG2VIDEO_DECODER 0
-%define CONFIG_MPEG4_DECODER 0
+%define CONFIG_MPEG4_DECODER 1
 %define CONFIG_MPEG4_CRYSTALHD_DECODER 0
 %define CONFIG_MPEG4_VDPAU_DECODER 0
 %define CONFIG_MPEGVIDEO_DECODER 0
@@ -1071,7 +1071,7 @@
 %define CONFIG_ASS_DEMUXER 0
 %define CONFIG_AST_DEMUXER 0
 %define CONFIG_AU_DEMUXER 0
-%define CONFIG_AVI_DEMUXER 0
+%define CONFIG_AVI_DEMUXER 1
 %define CONFIG_AVISYNTH_DEMUXER 0
 %define CONFIG_AVR_DEMUXER 0
 %define CONFIG_AVS_DEMUXER 0
@@ -1985,12 +1985,12 @@
 %define CONFIG_G729_PARSER 0
 %define CONFIG_GSM_PARSER 0
 %define CONFIG_H261_PARSER 0
-%define CONFIG_H263_PARSER 0
+%define CONFIG_H263_PARSER 1
 %define CONFIG_H264_PARSER 1
 %define CONFIG_HEVC_PARSER 0
 %define CONFIG_MJPEG_PARSER 0
 %define CONFIG_MLP_PARSER 0
-%define CONFIG_MPEG4VIDEO_PARSER 0
+%define CONFIG_MPEG4VIDEO_PARSER 1
 %define CONFIG_MPEGAUDIO_PARSER 1
 %define CONFIG_MPEGVIDEO_PARSER 0
 %define CONFIG_OPUS_PARSER 1
diff --git a/chromium/config/Chrome/win/ia32/config.h b/chromium/config/Chrome/win/ia32/config.h
index daefe2b6b0..ad8e63c657 100644
--- a/chromium/config/Chrome/win/ia32/config.h
+++ b/chromium/config/Chrome/win/ia32/config.h
@@ -1,7 +1,7 @@
 /* Automatically generated by configure - do not modify! */
 #ifndef FFMPEG_CONFIG_H
 #define FFMPEG_CONFIG_H
-#define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --disable-valgrind-backtrace --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vda --disable-vdpau --disable-videotoolbox --enable-decoder=vorbis --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav' --enable-parser='opus,vorbis' --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --toolchain=msvc --enable-yasm --extra-cflags=-I/cygdrive/d/src/chromium/src/third_party/ffmpeg/chromium/include/win --cc='cygwin-wrapper cl' --ld='cygwin-wrapper link' --nm='cygwin-wrapper dumpbin -symbols' --ar='cygwin-wrapper lib' --enable-decoder='aac,h264,mp3' --enable-demuxer='aac,mp3,mov' --enable-parser='aac,h264,mpegaudio'"
+#define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --disable-valgrind-backtrace --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vda --disable-vdpau --disable-videotoolbox --enable-decoder=vorbis --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav' --enable-parser='opus,vorbis' --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --toolchain=msvc --enable-yasm --extra-cflags=-I/cygdrive/d/src/chromium/src/third_party/ffmpeg/chromium/include/win --cc='cygwin-wrapper cl' --ld='cygwin-wrapper link' --nm='cygwin-wrapper dumpbin -symbols' --ar='cygwin-wrapper lib' --enable-decoder='aac,h264,mp3' --enable-demuxer='aac,mp3,mov' --enable-parser='aac,h264,mpegaudio' --enable-decoder=mpeg4 --enable-parser='h263,mpeg4video' --enable-demuxer=avi "
 #define FFMPEG_LICENSE "LGPL version 2.1 or later"
 #define CONFIG_THIS_YEAR 2016
 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg"
@@ -705,7 +705,7 @@
 #define CONFIG_G2M_DECODER 0
 #define CONFIG_GIF_DECODER 0
 #define CONFIG_H261_DECODER 0
-#define CONFIG_H263_DECODER 0
+#define CONFIG_H263_DECODER 1
 #define CONFIG_H263I_DECODER 0
 #define CONFIG_H263P_DECODER 0
 #define CONFIG_H264_DECODER 1
@@ -744,7 +744,7 @@
 #define CONFIG_MPEG_XVMC_DECODER 0
 #define CONFIG_MPEG1VIDEO_DECODER 0
 #define CONFIG_MPEG2VIDEO_DECODER 0
-#define CONFIG_MPEG4_DECODER 0
+#define CONFIG_MPEG4_DECODER 1
 #define CONFIG_MPEG4_CRYSTALHD_DECODER 0
 #define CONFIG_MPEG4_VDPAU_DECODER 0
 #define CONFIG_MPEGVIDEO_DECODER 0
@@ -1087,7 +1087,7 @@
 #define CONFIG_ASS_DEMUXER 0
 #define CONFIG_AST_DEMUXER 0
 #define CONFIG_AU_DEMUXER 0
-#define CONFIG_AVI_DEMUXER 0
+#define CONFIG_AVI_DEMUXER 1
 #define CONFIG_AVISYNTH_DEMUXER 0
 #define CONFIG_AVR_DEMUXER 0
 #define CONFIG_AVS_DEMUXER 0
@@ -2001,12 +2001,12 @@
 #define CONFIG_G729_PARSER 0
 #define CONFIG_GSM_PARSER 0
 #define CONFIG_H261_PARSER 0
-#define CONFIG_H263_PARSER 0
+#define CONFIG_H263_PARSER 1
 #define CONFIG_H264_PARSER 1
 #define CONFIG_HEVC_PARSER 0
 #define CONFIG_MJPEG_PARSER 0
 #define CONFIG_MLP_PARSER 0
-#define CONFIG_MPEG4VIDEO_PARSER 0
+#define CONFIG_MPEG4VIDEO_PARSER 1
 #define CONFIG_MPEGAUDIO_PARSER 1
 #define CONFIG_MPEGVIDEO_PARSER 0
 #define CONFIG_OPUS_PARSER 1

修改 third_party/ffmpeg 工程编译脚本。

diff --git a/ffmpeg_generated.gni b/ffmpeg_generated.gni
index 195e9c0b64..320898ffa8 100644
--- a/ffmpeg_generated.gni
+++ b/ffmpeg_generated.gni
@@ -94,6 +94,7 @@ if ((is_android && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "C
     "libavformat/rmsipr.c",
     "libavformat/url.c",
     "libavformat/vorbiscomment.c",
+    "libavformat/w64.c",
     "libavformat/wavdec.c",
     "libavutil/aes.c",
     "libavutil/aes_ctr.c",
@@ -368,7 +369,7 @@ if ((is_android && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "C
   ]
 }
 
-if ((is_linux && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "ChromeOS") || (is_linux && current_cpu == "arm" && ffmpeg_branding == "ChromeOS") || (is_linux && current_cpu == "arm64" && ffmpeg_branding == "ChromeOS") || (is_linux && current_cpu == "mipsel" && ffmpeg_branding == "ChromeOS") || (is_linux && current_cpu == "x64" && ffmpeg_branding == "ChromeOS") || (is_linux && current_cpu == "x86" && ffmpeg_branding == "ChromeOS")) {
+if ((is_linux && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "ChromeOS") || (is_linux && current_cpu == "arm" && ffmpeg_branding == "ChromeOS") || (is_linux && current_cpu == "arm64" && ffmpeg_branding == "ChromeOS") || (is_linux && current_cpu == "mipsel" && ffmpeg_branding == "ChromeOS") || (is_linux && current_cpu == "x64" && ffmpeg_branding == "ChromeOS") || (is_linux && current_cpu == "x86" && ffmpeg_branding == "ChromeOS") || (is_win && ffmpeg_branding == "Chrome")) {
   ffmpeg_c_sources += [
     "libavcodec/acelp_filters.c",
     "libavcodec/acelp_pitch_delay.c",
diff --git a/ffmpeg_generated.gypi b/ffmpeg_generated.gypi
index 06b415fad3..188f8858de 100644
--- a/ffmpeg_generated.gypi
+++ b/ffmpeg_generated.gypi
@@ -239,7 +239,7 @@
           'libavcodec/mips/vp8dsp_init_mips.c',
         ],
       }],  # (OS == "linux" and target_arch == "mipsel" and ffmpeg_branding == "Chrome") or (OS == "linux" and target_arch == "mipsel" and ffmpeg_branding == "ChromeOS") or (OS == "linux" and target_arch == "mipsel" and ffmpeg_branding == "Chromium") or (OS == "linux" and target_arch == "mipsel" and ffmpeg_branding == "ChromiumOS")
-      ['(OS == "linux" and target_arch == "arm" and arm_neon == 1 and ffmpeg_branding == "ChromeOS") or (OS == "linux" and target_arch == "arm" and ffmpeg_branding == "ChromeOS") or (OS == "linux" and target_arch == "arm64" and ffmpeg_branding == "ChromeOS") or (OS == "linux" and target_arch == "ia32" and ffmpeg_branding == "ChromeOS") or (OS == "linux" and target_arch == "mipsel" and ffmpeg_branding == "ChromeOS") or (OS == "linux" and target_arch == "x64" and ffmpeg_branding == "ChromeOS")', {
+      ['(OS == "linux" and target_arch == "arm" and arm_neon == 1 and ffmpeg_branding == "ChromeOS") or (OS == "linux" and target_arch == "arm" and ffmpeg_branding == "ChromeOS") or (OS == "linux" and target_arch == "arm64" and ffmpeg_branding == "ChromeOS") or (OS == "linux" and target_arch == "ia32" and ffmpeg_branding == "ChromeOS") or (OS == "linux" and target_arch == "mipsel" and ffmpeg_branding == "ChromeOS") or (OS == "linux" and target_arch == "x64" and ffmpeg_branding == "ChromeOS") or (OS == "win" and ffmpeg_branding == "Chrome")', {
         'c_sources': [
           'libavcodec/acelp_filters.c',
           'libavcodec/acelp_pitch_delay.c',
@@ -583,6 +583,7 @@
           'libavformat/rmsipr.c',
           'libavformat/url.c',
           'libavformat/vorbiscomment.c',
+          'libavformat/w64.c',
           'libavformat/wavdec.c',
           'libavutil/aes.c',
           'libavutil/aes_ctr.c',

修改 chromium 工程,移除无用代码。

diff --git a/ui/gl/BUILD.gn b/ui/gl/BUILD.gn
index eb46bd297077..6124af2d6241 100644
--- a/ui/gl/BUILD.gn
+++ b/ui/gl/BUILD.gn
@@ -34,8 +34,6 @@ component("gl") {
     "gl_bindings_autogen_gl.h",
     "gl_bindings_autogen_osmesa.cc",
     "gl_bindings_autogen_osmesa.h",
-    "gl_bindings_skia_in_process.cc",
-    "gl_bindings_skia_in_process.h",
     "gl_context.cc",
     "gl_context.h",
     "gl_context_android.cc",
diff --git a/ui/gl/gl.gyp b/ui/gl/gl.gyp
index afa2ad0fb5ab..6315010bda31 100644
--- a/ui/gl/gl.gyp
+++ b/ui/gl/gl.gyp
@@ -47,8 +47,6 @@
         'gl_bindings_autogen_gl.h',
         'gl_bindings_autogen_osmesa.cc',
         'gl_bindings_autogen_osmesa.h',
-        'gl_bindings_skia_in_process.cc',
-        'gl_bindings_skia_in_process.h',
         'gl_context.cc',
         'gl_context.h',
         'gl_context_android.cc',

修改 third_party\swiftshader,补充缺失定义。

typedef void *EGLSync;
typedef intptr_t EGLAttrib;