aboutsummaryrefslogtreecommitdiffstats
path: root/community/chromium
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2018-07-12 12:14:52 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2018-07-30 05:20:27 +0000
commit2f448dd87466e2cf21a93eca35c167c983e3ac7a (patch)
treeacb9c69db2192a4518a52bbb0971dfae9756155f /community/chromium
parent495bbd7fb1f07c23a1f2d47a071aa5519e08744c (diff)
downloadaports-2f448dd87466e2cf21a93eca35c167c983e3ac7a.tar.bz2
aports-2f448dd87466e2cf21a93eca35c167c983e3ac7a.tar.xz
community/chromium: upgrade to 66.0.3359.181
Diffstat (limited to 'community/chromium')
-rw-r--r--community/chromium/APKBUILD106
-rw-r--r--community/chromium/add-missing-blink-tools.patch1071
-rw-r--r--community/chromium/chromium-48.0.2564.116-libusb_interrupt_event_handler.patch15
-rw-r--r--community/chromium/chromium-60.0.3112.78-gn-system.patch221
-rw-r--r--community/chromium/chromium-60.0.3112.78-jpeg-nomangle.patch14
-rw-r--r--community/chromium/chromium-60.0.3112.78-no-libpng-prefix.patch17
-rw-r--r--community/chromium/chromium-60.0.3112.78-no-zlib-mangle.patch13
-rw-r--r--community/chromium/chromium-clang-r2.patch21
-rw-r--r--community/chromium/chromium-clang-r3.patch19
-rw-r--r--community/chromium/chromium-gcc-r1.patch14
-rw-r--r--community/chromium/chromium-skia-harmony.patch77
-rw-r--r--community/chromium/gcc6.patch13
-rw-r--r--community/chromium/gn_bootstrap.patch76
-rw-r--r--community/chromium/no-execinfo.patch22
-rw-r--r--community/chromium/secure_getenv.patch31
15 files changed, 1346 insertions, 384 deletions
diff --git a/community/chromium/APKBUILD b/community/chromium/APKBUILD
index 5fbfa32c15..f7701c38ec 100644
--- a/community/chromium/APKBUILD
+++ b/community/chromium/APKBUILD
@@ -1,8 +1,8 @@
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
pkgname=chromium
-pkgver=64.0.3282.168
-pkgrel=2
+pkgver=66.0.3359.181
+pkgrel=0
pkgdesc="chromium web browser"
url="http://www.chromium.org/"
arch="x86_64"
@@ -17,6 +17,8 @@ makedepends="$depends_dev
bsd-compat-headers
bzip2-dev
cairo-dev
+ clang
+ clang-dev
cups-dev
dbus-glib-dev
eudev-dev
@@ -26,7 +28,7 @@ makedepends="$depends_dev
freetype-dev
gnutls-dev
gperf
- gtk+-dev
+ gtk+3.0-dev
gzip
harfbuzz-dev
hunspell-dev
@@ -37,6 +39,7 @@ makedepends="$depends_dev
libbsd-dev
libcap-dev
libelf-dev
+ libevent-dev
libexif-dev
libgcrypt-dev
libgnome-keyring-dev
@@ -59,10 +62,12 @@ makedepends="$depends_dev
ninja
nodejs
nss-dev
+ opus-dev
paxmark
pciutils-dev
perl
python2
+ re2-dev
snappy-dev
speex-dev
sqlite-dev
@@ -84,7 +89,6 @@ source="https://commondatastorage.googleapis.com/chromium-browser-official/$pkgn
chromium-widevine.patch
default-pthread-stacksize.patch
- gcc6.patch
gn_bootstrap.patch
last-commit-position.patch
musl-fixes.patch
@@ -98,11 +102,11 @@ source="https://commondatastorage.googleapis.com/chromium-browser-official/$pkgn
unset-madv_free.patch
swiftshader.patch
secure_getenv.patch
- chromium-48.0.2564.116-libusb_interrupt_event_handler.patch
- chromium-60.0.3112.78-gn-system.patch
- chromium-60.0.3112.78-jpeg-nomangle.patch
- chromium-60.0.3112.78-no-libpng-prefix.patch
- chromium-60.0.3112.78-no-zlib-mangle.patch
+ chromium-clang-r2.patch
+ chromium-clang-r3.patch
+
+ chromium-gcc-r1.patch
+ chromium-skia-harmony.patch
"
builddir="$srcdir"/$pkgname-$pkgver
@@ -140,22 +144,20 @@ prepare() {
mkdir -p third_party/node/linux/node-linux-x64/bin
ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/
-}
-_gn_flags() {
- echo $*
-}
-
-build() {
- cd "$builddir"
# reusable system library settings
local use_system="
+ fontconfig
flac
libdrm
+ libevent
libjpeg
libpng
libwebp
+ libxml
libxslt
+ opus
+ re2
snappy
yasm
zlib
@@ -165,27 +167,40 @@ build() {
find -type f -path "*third_party/$_lib/*" \
\! -path "*third_party/$_lib/chromium/*" \
\! -path "*third_party/$_lib/google/*" \
+ \! -path './base/third_party/icu/*' \
+ \! -path './third_party/pdfium/third_party/freetype/include/pstables.h' \
+ \! -path './third_party/yasm/run_yasm.py' \
\! -regex '.*\.\(gn\|gni\|isolate\|py\)' \
-delete
done
+# freetype
+# harfbuzz-ng
# pdfium uses internal headers in freetype
# we copy from freetype sources
# https://bugs.chromium.org/p/pdfium/issues/detail?id=733
# should be fixed in freetype:
# https://savannah.nongnu.org/bugs/index.php?51156
- mkdir -p "third_party/freetype/src/src/psnames/"
- cp "$srcdir"/pstables-2.8.h third_party/freetype/src/src/psnames/pstables.h
+# mkdir -p "third_party/freetype/src/src/psnames/"
+# cp "$srcdir"/pstables-2.8.h third_party/freetype/src/src/psnames/pstables.h
# Work around bug in v8 in which GCC 6 optimizes away null pointer checks
# https://bugs.chromium.org/p/v8/issues/detail?id=3782
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69234
- CFLAGS="$CFLAGS -fno-delete-null-pointer-checks"
+# CFLAGS="$CFLAGS -fno-delete-null-pointer-checks"
msg "Replacing gyp files"
python build/linux/unbundle/replace_gn_files.py --system-libraries \
${use_system}
third_party/libaddressinput/chromium/tools/update-strings.py
+}
+
+_gn_flags() {
+ echo $*
+}
+
+build() {
+ cd "$builddir"
##############################################################
# Please dont use these keys outside of Alpine Linux project #
@@ -194,50 +209,67 @@ build() {
##############################################################
eval "$(base64 -d < $srcdir/google-api.keys)"
+ export CC=clang
+ export CXX=clang++
+
msg "Bootstrapping GN"
- local _c=$(_gn_flags is_clang=false \
+ local _c=$(_gn_flags is_clang=true \
use_sysroot=false \
treat_warnings_as_errors=false \
fatal_linker_warnings=false \
binutils_path=\"/usr/bin\" \
- use_gconf=false \
- use_gold=true \
+ use_gold=false \
use_allocator=\"none\" \
use_allocator_shim=false \
)
- python tools/gn/bootstrap/bootstrap.py --gn-gen-args "$_c"
+ AR="ar" CC="$CC" CXX="$CXX" LD="$CXX" \
+ python tools/gn/bootstrap/bootstrap.py -s -v --no-clean --gn-gen-args "$_c"
+ msg "Configuring build"
_c=$(_gn_flags \
+ clang_use_chrome_plugins=false \
+ custom_toolchain=\"//build/toolchain/linux/unbundle:default\" \
+ enable_hangout_services_extension=true \
enable_hotwording=false \
enable_nacl=false \
enable_nacl_nonsfi=false \
enable_precompiled_headers=false \
+ enable_widevine=true \
+ fatal_linker_warnings=false \
ffmpeg_branding=\"Chrome\" \
fieldtrial_testing_like_official_build=true \
+ gold_path=\"/usr/bin/ld.gold\" \
google_api_key=\"$_google_api_key\" \
google_default_client_id=\"$_google_default_client_id\" \
google_default_client_secret=\"$_google_default_client_secret\" \
- is_clang=false \
+ host_toolchain=\"//build/toolchain/linux/unbundle:default\" \
+ icu_use_data_file=true \
+ is_clang=true \
is_debug=$_is_debug \
linux_use_bundled_binutils=false \
proprietary_codecs=true \
+ remove_webcore_debug_symbols=true \
symbol_level=0 \
treat_warnings_as_errors=false \
use_allocator=\"none\" \
use_allocator_shim=false \
- use_gconf=false \
+ use_cups=true \
+ use_custom_libcxx=false \
use_gnome_keyring=false \
+ use_gold=false \
+ use_lld=false \
use_pulseaudio=false \
use_sysroot=false \
+ use_system_harfbuzz=true \
)
- out/Release/gn gen out/$_buildtype --args="$_c"
+ AR="ar" CC="$CC" CXX="$CXX" LD="$CXX" NM=/usr/bin/nm \
+ out/Release/gn gen out/$_buildtype --args="$_c"
msg "Ninja turtles GO!"
# workaround parallel build
- ninja -C out/Release gen/ui/accessibility/ax_enums.h \
- gen/ui/accessibility/ax_enums.cc
+ ninja -C out/Release gen/ui/accessibility/ax_enums.p
# build mksnapshot and paxmark it
ninja -C out/$_buildtype mksnapshot
@@ -314,7 +346,7 @@ chromedriver() {
mv "$pkgdir"/usr/bin/chromedriver "$subpkgdir"/usr/bin
}
-sha512sums="8bb31d6df85651315f8b70bd27f5b855b0936dd06b05a22451d24d4b440edc5d4e8d8f20d0fbc5fc52484f14f0539d2b2e5e0623aa22cca40c1f3b9e5d9d06d7 chromium-64.0.3282.168.tar.xz
+sha512sums="3549cae27ce33a19bab857c91da1ed96c1ae36123b71bdf41a8bbacdc9554d15b4902e835dc4a8ef8016e69344b809aab4e1e3b1b26bd54d5ca651048bcb9886 chromium-66.0.3359.181.tar.xz
a3bb959c65944ae2fb765725cedcffd743a58bc0c2cd1f1999d15fe79801d00f3474b08b4ed7b48859ed921eb57093d0ad09d90f201d729ed9b8a419a591ed29 pstables-2.8.h
b9a810416dd7a8ffc3a5ced85ad9acebda1665bd08a57eec7b189698cc5f74d2c3fd69044e20fcb83297a43214b2772a1312b2c6122ea0eb716abacf39524d60 chromium-launcher.sh
f6d962b9e4c22dd42183df3db5d3202dab33eccecafb1bf63ca678147289581262db1e5e64cbe8f9c212beefb0a6717bb8d311e497f56b55fe95b8bab2db493f chromium.conf
@@ -322,22 +354,20 @@ e182c998a43d22d1c76a86c561619afd1fca8c2be668265ad5e2f81a3806f7a154272cc027a2f8b3
2d8237a940ea691bd10b08315429677a587f7ef9692a0cca53bfd066eae82998a6c71f402a8669e9de39f94d7f3280745d1628ea6eac5d76ca7116844d4e0dac google-api.keys
55921cc33d623e0751e94d4fef2ddd69afb57381da6115995b1f318e2398978b9173e80f6ffbc6e6c0c0c55a04e934e0e34a46c32e03947cc31f0f5a226e7725 chromium-widevine.patch
05fb6d9434565a7a73f5c18d470ae600bf4afbe15d0e4a7c2770bf2596a0bd2788cdfeb37e0b566fc3d26ff2d0791b70488b2c184e3286cff5a1fa25e17582cd default-pthread-stacksize.patch
-d86fa87a47f9dc1f7400358c70f2d9efcb85fa5bf0badf65456ed6a7003e59eb0809e0406fb114f256d51acb002c2a8da8a0c1c93dfdc21e198761dc516a0ecb gcc6.patch
-f420f6b4827da4dbd416b2de094452917313cb79e01d33a07029589066a0b79e06446882f1ade5ac418f180ae581937d620d1d48698df77b5c5ddb4a3d6cf680 gn_bootstrap.patch
+46e141a932860c6db1f655c8b188b8c41bce0dbb1654c066379fa53063ce6cc3bf8be156bd8e73e103c7d9e956e436732e2f7db0653f9847eb26cbfebc441a10 gn_bootstrap.patch
8fbfd67a0b6bbdf08364e810bd85b4a80dda9af73fefe3aba8010d9b33022d458a785c628515bbda9c743b8a0293d57cfe18fcc5aa2313c845c6fb948c2335f9 last-commit-position.patch
ca73f4912c4e41a235821fba5f3a7a5266739ce86dc1b27bc07d6bc2f97dc97b15b2fa47dc95c7a82a7e0b8fa1e6a17071f6dc06ddf47f65a56f216c0aaaf054 musl-fixes.patch
90efbc89151c77f32434364dcbaabaf9d9a207f4a77f147cd51b3fe100832fbfb3a9fb665303a79a3d788e400f4f41890de202ccbb7bd1fc6252e33c6e74e429 musl-fixes-breakpad.patch
507a8db2317f1f6ec18dec6cb5894b716e9b2542b58887bab9319bc6d4c66fe4a4d09b200ca8e3f11b32e380b282442a27e7a1b358d3c25eef0fa7655e9dc134 musl-hacks.patch
95ead57f7338649351948d100e32e5ec1eeadb02bffa136ff15c6c515eceb8013c444be092d777c1b62b945bfb83b97778ba4d3a0ccc2d7c2c9a0a8cd8ee0f01 musl-libc++.patch
9b75d6ac720d1b8ddc597f0f472bc400ff866a733f12b3a4cd3e7e18e724549c5f8e056c7e0d0462ef083bff5e677f8cef6b89b22f4740a40ad6398978269373 musl-sandbox.patch
-fe2cee01d07e5dc638dad0c5453397eb03e30867c1e54591d7f612034366c96ccaa35216d2bcedbe796863eeb5b90dcf71c75e5391c266df4cb27b44e59bb040 no-execinfo.patch
+31f847b5c78ac26a8f89fa7ff55911023929753ba2e6a2c4a723fdcee17e38388b0b56e395a6cb958da2efb9f17d4efa8fdce3d9dd31471271a1435b37cfa68b no-execinfo.patch
7a3a4ba4479a22a13126a78ad3d9991188ef030389026c4293d45b4440711751d68e43d28687653d5670d7f00ed5f1b820a8df50a3a08ce06e454f0cad9dbd3c no-mallinfo.patch
ac0c9d7780ac897ea8ad5d909616d3aa29eed720353c7a660c850ee1404c80f51f5db274b3c5d3c730561a7c3cd138624e1901ece329926b5dc5ca15195d9abf resolver.patch
27dd7916be3324294a0a913c43c856e9c00be767a2aec4f3da2455fb84e74ebb0017d1aa586b40dd9d989ada6b60fc531522f503d57e04324726a2171bf3a85e unset-madv_free.patch
6b0812725a0fc562527f3556dc4979fec72d1ba92f26a5e78ff2016c39bb2c155a0ff95fc22101f9c097d14b84182d6615276f4247f60ae7833ab45da8366e6d swiftshader.patch
-67eea8e13c85aca7db5c85f5b0d33e5798e8063ab7f5b2f0a5c7f6fee8266e58bee4e72f4542472ef6634634ca0f4359a2d1113fa310a991373404320c784730 secure_getenv.patch
-2e9496aa9ccd6fed2d0df4b659d55e87abb67b1be4e3cc7cb0483ccb458b9071bed9939132a2345bf15192b4dcfe5da9474d7f653ae2f4b4d46d2f3c032b3a3f chromium-48.0.2564.116-libusb_interrupt_event_handler.patch
-197ca3fd315e15c3e0b796615afbd01f65e2040027a2cde6304dea500cfaf18372ce2be88f4030bcd26651b913dd4af741a4df8803cdf9ff062a8eef9ab6c5db chromium-60.0.3112.78-gn-system.patch
-e9fcc976d2ac1b2e73d310790e76dae15111e78cd8e3efa5febd702fd9492d7d68b1b57d95bca88d5e16c0627594a00ebdeaf570df52be6e9b23a4212906c141 chromium-60.0.3112.78-jpeg-nomangle.patch
-9b08e895826fdd14fd6334662b8d07807beabab7368f3fcff3fcebe76baba4c7714c55042b379da6dab1ea0b1c4e5d657bf972b644089f00b418b7c2f5b6ef1b chromium-60.0.3112.78-no-libpng-prefix.patch
-87a0c6ff4906f0c4b6f6b471ec9bf0b2e2d28431122e99a68f957474cf27ec6b073ebca14660c8858817219521d74a184b8444cf2885db21d28fa4599fcaa66f chromium-60.0.3112.78-no-zlib-mangle.patch"
+42c4f9684463f0958c27b0cfa3ad160cb9053c2e5e8940fefecdd69adcb844674e64f03c2003d1abdcbdefa5f415a64f37c85042218b2f1d379690322d6e198c secure_getenv.patch
+b74f94675aad849791f42261325d36bdc796c982d3871c43b7c4f665b1f00762c7e67a6ee7e9d02fbc51b2e23ee171bf0bca36559bdf999e41ffd4fc9f54ceca chromium-clang-r2.patch
+a742e09199bfa2c391bb3684788961d87ba3b51255aff0346de0fa42874160ce83bd0a6569d76addf2155a47c161bde1176cf6ae8438818b9b962412ec82f16c chromium-clang-r3.patch
+6e2bcbed44786c6c0d3beda935269f30fdcdf07c400defa6bf73f8359a60b1d59cc2f80dbc106be651a535635995641321d9e524b18919d3975bd6008a641d59 chromium-gcc-r1.patch
+cbd99d51178fa5c2c3dee1eb4990240ca2ff829cee9151384e36bc3c634698c0ecaf9b51c99e901f38d0a37eef7187fe5ad39b9b7f528f7a9066a855a0c6e49f chromium-skia-harmony.patch"
diff --git a/community/chromium/add-missing-blink-tools.patch b/community/chromium/add-missing-blink-tools.patch
new file mode 100644
index 0000000000..4eddd8c744
--- /dev/null
+++ b/community/chromium/add-missing-blink-tools.patch
@@ -0,0 +1,1071 @@
+Description: add back contents of third-party/blink/tools that went missing in the source tarball for 66.0.3359.106
+Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=832283
+
+--- /dev/null
++++ b/third_party/blink/tools/OWNERS
+@@ -0,0 +1 @@
++file://third_party/WebKit/Tools/OWNERS
+--- /dev/null
++++ b/third_party/blink/tools/blinkpy/__init__.py
+@@ -0,0 +1,3 @@
++# Copyright 2017 The Chromium Authors. All rights reserved.
++# Use of this source code is governed by a BSD-style license that can be
++# found in the LICENSE file.
+--- /dev/null
++++ b/third_party/blink/tools/blinkpy/common/__init__.py
+@@ -0,0 +1,3 @@
++# Copyright 2017 The Chromium Authors. All rights reserved.
++# Use of this source code is governed by a BSD-style license that can be
++# found in the LICENSE file.
+--- /dev/null
++++ b/third_party/blink/tools/blinkpy/common/name_style_converter.py
+@@ -0,0 +1,128 @@
++# Copyright 2017 The Chromium Authors. All rights reserved.
++# Use of this source code is governed by a BSD-style license that can be
++# found in the LICENSE file.
++
++# pylint: disable=import-error,print-statement,relative-import
++
++import re
++
++SPECIAL_TOKENS = [
++ # This list should be sorted by length.
++ 'CString',
++ 'Float32',
++ 'Float64',
++ 'Base64',
++ 'IFrame',
++ 'Latin1',
++ 'PlugIn',
++ 'SQLite',
++ 'Uint16',
++ 'Uint32',
++ 'WebGL2',
++ 'ASCII',
++ 'CType',
++ 'DList',
++ 'Int16',
++ 'Int32',
++ 'MPath',
++ 'OList',
++ 'TSpan',
++ 'UList',
++ 'UTF16',
++ 'Uint8',
++ 'WebGL',
++ 'XPath',
++ 'ETC1',
++ 'HTML',
++ 'Int8',
++ 'S3TC',
++ 'SPv2',
++ 'UTF8',
++ 'API',
++ 'CSS',
++ 'DOM',
++ 'EXT',
++ 'RTC',
++ 'SVG',
++ '2D',
++ 'AX',
++ 'V0',
++ 'V8',
++]
++
++MATCHING_EXPRESSION = '((?:[A-Z][a-z]+)|[0-9]D?$)'
++
++
++class SmartTokenizer(object):
++ """Detects special cases that are not easily discernible without additional
++ knowledge, such as recognizing that in SVGSVGElement, the first two SVGs
++ are separate tokens, but WebGL is one token."""
++
++ def __init__(self, name):
++ self.remaining = name
++
++ def tokenize(self):
++ name = self.remaining
++ tokens = []
++ while len(name) > 0:
++ matched_token = None
++ for token in SPECIAL_TOKENS:
++ if name.startswith(token):
++ matched_token = token
++ break
++ if not matched_token:
++ match = re.search(MATCHING_EXPRESSION, name)
++ if not match:
++ matched_token = name
++ elif match.start(0) != 0:
++ matched_token = name[:match.start(0)]
++ else:
++ matched_token = match.group(0)
++ tokens.append(name[:len(matched_token)])
++ name = name[len(matched_token):]
++ return tokens
++
++
++class NameStyleConverter(object):
++ """Converts names from camelCase to various other styles.
++ """
++
++ def __init__(self, name):
++ self.tokens = self.tokenize(name)
++
++ def tokenize(self, name):
++ tokenizer = SmartTokenizer(name)
++ return tokenizer.tokenize()
++
++ def to_snake_case(self):
++ """Snake case is the file and variable name style per Google C++ Style
++ Guide:
++ https://google.github.io/styleguide/cppguide.html#Variable_Names
++
++ Also known as the hacker case.
++ https://en.wikipedia.org/wiki/Snake_case
++ """
++ return '_'.join([token.lower() for token in self.tokens])
++
++ def to_upper_camel_case(self):
++ """Upper-camel case is the class and function name style per
++ Google C++ Style Guide:
++ https://google.github.io/styleguide/cppguide.html#Function_Names
++
++ Also known as the PascalCase.
++ https://en.wikipedia.org/wiki/Camel_case.
++ """
++ return ''.join([token[0].upper() + token[1:] for token in self.tokens])
++
++ def to_macro_case(self):
++ """Macro case is the macro name style per Google C++ Style Guide:
++ https://google.github.io/styleguide/cppguide.html#Macro_Names
++ """
++ return '_'.join([token.upper() for token in self.tokens])
++
++ def to_all_cases(self):
++ return {
++ 'snake_case': self.to_snake_case(),
++ 'upper_camel_case': self.to_upper_camel_case(),
++ 'macro_case': self.to_macro_case(),
++ }
+--- /dev/null
++++ b/third_party/blink/tools/blinkpy/common/name_style_converter_test.py
+@@ -0,0 +1,178 @@
++# Copyright 2017 The Chromium Authors. All rights reserved.
++# Use of this source code is governed by a BSD-style license that can be
++# found in the LICENSE file.
++
++# pylint: disable=import-error,print-statement,relative-import,protected-access
++
++"""Unit tests for name_style_converter.py."""
++
++import unittest
++
++from name_style_converter import NameStyleConverter
++from name_style_converter import SmartTokenizer
++
++
++class SmartTokenizerTest(unittest.TestCase):
++ def test_simple_cases(self):
++ tokenizer = SmartTokenizer('foo')
++ self.assertEqual(tokenizer.tokenize(), ['foo'])
++
++ tokenizer = SmartTokenizer('fooBar')
++ self.assertEqual(tokenizer.tokenize(), ['foo', 'Bar'])
++
++ tokenizer = SmartTokenizer('fooBarBaz')
++ self.assertEqual(tokenizer.tokenize(), ['foo', 'Bar', 'Baz'])
++
++ tokenizer = SmartTokenizer('Baz')
++ self.assertEqual(tokenizer.tokenize(), ['Baz'])
++
++ tokenizer = SmartTokenizer('')
++ self.assertEqual(tokenizer.tokenize(), [])
++
++ tokenizer = SmartTokenizer('FOO')
++ self.assertEqual(tokenizer.tokenize(), ['FOO'])
++
++ tokenizer = SmartTokenizer('foo2')
++ self.assertEqual(tokenizer.tokenize(), ['foo', '2'])
++
++ def test_tricky_cases(self):
++ tokenizer = SmartTokenizer('XMLHttpRequest')
++ self.assertEqual(tokenizer.tokenize(), ['XML', 'Http', 'Request'])
++
++ tokenizer = SmartTokenizer('HTMLElement')
++ self.assertEqual(tokenizer.tokenize(), ['HTML', 'Element'])
++
++ tokenizer = SmartTokenizer('WebGLRenderingContext')
++ self.assertEqual(tokenizer.tokenize(),
++ ['WebGL', 'Rendering', 'Context'])
++
++ tokenizer = SmartTokenizer('CanvasRenderingContext2D')
++ self.assertEqual(tokenizer.tokenize(),
++ ['Canvas', 'Rendering', 'Context', '2D'])
++ tokenizer = SmartTokenizer('CanvasRenderingContext2DAPITest')
++ self.assertEqual(tokenizer.tokenize(),
++ ['Canvas', 'Rendering', 'Context', '2D', 'API', 'Test'])
++
++ tokenizer = SmartTokenizer('SVGSVGElement')
++ self.assertEqual(tokenizer.tokenize(), ['SVG', 'SVG', 'Element'])
++
++ tokenizer = SmartTokenizer('CanvasRenderingContext2D')
++ self.assertEqual(tokenizer.tokenize(), ['Canvas', 'Rendering', 'Context', '2D'])
++
++ tokenizer = SmartTokenizer('CSSURLImageValue')
++ self.assertEqual(tokenizer.tokenize(), ['CSS', 'URL', 'Image', 'Value'])
++ tokenizer = SmartTokenizer('CSSPropertyAPID')
++ self.assertEqual(tokenizer.tokenize(), ['CSS', 'Property', 'API', 'D'])
++ tokenizer = SmartTokenizer('AXARIAGridCell')
++ self.assertEqual(tokenizer.tokenize(), ['AX', 'ARIA', 'Grid', 'Cell'])
++
++ tokenizer = SmartTokenizer('CDATASection')
++ self.assertEqual(tokenizer.tokenize(), ['CDATA', 'Section'])
++
++ tokenizer = SmartTokenizer('ASCIICType')
++ self.assertEqual(tokenizer.tokenize(), ['ASCII', 'CType'])
++ tokenizer = SmartTokenizer('CString')
++ self.assertEqual(tokenizer.tokenize(), ['CString'])
++
++ tokenizer = SmartTokenizer('HTMLDListElement')
++ self.assertEqual(tokenizer.tokenize(), ['HTML', 'DList', 'Element'])
++ tokenizer = SmartTokenizer('HTMLOListElement')
++ self.assertEqual(tokenizer.tokenize(), ['HTML', 'OList', 'Element'])
++ tokenizer = SmartTokenizer('HTMLIFrameElement')
++ self.assertEqual(tokenizer.tokenize(), ['HTML', 'IFrame', 'Element'])
++ tokenizer = SmartTokenizer('HTMLPlugInElement')
++ self.assertEqual(tokenizer.tokenize(), ['HTML', 'PlugIn', 'Element'])
++
++ # No special handling for OptGroup, FieldSet, and TextArea.
++ tokenizer = SmartTokenizer('HTMLOptGroupElement')
++ self.assertEqual(tokenizer.tokenize(), ['HTML', 'Opt', 'Group', 'Element'])
++ tokenizer = SmartTokenizer('HTMLFieldSetElement')
++ self.assertEqual(tokenizer.tokenize(), ['HTML', 'Field', 'Set', 'Element'])
++ tokenizer = SmartTokenizer('HTMLTextAreaElement')
++ self.assertEqual(tokenizer.tokenize(), ['HTML', 'Text', 'Area', 'Element'])
++
++ tokenizer = SmartTokenizer('Path2D')
++ self.assertEqual(tokenizer.tokenize(), ['Path', '2D'])
++ tokenizer = SmartTokenizer('Point2D')
++ self.assertEqual(tokenizer.tokenize(), ['Point', '2D'])
++ tokenizer = SmartTokenizer('CanvasRenderingContext2DState')
++ self.assertEqual(tokenizer.tokenize(), ['Canvas', 'Rendering', 'Context', '2D', 'State'])
++
++ tokenizer = SmartTokenizer('RTCDTMFSender')
++ self.assertEqual(tokenizer.tokenize(), ['RTC', 'DTMF', 'Sender'])
++
++ tokenizer = SmartTokenizer('WebGLCompressedTextureS3TCsRGB')
++ self.assertEqual(tokenizer.tokenize(), ['WebGL', 'Compressed', 'Texture', 'S3TC', 'sRGB'])
++ tokenizer = SmartTokenizer('WebGL2CompressedTextureETC1')
++ self.assertEqual(tokenizer.tokenize(), ['WebGL2', 'Compressed', 'Texture', 'ETC1'])
++ tokenizer = SmartTokenizer('EXTsRGB')
++ self.assertEqual(tokenizer.tokenize(), ['EXT', 'sRGB'])
++
++ tokenizer = SmartTokenizer('SVGFEBlendElement')
++ self.assertEqual(tokenizer.tokenize(), ['SVG', 'FE', 'Blend', 'Element'])
++ tokenizer = SmartTokenizer('SVGMPathElement')
++ self.assertEqual(tokenizer.tokenize(), ['SVG', 'MPath', 'Element'])
++ tokenizer = SmartTokenizer('SVGTSpanElement')
++ self.assertEqual(tokenizer.tokenize(), ['SVG', 'TSpan', 'Element'])
++ tokenizer = SmartTokenizer('SVGURIReference')
++ self.assertEqual(tokenizer.tokenize(), ['SVG', 'URI', 'Reference'])
++
++ tokenizer = SmartTokenizer('UTF16TextIterator')
++ self.assertEqual(tokenizer.tokenize(), ['UTF16', 'Text', 'Iterator'])
++ tokenizer = SmartTokenizer('UTF8Decoder')
++ self.assertEqual(tokenizer.tokenize(), ['UTF8', 'Decoder'])
++ tokenizer = SmartTokenizer('Uint8Array')
++ self.assertEqual(tokenizer.tokenize(), ['Uint8', 'Array'])
++ tokenizer = SmartTokenizer('DOMWindowBase64')
++ self.assertEqual(tokenizer.tokenize(), ['DOM', 'Window', 'Base64'])
++ tokenizer = SmartTokenizer('TextCodecLatin1')
++ self.assertEqual(tokenizer.tokenize(), ['Text', 'Codec', 'Latin1'])
++ tokenizer = SmartTokenizer('V8BindingForCore')
++ self.assertEqual(tokenizer.tokenize(), ['V8', 'Binding', 'For', 'Core'])
++ tokenizer = SmartTokenizer('V8DOMRect')
++ self.assertEqual(tokenizer.tokenize(), ['V8', 'DOM', 'Rect'])
++
++ tokenizer = SmartTokenizer('V0InsertionPoint')
++ self.assertEqual(tokenizer.tokenize(), ['V0', 'Insertion', 'Point'])
++ tokenizer = SmartTokenizer('ShadowDOMV0Test')
++ self.assertEqual(tokenizer.tokenize(), ['Shadow', 'DOM', 'V0', 'Test'])
++ tokenizer = SmartTokenizer('ElementShadowV0')
++ self.assertEqual(tokenizer.tokenize(), ['Element', 'Shadow', 'V0'])
++ tokenizer = SmartTokenizer('StubChromeClientForSPv2')
++ self.assertEqual(tokenizer.tokenize(), ['Stub', 'Chrome', 'Client', 'For', 'SPv2'])
++
++ tokenizer = SmartTokenizer('SQLiteAuthorizer')
++ self.assertEqual(tokenizer.tokenize(), ['SQLite', 'Authorizer'])
++ tokenizer = SmartTokenizer('XPathEvaluator')
++ self.assertEqual(tokenizer.tokenize(), ['XPath', 'Evaluator'])
++
++ tokenizer = SmartTokenizer('IsXHTMLDocument')
++ self.assertEqual(tokenizer.tokenize(), ['Is', 'XHTML', 'Document'])
++
++ tokenizer = SmartTokenizer('Animation.idl')
++ self.assertEqual(tokenizer.tokenize(), ['Animation', '.idl'])
++
++
++class NameStyleConverterTest(unittest.TestCase):
++ def test_snake_case(self):
++ converter = NameStyleConverter('HTMLElement')
++ self.assertEqual(converter.to_snake_case(), 'html_element')
++
++ def test_upper_camel_case(self):
++ converter = NameStyleConverter('someSuperThing')
++ self.assertEqual(converter.to_upper_camel_case(), 'SomeSuperThing')
++
++ converter = NameStyleConverter('SVGElement')
++ self.assertEqual(converter.to_upper_camel_case(), 'SVGElement')
++
++ def test_macro_case(self):
++ converter = NameStyleConverter('WebGLBaz2D')
++ self.assertEqual(converter.to_macro_case(), 'WEBGL_BAZ_2D')
++
++ def test_all_cases(self):
++ converter = NameStyleConverter('SVGScriptElement')
++ self.assertEqual(converter.to_all_cases(), {
++ 'snake_case': 'svg_script_element',
++ 'upper_camel_case': 'SVGScriptElement',
++ 'macro_case': 'SVG_SCRIPT_ELEMENT',
++ })
+--- /dev/null
++++ b/third_party/blink/tools/compile_devtools_frontend.py
+@@ -0,0 +1,20 @@
++#!/usr/bin/env vpython
++# Copyright 2017 The Chromium Authors. All rights reserved.
++# Use of this source code is governed by a BSD-style license that can be
++# found in the LICENSE file.
++
++"""Compile DevTools frontend code with Closure compiler.
++
++This script wraps devtools/scripts/compile_frontend.py.
++DevTools bot kicks this script.
++"""
++
++import os
++import sys
++
++sys.path.append(os.path.join(
++ os.path.dirname(__file__), '..', '..', 'WebKit', 'Source', 'devtools', 'scripts'))
++import compile_frontend
++
++if __name__ == '__main__':
++ sys.exit(compile_frontend.main())
+--- /dev/null
++++ b/third_party/blink/tools/move_blink_source.py
+@@ -0,0 +1,615 @@
++#!/usr/bin/env vpython
++# Copyright 2017 The Chromium Authors. All rights reserved.
++# Use of this source code is governed by a BSD-style license that can be
++# found in the LICENSE file.
++
++"""Tool to move Blink source from third_party/WebKit to third_party/blink.
++
++See https://docs.google.com/document/d/1l3aPv1Wx__SpRkdOhvJz8ciEGigNT3wFKv78XiuW0Tw/edit?usp=sharing#heading=h.o225wrxp242h
++for the details.
++"""
++
++import argparse
++import logging
++import os
++import re
++import sys
++from functools import partial
++
++# Without abspath(), PathFinder can't find chromium_base correctly.
++sys.path.append(os.path.abspath(
++ os.path.join(os.path.dirname(__file__), '..', '..', '..',
++ 'third_party', 'WebKit', 'Tools', 'Scripts')))
++from blinkpy.common.name_style_converter import NameStyleConverter
++from plan_blink_move import plan_blink_move
++from plan_blink_move import relative_dest
++from webkitpy.common.checkout.git import Git
++from webkitpy.common.path_finder import get_chromium_src_dir
++from webkitpy.common.path_finder import get_scripts_dir
++from webkitpy.common.system.executive import Executive
++from webkitpy.common.system.executive import ScriptError
++from webkitpy.common.system.filesystem import FileSystem
++
++_log = logging.getLogger('move_blink_source')
++
++
++class FileType(object):
++ NONE = 0
++ BUILD = 1
++ BLINK_BUILD = 2
++ OWNERS = 3
++ DEPS = 4
++ MOJOM = 5
++ TYPEMAP = 6
++ BLINK_BUILD_PY = 7
++ LAYOUT_TESTS_WITH_MOJOM = 8
++
++ @staticmethod
++ def detect(path):
++ slash_dir, basename = os.path.split(path)
++ slash_dir = slash_dir.replace(os.path.sep, '/')
++ if basename == 'DEPS':
++ return FileType.DEPS
++ if basename == 'OWNERS':
++ return FileType.OWNERS
++ if basename.endswith('.mojom'):
++ return FileType.MOJOM
++ if basename.endswith('.typemap'):
++ return FileType.TYPEMAP
++ if basename.endswith('.py') and 'third_party/WebKit/Source/build' in slash_dir:
++ return FileType.BLINK_BUILD_PY
++ if basename.endswith(('.gn', '.gni')):
++ if 'third_party/WebKit' in path or 'third_party/blink' in slash_dir:
++ return FileType.BLINK_BUILD
++ if 'third_party' in slash_dir:
++ return FileType.NONE
++ return FileType.BUILD
++ if basename.endswith('.html') and re.search(
++ r'third_party/WebKit/LayoutTests/(geolocation-api|installedapp|' +
++ r'media/mediasession|payments|presentation|webshare)', slash_dir):
++ return FileType.LAYOUT_TESTS_WITH_MOJOM
++ return FileType.NONE
++
++
++class MoveBlinkSource(object):
++
++ def __init__(self, fs, options, repo_root):
++ self._fs = fs
++ self._options = options
++ _log.debug(options)
++ self._repo_root = repo_root
++
++ # The following fields are initialized in _create_basename_maps.
++ self._basename_map = None
++ self._basename_re = None
++ self._idl_generated_impl_headers = None
++ # _checked_in_header_re is used to distinguish checked-in header files
++ # and generated header files.
++ self._checked_in_header_re = None
++
++ self._updated_files = []
++
++ def update(self, apply_only=None):
++ """Updates contents of files affected by Blink source move.
++
++ Args:
++ apply_only: If it's None, updates all affected files. Otherwise,
++ it should be a set of file paths and this function updates
++ only the files in |apply_only|.
++ """
++ _log.info('Planning renaming ...')
++ file_pairs = plan_blink_move(self._fs, [])
++ _log.info('Will move %d files', len(file_pairs))
++
++ self._create_basename_maps(file_pairs)
++ dirs = self._update_file_content(apply_only)
++
++ # Updates #includes in files in directories with updated DEPS +
++ # third_party/WebKit/{Source,common,public}.
++ self._append_unless_upper_dir_exists(dirs, self._fs.join(self._repo_root, 'third_party', 'WebKit', 'Source'))
++ self._append_unless_upper_dir_exists(dirs, self._fs.join(self._repo_root, 'third_party', 'WebKit', 'common'))
++ self._append_unless_upper_dir_exists(dirs, self._fs.join(self._repo_root, 'third_party', 'WebKit', 'public'))
++ self._append_unless_upper_dir_exists(dirs, self._fs.join(self._repo_root, 'mojo', 'public', 'tools',
++ 'bindings', 'generators', 'cpp_templates'))
++ self._update_cpp_includes_in_directories(dirs, apply_only)
++
++ # Content update for individual files.
++ # The following is a list of tuples.
++ # Tuple: (<file path relative to repo root>, [replacement commands])
++ # Command: a callable object, or
++ # a tuple of (<original string>, <new string>).
++ file_replacement_list = [
++ ('DEPS',
++ [('src/third_party/WebKit/Source/devtools',
++ 'src/third_party/blink/renderer/devtools')]),
++ ('WATCHLISTS',
++ [('third_party/WebKit/Source', 'third_party/blink/renderer'),
++ ('third_party/WebKit/public', 'third_party/blink/renderer/public')]),
++ ('build/check_gn_headers_whitelist.txt',
++ [('third_party/WebKit/Source', 'third_party/blink/renderer'),
++ ('third_party/WebKit/public', 'third_party/blink/renderer/public'),
++ self._update_basename]),
++ ('testing/buildbot/gn_isolate_map.pyl',
++ [('third_party/WebKit/Source', 'third_party/blink/renderer')]),
++ ('third_party/WebKit/Source/BUILD.gn',
++ [('$root_gen_dir/third_party/WebKit',
++ '$root_gen_dir/third_party/blink/renderer')]),
++ ('third_party/WebKit/Source/config.gni',
++ [('snake_case_source_files = false',
++ 'snake_case_source_files = true')]),
++ ('third_party/WebKit/Source/core/css/CSSProperties.json5',
++ [self._update_basename]),
++ ('third_party/WebKit/Source/core/css/ComputedStyleExtraFields.json5',
++ [self._update_basename]),
++ ('third_party/WebKit/Source/core/css/ComputedStyleFieldAliases.json5',
++ [self._update_basename]),
++ ('third_party/WebKit/Source/core/html/parser/create-html-entity-table',
++ [self._update_basename]),
++ ('third_party/WebKit/Source/core/inspector/inspector_protocol_config.json',
++ [self._update_basename]),
++ ('third_party/WebKit/Source/core/probe/CoreProbes.json5',
++ [self._update_basename]),
++ ('third_party/WebKit/Source/core/testing/InternalSettings.h',
++ [('InternalSettingsGenerated.h', 'internal_settings_generated.h')]),
++ ('third_party/WebKit/Source/core/testing/Internals.cpp',
++ [('InternalRuntimeFlags.h', 'internal_runtime_flags.h')]),
++ ('third_party/WebKit/Source/platform/probe/PlatformProbes.json5',
++ [self._update_basename]),
++ ('third_party/WebKit/public/BUILD.gn',
++ [('$root_gen_dir/third_party/WebKit',
++ '$root_gen_dir/third_party/blink/renderer')]),
++ ('third_party/WebKit/public/blink_resources.grd',
++ [('../Source/', '../')]),
++ ('tools/android/eclipse/.classpath',
++ [('third_party/WebKit/public', 'third_party/blink/renderer/public')]),
++ ('tools/android/loading/cloud/backend/deploy.sh',
++ [('third_party/WebKit/Source', 'third_party/blink/renderer')]),
++ ('tools/android/loading/emulation_unittest.py',
++ [('third_party/WebKit/Source', 'third_party/blink/renderer')]),
++ ('tools/android/loading/options.py',
++ [('third_party/WebKit/Source', 'third_party/blink/renderer')]),
++ ('tools/android/loading/request_track.py',
++ [('third_party/WebKit/Source', 'third_party/blink/renderer')]),
++ ('tools/gritsettings/resource_ids',
++ [('third_party/WebKit/public', 'third_party/blink/renderer/public'),
++ ('third_party/WebKit/Source', 'third_party/blink/renderer')]),
++ ('tools/metrics/actions/extract_actions.py',
++ [('third_party/WebKit/Source', 'third_party/blink/renderer')]),
++ ('tools/metrics/histograms/update_editor_commands.py',
++ [('third_party/WebKit/Source/core/editing/EditorCommand.cpp',
++ 'third_party/blink/renderer/core/editing/editor_command.cc')]),
++ ('tools/metrics/histograms/update_use_counter_css.py',
++ [('third_party/WebKit/Source/core/frame/UseCounter.cpp',
++ 'third_party/blink/renderer/core/frame/use_counter.cc')]),
++ ('tools/metrics/histograms/update_use_counter_feature_enum.py',
++ [('third_party/WebKit/public', 'third_party/blink/renderer/public')]),
++ ]
++ for file_path, replacement_list in file_replacement_list:
++ if not apply_only or file_path in apply_only:
++ self._update_single_file_content(file_path, replacement_list, should_write=self._options.run)
++
++ if self._options.run:
++ _log.info('Formatting updated %d files ...', len(self._updated_files))
++ git = Git(cwd=self._repo_root)
++ # |git cl format| can't handle too many files at once.
++ while len(self._updated_files) > 0:
++ end_index = 100
++ if end_index > len(self._updated_files):
++ end_index = len(self._updated_files)
++ git.run(['cl', 'format'] + self._updated_files[:end_index])
++ self._updated_files = self._updated_files[end_index:]
++
++ if not apply_only:
++ _log.info('Make a local commit ...')
++ git.commit_locally_with_message("""The Great Blink mv for source files, part 1.
++
++Update file contents without moving files.
++
++NOAUTOREVERT=true
++Bug: 768828
++""")
++
++ def move(self, apply_only=None):
++ """Move Blink source files.
++
++ Args:
++ apply_only: If it's None, move all affected files. Otherwise,
++ it should be a set of file paths and this function moves
++ only the files in |apply_only|.
++ """
++ _log.info('Planning renaming ...')
++ file_pairs = plan_blink_move(self._fs, [])
++
++ if apply_only:
++ file_pairs = [(src, dest) for (src, dest) in file_pairs
++ if 'third_party/WebKit/' + src.replace('\\', '/') in apply_only]
++ print 'Update file_pairs = ', file_pairs
++ _log.info('Will move %d files', len(file_pairs))
++
++ git = Git(cwd=self._repo_root)
++ files_set = self._get_checked_in_files(git)
++ for i, (src, dest) in enumerate(file_pairs):
++ src_from_repo = self._fs.join('third_party', 'WebKit', src)
++ if src_from_repo.replace('\\', '/') not in files_set:
++ _log.info('%s is not in the repository', src)
++ continue
++ dest_from_repo = self._fs.join('third_party', 'blink', dest)
++ self._fs.maybe_make_directory(self._repo_root, 'third_party', 'blink', self._fs.dirname(dest))
++ if self._options.run_git:
++ git.move(src_from_repo, dest_from_repo)
++ _log.info('[%d/%d] Git moved %s', i + 1, len(file_pairs), src)
++ else:
++ self._fs.move(self._fs.join(self._repo_root, src_from_repo),
++ self._fs.join(self._repo_root, dest_from_repo))
++ _log.info('[%d/%d] Moved %s', i + 1, len(file_pairs), src)
++ if apply_only:
++ return
++
++ self._update_single_file_content(
++ 'build/get_landmines.py',
++ [('\ndef main', ' print \'The Great Blink mv for source files (crbug.com/768828)\'\n\ndef main')])
++
++ _log.info('Run run-bindings-tests ...')
++ Executive().run_command(['python',
++ self._fs.join(get_scripts_dir(), 'run-bindings-tests'),
++ '--reset-results'],
++ cwd=self._repo_root)
++
++ if self._options.run_git:
++ _log.info('Make a local commit ...')
++ git.commit_locally_with_message("""The Great Blink mv for source files, part 2.
++
++Move and rename files.
++
++NOAUTOREVERT=true
++Bug: 768828
++""")
++
++ def fix_branch(self):
++ git = Git(cwd=self._repo_root)
++ status = self._get_local_change_status(git)
++ if len(status) == 0:
++ _log.info('No local changes.')
++ return
++ modified_files = {f for (s, f) in status if s != 'D'}
++ deleted_files = {f for (s, f) in status if s == 'D'}
++
++ self.update(apply_only=modified_files)
++ self.move(apply_only=modified_files)
++ try:
++ git.commit_locally_with_message('This commit should be squashed.')
++ except ScriptError:
++ _log.info('move_blink_source.py modified nothing.')
++
++ # TODO(tkent): Show a message about deleted_files.
++
++ def _get_local_change_status(self, git):
++ """Returns a list of tuples representing local change summary.
++
++ Each tuple contains two strings. The first one is file change status
++ such as "M", "D". See --diff-filter section of git-diff manual page.
++ The second one is file name relative to the repository top.
++ """
++
++ base_commit = git.run(['show-branch', '--merge-base', 'master', 'HEAD']).strip()
++ # Note that file names in the following command result are always
++ # slash-separated, even on Windows.
++ status_lines = git.run(['diff', '--name-status', '--no-renames', base_commit]).split('\n')
++ status_tuple_list = []
++ for l in status_lines:
++ items = l.split('\t')
++ if len(items) == 2:
++ status_tuple_list.append(tuple(items))
++ elif len(l) > 0:
++ _log.warning('Unrecognized diff output: "%s"', l)
++ return status_tuple_list
++
++ def _get_checked_in_files(self, git):
++ files_text = git.run(['ls-files',
++ 'third_party/WebKit/Source',
++ 'third_party/WebKit/common',
++ 'third_party/WebKit/public'])
++ return set(files_text.split('\n'))
++
++ def _create_basename_maps(self, file_pairs):
++ basename_map = {}
++ # Generated inspector/protocol/* contains a lot of names duplicated with
++ # checked-in core files. We don't want to rename them, and don't want to
++ # replace them in BUILD.gn and #include accidentally.
++ pattern = r'(?<!inspector/protocol/)\b('
++ idl_headers = set()
++ header_pattern = r'(?<!inspector/protocol/)\b('
++ for source, dest in file_pairs:
++ _, source_base = self._fs.split(source)
++ _, dest_base = self._fs.split(dest)
++ # OriginTrialFeaturesForCore.h in bindings/tests/results/modules/
++ # confuses generated/checked-in detection in _replace_include_path().
++ if 'bindings/tests' in source.replace('\\', '/'):
++ continue
++ if source_base.endswith('.h'):
++ header_pattern += re.escape(source_base) + '|'
++ if source_base == dest_base:
++ continue
++ basename_map[source_base] = dest_base
++ pattern += re.escape(source_base) + '|'
++ # IDL sometimes generates implementation files as well as
++ # binding files. We'd like to update #includes for such files.
++ if source_base.endswith('.idl'):
++ source_header = source_base.replace('.idl', '.h')
++ basename_map[source_header] = dest_base.replace('.idl', '.h')
++ pattern += re.escape(source_header) + '|'
++ idl_headers.add(source_header)
++ _log.info('Rename %d files for snake_case', len(basename_map))
++ self._basename_map = basename_map
++ self._basename_re = re.compile(pattern[0:len(pattern) - 1] + ')(?=["\']|$)')
++ self._idl_generated_impl_headers = idl_headers
++ self._checked_in_header_re = re.compile(header_pattern[0:len(header_pattern) - 1] + ')$')
++
++ def _shorten_path(self, path):
++ if path.startswith(self._repo_root):
++ return path[len(self._repo_root) + 1:]
++ return path
++
++ @staticmethod
++ def _filter_file(fs, dirname, basename):
++ return FileType.detect(fs.join(dirname, basename)) != FileType.NONE
++
++ def _update_build(self, content):
++ content = content.replace('//third_party/WebKit/Source', '//third_party/blink/renderer')
++ content = content.replace('//third_party/WebKit/common', '//third_party/blink/common')
++ content = content.replace('//third_party/WebKit/public', '//third_party/blink/renderer/public')
++ # export_header_blink exists outside of Blink too.
++ content = content.replace('export_header_blink = "third_party/WebKit/public/platform/WebCommon.h"',
++ 'export_header_blink = "third_party/blink/renderer/public/platform/web_common.h"')
++ return content
++
++ def _update_blink_build(self, content):
++ content = self._update_build(content)
++
++ # Update visibility=[...]
++ content = content.replace('//third_party/WebKit/*', '//third_party/blink/*')
++ content = content.replace('//third_party/WebKit/Source/*', '//third_party/blink/renderer/*')
++ content = content.replace('//third_party/WebKit/public/*', '//third_party/blink/renderer/public/*')
++
++ # Update mojom variables
++ content = content.replace('export_header = "third_party/WebKit/common',
++ 'export_header = "third_party/blink/common')
++ content = content.replace('export_header_blink = "third_party/WebKit/Source',
++ 'export_header_blink = "third_party/blink/renderer')
++ return self._update_basename(content)
++
++ def _update_owners(self, content):
++ content = content.replace('//third_party/WebKit/Source', '//third_party/blink/renderer')
++ content = content.replace('//third_party/WebKit/common', '//third_party/blink/common')
++ content = content.replace('//third_party/WebKit/public', '//third_party/blink/renderer/public')
++ return content
++
++ def _update_deps(self, content):
++ original_content = content
++ content = content.replace('third_party/WebKit/Source', 'third_party/blink/renderer')
++ content = content.replace('third_party/WebKit/common', 'third_party/blink/common')
++ content = content.replace('third_party/WebKit/public', 'third_party/blink/renderer/public')
++ content = content.replace('third_party/WebKit', 'third_party/blink')
++ if original_content == content:
++ return content
++ return self._update_basename(content)
++
++ def _update_mojom(self, content):
++ content = content.replace('third_party/WebKit/public', 'third_party/blink/renderer/public')
++ content = content.replace('third_party/WebKit/common', 'third_party/blink/common')
++ return content
++
++ def _update_typemap(self, content):
++ content = content.replace('//third_party/WebKit/Source', '//third_party/blink/renderer')
++ content = content.replace('//third_party/WebKit/common', '//third_party/blink/common')
++ content = content.replace('//third_party/WebKit/public', '//third_party/blink/renderer/public')
++ return self._update_basename(content)
++
++ def _update_blink_build_py(self, content):
++ # We don't prepend 'third_party/blink/renderer/' to matched basenames
++ # because it won't affect build and manual update after the great mv is
++ # enough.
++ return self._update_basename(content)
++
++ def _update_layout_tests(self, content):
++ return content.replace('file:///gen/third_party/WebKit/', 'file:///gen/third_party/blink/renderer/')
++
++ def _update_basename(self, content):
++ return self._basename_re.sub(lambda match: self._basename_map[match.group(1)], content)
++
++ @staticmethod
++ def _append_unless_upper_dir_exists(dirs, new_dir):
++ for i in range(0, len(dirs)):
++ if new_dir.startswith(dirs[i]):
++ return
++ if dirs[i].startswith(new_dir):
++ dirs[i] = new_dir
++ return
++ dirs.append(new_dir)
++
++ def _update_file_content(self, apply_only):
++ _log.info('Find *.gn, *.mojom, *.py, *.typemap, DEPS, and OWNERS ...')
++ files = self._fs.files_under(
++ self._repo_root, dirs_to_skip=['.git', 'out'], file_filter=self._filter_file)
++ _log.info('Scan contents of %d files ...', len(files))
++ updated_deps_dirs = []
++ for file_path in files:
++ file_type = FileType.detect(file_path)
++ original_content = self._fs.read_text_file(file_path)
++ content = original_content
++ if file_type == FileType.BUILD:
++ content = self._update_build(content)
++ elif file_type == FileType.BLINK_BUILD:
++ content = self._update_blink_build(content)
++ elif file_type == FileType.OWNERS:
++ content = self._update_owners(content)
++ elif file_type == FileType.DEPS:
++ if self._fs.dirname(file_path) == self._repo_root:
++ _log.info("Skip //DEPS")
++ continue
++ content = self._update_deps(content)
++ elif file_type == FileType.MOJOM:
++ content = self._update_mojom(content)
++ elif file_type == FileType.TYPEMAP:
++ content = self._update_typemap(content)
++ elif file_type == FileType.BLINK_BUILD_PY:
++ content = self._update_blink_build_py(content)
++ elif file_type == FileType.LAYOUT_TESTS_WITH_MOJOM:
++ content = self._update_layout_tests(content)
++
++ if original_content == content:
++ continue
++ if self._options.run and (not apply_only or file_path.replace('\\', '/') in apply_only):
++ self._fs.write_text_file(file_path, content)
++ self._updated_files.append(file_path)
++ if file_type == FileType.DEPS:
++ self._append_unless_upper_dir_exists(updated_deps_dirs, self._fs.dirname(file_path))
++ _log.info('Updated %s', self._shorten_path(file_path))
++ return updated_deps_dirs
++
++ def _update_cpp_includes_in_directories(self, dirs, apply_only):
++ for dirname in dirs:
++ _log.info('Processing #include in %s ...', self._shorten_path(dirname))
++ files = self._fs.files_under(
++ dirname, file_filter=lambda fs, _, basename: basename.endswith(
++ ('.h', '.cc', '.cpp', '.mm', '.cc.tmpl', '.cpp.tmpl',
++ '.h.tmpl', 'XPathGrammar.y', '.gperf')))
++ for file_path in files:
++ posix_file_path = file_path.replace('\\', '/')
++ original_content = self._fs.read_text_file(file_path)
++
++ content = self._update_cpp_includes(original_content)
++ if file_path.endswith('.h') and '/third_party/WebKit/public/' in posix_file_path:
++ content = self._update_basename_only_includes(content, file_path)
++ if file_path.endswith('.h') and '/third_party/WebKit/' in posix_file_path:
++ content = self._update_include_guard(content, file_path)
++
++ if original_content == content:
++ continue
++ if self._options.run and (not apply_only or posix_file_path in apply_only):
++ self._fs.write_text_file(file_path, content)
++ self._updated_files.append(file_path)
++ _log.info('Updated %s', self._shorten_path(file_path))
++
++ def _replace_include_path(self, match):
++ include_or_import = match.group(1)
++ path = match.group(2)
++
++ # If |path| starts with 'third_party/WebKit', we should adjust the
++ # directory name for third_party/blink, and replace its basename by
++ # self._basename_map.
++ #
++ # If |path| starts with a Blink-internal directory such as bindings,
++ # core, modules, platform, public, it refers to a checked-in file, or a
++ # generated file. For the former, we should add
++ # 'third_party/blink/renderer/' and replace the basename. For the
++ # latter, we should update the basename for a name mapped from an IDL
++ # renaming, and should not add 'third_party/blink/renderer'.
++
++ if path.startswith('third_party/WebKit'):
++ path = path.replace('third_party/WebKit/Source', 'third_party/blink/renderer')
++ path = path.replace('third_party/WebKit/common', 'third_party/blink/common')
++ path = path.replace('third_party/WebKit/public', 'third_party/blink/renderer/public')
++ path = self._update_basename(path)
++ return '#%s "%s"' % (include_or_import, path)
++
++ match = self._checked_in_header_re.search(path)
++ if match:
++ if match.group(1) in self._basename_map:
++ path = 'third_party/blink/renderer/' + path[:match.start(1)] + self._basename_map[match.group(1)]
++ else:
++ path = 'third_party/blink/renderer/' + path
++ elif 'core/inspector/protocol/' not in path:
++ basename_start = path.rfind('/') + 1
++ basename = path[basename_start:]
++ if basename in self._idl_generated_impl_headers:
++ path = path[:basename_start] + self._basename_map[basename]
++ elif basename.startswith('V8'):
++ path = path[:basename_start] + NameStyleConverter(basename[:len(basename) - 2]).to_snake_case() + '.h'
++ return '#%s "%s"' % (include_or_import, path)
++
++ def _update_cpp_includes(self, content):
++ pattern = re.compile(r'#(include|import)\s+"((bindings|core|modules|platform|public|' +
++ r'third_party/WebKit/(Source|common|public))/[-_\w/.]+)"')
++ return pattern.sub(self._replace_include_path, content)
++
++ def _replace_basename_only_include(self, subdir, source_path, match):
++ source_basename = match.group(1)
++ if source_basename in self._basename_map:
++ return '#include "third_party/blink/renderer/public/%s/%s"' % (subdir, self._basename_map[source_basename])
++ _log.warning('Basename-only %s in %s', match.group(0), self._shorten_path(source_path))
++ return match.group(0)
++
++ def _update_basename_only_includes(self, content, source_path):
++ if not source_path.endswith('.h') or '/third_party/WebKit/public/' not in source_path.replace('\\', '/'):
++ return
++ # In public/ header files, we should replace |#include "WebFoo.h"|
++ # with |#include "third_party/blink/renderer/public/platform-or-web/web_foo.h"|
++ subdir = self._fs.basename(self._fs.dirname(source_path))
++ # subdir is 'web' or 'platform'.
++ return re.sub(r'#include\s+"(\w+\.h)"',
++ partial(self._replace_basename_only_include, subdir, source_path), content)
++
++ def _update_include_guard(self, content, source_path):
++ current_guard = re.sub(r'[.]', '_', self._fs.basename(source_path))
++ new_path = relative_dest(self._fs, self._fs.relpath(
++ source_path, start=self._fs.join(self._repo_root, 'third_party', 'WebKit')))
++ new_guard = 'THIRD_PARTY_BLINK_' + re.sub(r'[\\/.]', '_', new_path.upper()) + '_'
++ content = re.sub(r'#ifndef\s+(WTF_)?' + current_guard, '#ifndef ' + new_guard, content);
++ content = re.sub(r'#define\s+(WTF_)?' + current_guard, '#define ' + new_guard, content);
++ content = re.sub(r'#endif\s+//\s+(WTF_)?' + current_guard, '#endif // ' + new_guard, content);
++ return content
++
++ def _update_single_file_content(self, file_path, replace_list, should_write=True):
++ full_path = self._fs.join(self._repo_root, file_path)
++ original_content = self._fs.read_text_file(full_path)
++ content = original_content
++ for command in replace_list:
++ if isinstance(command, tuple):
++ src, dest = command
++ content = content.replace(src, dest)
++ elif callable(command):
++ content = command(content)
++ else:
++ raise TypeError('A tuple or a function is expected.')
++ if content != original_content:
++ if should_write:
++ self._fs.write_text_file(full_path, content)
++ self._updated_files.append(full_path)
++ _log.info('Updated %s', file_path)
++ else:
++ _log.warning('%s does not contain specified source strings.', file_path)
++
++
++def main():
++ logging.basicConfig(level=logging.DEBUG,
++ format='[%(asctime)s %(levelname)s %(name)s] %(message)s',
++ datefmt='%H:%M:%S')
++ parser = argparse.ArgumentParser(description='Blink source mover')
++ sub_parsers = parser.add_subparsers()
++
++ update_parser = sub_parsers.add_parser('update')
++ update_parser.set_defaults(command='update')
++ update_parser.add_argument('--run', dest='run', action='store_true',
++ help='Update file contents')
++
++ move_parser = sub_parsers.add_parser('move')
++ move_parser.set_defaults(command='move')
++ move_parser.add_argument('--git', dest='run_git', action='store_true',
++ help='Run |git mv| command instead of |mv|.')
++
++ fixbranch_parser = sub_parsers.add_parser('fixbranch')
++ fixbranch_parser.set_defaults(command='fixbranch', run=True, run_git=True)
++
++ options = parser.parse_args()
++ mover = MoveBlinkSource(FileSystem(), options, get_chromium_src_dir())
++ if options.command == 'update':
++ mover.update()
++ elif options.command == 'move':
++ mover.move()
++ elif options.command == 'fixbranch':
++ mover.fix_branch()
++
++
++if __name__ == '__main__':
++ main()
+--- /dev/null
++++ b/third_party/blink/tools/plan_blink_move.py
+@@ -0,0 +1,96 @@
++#!/usr/bin/env vpython
++# Copyright 2017 The Chromium Authors. All rights reserved.
++# Use of this source code is governed by a BSD-style license that can be
++# found in the LICENSE file.
++
++import os
++import re
++import sys
++
++sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', '..',
++ 'third_party', 'WebKit', 'Tools', 'Scripts'))
++from blinkpy.common.name_style_converter import NameStyleConverter
++from webkitpy.common.system.filesystem import FileSystem
++
++
++def relative_dest(fs, filename):
++ """Returns a destination path string for given filename.
++
++ |filename| is a path relative to third_party/WebKit, and the resultant path
++ is relative to third_party/blink.
++ """
++ dest = None
++ if filename.startswith('public'):
++ dest = re.sub(r'^public', 'renderer' + fs.sep + 'public', filename)
++ elif filename.startswith('Source'):
++ dest = re.sub(r'^Source', 'renderer', filename)
++ elif filename.startswith('common'):
++ dest = filename
++ else:
++ raise ValueError('|filename| must start with "common", "public", or "Source": %s' % filename)
++ if filename.endswith(('.h', '.cpp', '.mm', '.idl', '.typemap', 'Settings.json5')):
++ dirname, basename = fs.split(dest)
++ basename, ext = fs.splitext(basename)
++ # Skip some inspector-related files. #includes for these files are
++ # generated by a script outside of Blink.
++ if (re.match(r'Inspector.*Agent', basename)
++ or basename == 'InspectorTraceEvents'
++ or basename == 'PerformanceMonitor'
++ or basename == 'PlatformTraceEventsAgent'):
++ return dest
++ # Skip CSSProperty*. Some files are generated, and some files are
++ # checked-in. It's hard to handle them automatically.
++ if re.search(r'css[\\/]properties$', dirname):
++ return dest
++ if filename.endswith('.cpp'):
++ ext = '.cc'
++ # WebKit.h should be renamed to blink.h.
++ if basename == 'WebKit' and ext == '.h':
++ basename = 'blink'
++ if basename.lower() != basename:
++ basename = NameStyleConverter(basename).to_snake_case()
++ return fs.join(dirname, basename + ext)
++ return dest
++
++
++def start_with_list(name, prefixes):
++ if len(prefixes) == 0:
++ return True
++ for prefix in prefixes:
++ if name.startswith(prefix):
++ return True
++ return False
++
++
++def plan_blink_move(fs, prefixes):
++ """Returns (source, dest) path pairs.
++
++ The source paths are relative to third_party/WebKit,
++ and the dest paths are relative to third_party/blink.
++ The paths use os.sep as the path part separator.
++ """
++ blink_dir = fs.join(fs.dirname(__file__), '..')
++ webkit_dir = fs.join(blink_dir, '..', '..', 'third_party', 'WebKit')
++ source_files = fs.files_under(fs.join(webkit_dir, 'Source'))
++ source_files += fs.files_under(fs.join(webkit_dir, 'common'))
++ source_files += fs.files_under(fs.join(webkit_dir, 'public'))
++
++ # It's possible to check git.exists() here, but we don't do it due to slow
++ # performance. We should check it just before executing git command.
++
++ source_files = [f[len(webkit_dir) + 1:] for f in source_files]
++ return [(f, relative_dest(fs, f)) for f in source_files
++ if f.find('node_modules') == -1 and start_with_list(f, prefixes)]
++
++
++def main():
++ fs = FileSystem()
++ file_pairs = plan_blink_move(fs, sys.argv[1:])
++ print 'Show renaming plan. It contains files not in the repository.'
++ print '<Source path relative to third_party/WebKit> => <Destination path relative to third_party/blink>'
++ for pair in file_pairs:
++ print '%s\t=>\t%s' % pair
++
++
++if __name__ == '__main__':
++ main()
diff --git a/community/chromium/chromium-48.0.2564.116-libusb_interrupt_event_handler.patch b/community/chromium/chromium-48.0.2564.116-libusb_interrupt_event_handler.patch
deleted file mode 100644
index 2826e34774..0000000000
--- a/community/chromium/chromium-48.0.2564.116-libusb_interrupt_event_handler.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff -up chromium-48.0.2564.116/device/usb/usb_context.cc.modern-libusbx chromium-48.0.2564.116/device/usb/usb_context.cc
---- device/usb/usb_context.cc.modern-libusbx 2016-02-24 10:21:10.534996028 -0500
-+++ device/usb/usb_context.cc 2016-02-24 10:22:28.270499864 -0500
-@@ -57,7 +57,11 @@ void UsbContext::UsbEventHandler::Run()
-
- void UsbContext::UsbEventHandler::Stop() {
- base::subtle::Release_Store(&running_, 0);
-+#ifdef LIBUSB_API_VERSION >= 0x01000105
-+ libusb_interrupt_event_handler(context_);
-+#else
- libusb_interrupt_handle_event(context_);
-+#endif
- }
-
- UsbContext::UsbContext(PlatformUsbContext context) : context_(context) {
diff --git a/community/chromium/chromium-60.0.3112.78-gn-system.patch b/community/chromium/chromium-60.0.3112.78-gn-system.patch
deleted file mode 100644
index bb511bacf0..0000000000
--- a/community/chromium/chromium-60.0.3112.78-gn-system.patch
+++ /dev/null
@@ -1,221 +0,0 @@
-diff -up chromium-60.0.3112.78/build/linux/unbundle/libjpeg.gn.gnsystem chromium-60.0.3112.78/build/linux/unbundle/libjpeg.gn
---- build/linux/unbundle/libjpeg.gn.gnsystem 2017-07-25 15:04:48.000000000 -0400
-+++ build/linux/unbundle/libjpeg.gn 2017-07-31 10:38:25.879951641 -0400
-@@ -16,6 +16,10 @@ source_set("libjpeg") {
- libs = [ "jpeg" ]
- }
-
-+config("system_libjpeg") {
-+ defines = [ "USE_SYSTEM_LIBJPEG=1" ]
-+}
-+
- source_set("simd") {
- }
-
-diff -up chromium-60.0.3112.78/build/linux/unbundle/libusb.gn.gnsystem chromium-60.0.3112.78/build/linux/unbundle/libusb.gn
---- build/linux/unbundle/libusb.gn.gnsystem 2017-07-31 10:38:25.880951622 -0400
-+++ build/linux/unbundle/libusb.gn 2017-07-31 10:38:25.879951641 -0400
-@@ -0,0 +1,24 @@
-+# Copyright 2016 The Chromium Authors. All rights reserved.
-+# Use of this source code is governed by a BSD-style license that can be
-+# found in the LICENSE file.
-+
-+import("//build/config/linux/pkg_config.gni")
-+import("//build/shim_headers.gni")
-+
-+pkg_config("system_libusb") {
-+ packages = [ "libusb-1.0" ]
-+}
-+
-+shim_headers("libusb_shim") {
-+ root_path = "src/libusb"
-+ headers = [
-+ "libusb.h",
-+ ]
-+}
-+
-+source_set("libusb") {
-+ deps = [
-+ ":libusb_shim",
-+ ]
-+ public_configs = [ ":system_libusb" ]
-+}
-diff -up chromium-60.0.3112.78/build/linux/unbundle/opus.gn.gnsystem chromium-60.0.3112.78/build/linux/unbundle/opus.gn
---- build/linux/unbundle/opus.gn.gnsystem 2017-07-25 15:04:48.000000000 -0400
-+++ build/linux/unbundle/opus.gn 2017-07-31 10:38:25.880951622 -0400
-@@ -1,3 +1,164 @@
-+# Copyright 2016 The Chromium Authors. All rights reserved.
-+# Use of this source code is governed by a BSD-style license that can be
-+# found in the LICENSE file.
-+
-+import("//build/config/linux/pkg_config.gni")
-+import("//build/shim_headers.gni")
-+import("//testing/test.gni")
-+
-+pkg_config("system_opus") {
-+ packages = [ "opus" ]
-+}
-+
-+shim_headers("opus_shim") {
-+ root_path = "src/include"
-+ headers = [
-+ "opus_custom.h",
-+ "opus_defines.h",
-+ "opus_multistream.h",
-+ "opus_types.h",
-+ "opus.h",
-+ ]
-+}
-+
-+source_set("opus") {
-+ deps = [
-+ ":opus_shim",
-+ ]
-+ public_configs = [ ":system_opus" ]
-+}
-+
-+config("opus_test_config") {
-+ include_dirs = [
-+ "src/celt",
-+ "src/silk",
-+ ]
-+
-+ if (is_win) {
-+ defines = [ "inline=__inline" ]
-+ }
-+ if (is_android) {
-+ libs = [ "log" ]
-+ }
-+ if (is_clang) {
-+ cflags = [ "-Wno-absolute-value" ]
-+ }
-+}
-+
-+executable("opus_compare") {
-+ sources = [
-+ "src/src/opus_compare.c",
-+ ]
-+
-+ configs -= [ "//build/config/compiler:chromium_code" ]
-+ configs += [
-+ "//build/config/compiler:no_chromium_code",
-+ ":opus_test_config",
-+ ]
-+
-+ deps = [
-+ ":opus",
-+ "//build/config/sanitizers:deps",
-+ "//build/win:default_exe_manifest",
-+ ]
-+}
-+
-+executable("opus_demo") {
-+ sources = [
-+ "src/src/opus_demo.c",
-+ ]
-+
-+ configs -= [ "//build/config/compiler:chromium_code" ]
-+ configs += [
-+ "//build/config/compiler:no_chromium_code",
-+ ":opus_test_config",
-+ ]
-+
-+ deps = [
-+ ":opus",
-+ "//build/config/sanitizers:deps",
-+ "//build/win:default_exe_manifest",
-+ ]
-+}
-+
-+test("test_opus_api") {
-+ sources = [
-+ "src/tests/test_opus_api.c",
-+ ]
-+
-+ configs -= [ "//build/config/compiler:chromium_code" ]
-+ configs += [
-+ "//build/config/compiler:no_chromium_code",
-+ ":opus_test_config",
-+ ]
-+
-+ deps = [
-+ ":opus",
-+ ]
-+}
-+
-+test("test_opus_encode") {
-+ sources = [
-+ "src/tests/test_opus_encode.c",
-+ ]
-+
-+ configs -= [ "//build/config/compiler:chromium_code" ]
-+ configs += [
-+ "//build/config/compiler:no_chromium_code",
-+ ":opus_test_config",
-+ ]
-+
-+ deps = [
-+ ":opus",
-+ ]
-+}
-+
-+# GN orders flags on a target before flags from configs. The default config
-+# adds -Wall, and this flag have to be after -Wall -- so they need to
-+# come from a config and can't be on the target directly.
-+config("test_opus_decode_config") {
-+ # test_opus_decode passes a null pointer to opus_decode() for an argument
-+ # marked as requiring a non-null value by the nonnull function attribute,
-+ # and expects opus_decode() to fail. Disable the -Wnonnull option to avoid
-+ # a compilation error if -Werror is specified.
-+ if (is_posix) {
-+ cflags = [ "-Wno-nonnull" ]
-+ }
-+}
-+
-+test("test_opus_decode") {
-+ sources = [
-+ "src/tests/test_opus_decode.c",
-+ ]
-+
-+ configs -= [ "//build/config/compiler:chromium_code" ]
-+ configs += [
-+ "//build/config/compiler:no_chromium_code",
-+ ":opus_test_config",
-+ ":test_opus_decode_config",
-+ ]
-+
-+ deps = [
-+ ":opus",
-+ ]
-+}
-+
-+test("test_opus_padding") {
-+ sources = [
-+ "src/tests/test_opus_padding.c",
-+ ]
-+
-+ configs -= [ "//build/config/compiler:chromium_code" ]
-+ configs += [
-+ "//build/config/compiler:no_chromium_code",
-+ ":opus_test_config",
-+ ]
-+
-+ deps = [
-+ ":opus",
-+ ]
-+}
-+
- # Copyright 2017 The Chromium Authors. All rights reserved.
- # Use of this source code is governed by a BSD-style license that can be
- # found in the LICENSE file.
-diff -up chromium-60.0.3112.78/build/linux/unbundle/replace_gn_files.py.gnsystem chromium-60.0.3112.78/build/linux/unbundle/replace_gn_files.py
---- build/linux/unbundle/replace_gn_files.py.gnsystem 2017-07-31 10:38:25.880951622 -0400
-+++ build/linux/unbundle/replace_gn_files.py 2017-07-31 10:39:58.067159914 -0400
-@@ -26,6 +26,7 @@ REPLACEMENTS = {
- 'libevent': 'base/third_party/libevent/BUILD.gn',
- 'libjpeg': 'build/secondary/third_party/libjpeg_turbo/BUILD.gn',
- 'libpng': 'third_party/libpng/BUILD.gn',
-+ 'libusb': 'third_party/libusb/BUILD.gn',
- 'libvpx': 'third_party/libvpx/BUILD.gn',
- 'libwebp': 'third_party/libwebp/BUILD.gn',
- 'libxml': 'third_party/libxml/BUILD.gn',
diff --git a/community/chromium/chromium-60.0.3112.78-jpeg-nomangle.patch b/community/chromium/chromium-60.0.3112.78-jpeg-nomangle.patch
deleted file mode 100644
index 3edb054565..0000000000
--- a/community/chromium/chromium-60.0.3112.78-jpeg-nomangle.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-diff -up chromium-60.0.3112.78/third_party/libjpeg_turbo/jpeglib.h.nomangle chromium-60.0.3112.78/third_party/libjpeg_turbo/jpeglib.h
---- chromium-60.0.3112.78/third_party/libjpeg_turbo/jpeglib.h.nomangle 2017-08-01 15:29:00.870759406 -0400
-+++ third_party/libjpeg_turbo/jpeglib.h 2017-08-01 15:29:09.326593414 -0400
-@@ -18,10 +18,6 @@
- #ifndef JPEGLIB_H
- #define JPEGLIB_H
-
--/* Begin chromium edits */
--#include "jpeglibmangler.h"
--/* End chromium edits */
--
- /*
- * First we include the configuration files that record how this
- * installation of the JPEG library is set up. jconfig.h can be
diff --git a/community/chromium/chromium-60.0.3112.78-no-libpng-prefix.patch b/community/chromium/chromium-60.0.3112.78-no-libpng-prefix.patch
deleted file mode 100644
index 489f8e00a2..0000000000
--- a/community/chromium/chromium-60.0.3112.78-no-libpng-prefix.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-diff -up chromium-60.0.3112.78/third_party/libpng/pnglibconf.h.noprefix chromium-60.0.3112.78/third_party/libpng/pnglibconf.h
---- chromium-60.0.3112.78/third_party/libpng/pnglibconf.h.noprefix 2017-08-01 14:42:54.321986758 -0400
-+++ third_party/libpng/pnglibconf.h 2017-08-01 14:43:01.493845832 -0400
-@@ -225,13 +225,4 @@
- #define PNG_USER_CHUNK_MALLOC_MAX 4000000L
- /* end of chromium settings */
-
--/* chromium prefixing */
--/*
-- * This is necessary to build multiple copies of libpng. We need this while pdfium builds
-- * its own copy of libpng.
-- */
--#define PNG_PREFIX
--#include "pngprefix.h"
--/* end of chromium prefixing */
--
- #endif /* PNGLCONF_H */
diff --git a/community/chromium/chromium-60.0.3112.78-no-zlib-mangle.patch b/community/chromium/chromium-60.0.3112.78-no-zlib-mangle.patch
deleted file mode 100644
index 1854dfe488..0000000000
--- a/community/chromium/chromium-60.0.3112.78-no-zlib-mangle.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff -up chromium-60.0.3112.78/third_party/zlib/zconf.h.nozmangle chromium-60.0.3112.78/third_party/zlib/zconf.h
---- chromium-60.0.3112.78/third_party/zlib/zconf.h.nozmangle 2017-08-04 10:45:17.509152089 -0400
-+++ third_party/zlib/zconf.h 2017-08-04 10:45:30.451902380 -0400
-@@ -8,9 +8,6 @@
- #ifndef ZCONF_H
- #define ZCONF_H
-
--/* This include does prefixing as below, but with an updated set of names */
--#include "names.h"
--
- /*
- * If you *really* need a unique prefix for all types and library functions,
- * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
diff --git a/community/chromium/chromium-clang-r2.patch b/community/chromium/chromium-clang-r2.patch
new file mode 100644
index 0000000000..94932b559a
--- /dev/null
+++ b/community/chromium/chromium-clang-r2.patch
@@ -0,0 +1,21 @@
+--- ./build/config/compiler/BUILD.gn
++++ ./build/config/compiler/BUILD.gn
+@@ -422,18 +422,6 @@
+ cflags += [ "-fcolor-diagnostics" ]
+ }
+
+- # TODO(hans): Remove this once Clang generates better optimized debug info by
+- # default. https://crbug.com/765793
+- if (is_clang && !is_nacl && current_toolchain == host_toolchain &&
+- target_os != "chromeos") {
+- cflags += [
+- "-Xclang",
+- "-mllvm",
+- "-Xclang",
+- "-instcombine-lower-dbg-declare=0",
+- ]
+- }
+-
+ # Print absolute paths in diagnostics. There is no precedent for doing this
+ # on Linux/Mac (GCC doesn't support it), but MSVC does this with /FC and
+ # Windows developers rely on it (crbug.com/636109) so only do this on Windows.
diff --git a/community/chromium/chromium-clang-r3.patch b/community/chromium/chromium-clang-r3.patch
new file mode 100644
index 0000000000..0010932b3e
--- /dev/null
+++ b/community/chromium/chromium-clang-r3.patch
@@ -0,0 +1,19 @@
+# Taken from gentoo:
+# https://gitweb.gentoo.org/repo/gentoo.git/plain/www-client/chromium/files/chromium-clang-r3.patch
+#
+# Prevents this error:
+# ../../device/u2f/u2f_ble_transaction.cc:134:27: error: no viable overloaded '='
+# request_cont_fragments_ = {};
+# ~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~
+
+--- ./device/fido/u2f_ble_transaction.cc
++++ ./device/fido/u2f_ble_transaction.cc
+@@ -131,7 +131,7 @@
+
+ void U2fBleTransaction::OnError() {
+ request_frame_.reset();
+- request_cont_fragments_ = {};
++ request_cont_fragments_ = base::queue<U2fBleFrameContinuationFragment>();
+ response_frame_assembler_.reset();
+ std::move(callback_).Run(base::nullopt);
+ }
diff --git a/community/chromium/chromium-gcc-r1.patch b/community/chromium/chromium-gcc-r1.patch
new file mode 100644
index 0000000000..6979b11451
--- /dev/null
+++ b/community/chromium/chromium-gcc-r1.patch
@@ -0,0 +1,14 @@
+diff --git a/base/numerics/safe_math_shared_impl.h b/base/numerics/safe_math_shared_impl.h
+index 99f230ce7e9a..de2415d402f5 100644
+--- base/numerics/safe_math_shared_impl.h
++++ base/numerics/safe_math_shared_impl.h
+@@ -21,8 +21,7 @@
+ #if !defined(__native_client__) && \
+ ((defined(__clang__) && \
+ ((__clang_major__ > 3) || \
+- (__clang_major__ == 3 && __clang_minor__ >= 4))) || \
+- (defined(__GNUC__) && __GNUC__ >= 5))
++ (__clang_major__ == 3 && __clang_minor__ >= 4))))
+ #include "base/numerics/safe_math_clang_gcc_impl.h"
+ #define BASE_HAS_OPTIMIZED_SAFE_MATH (1)
+ #else
diff --git a/community/chromium/chromium-skia-harmony.patch b/community/chromium/chromium-skia-harmony.patch
new file mode 100644
index 0000000000..04e27b1216
--- /dev/null
+++ b/community/chromium/chromium-skia-harmony.patch
@@ -0,0 +1,77 @@
+--- third_party/skia/src/ports/SkFontHost_FreeType.cpp.orig 2017-10-10 17:42:06.956950985 +0200
++++ third_party/skia/src/ports/SkFontHost_FreeType.cpp 2017-10-10 17:46:05.824187787 +0200
+@@ -99,8 +99,6 @@
+ FreeTypeLibrary()
+ : fGetVarDesignCoordinates(nullptr)
+ , fLibrary(nullptr)
+- , fIsLCDSupported(false)
+- , fLCDExtra(0)
+ {
+ if (FT_New_Library(&gFTMemory, &fLibrary)) {
+ return;
+@@ -147,12 +145,7 @@
+ }
+ #endif
+
+- // Setup LCD filtering. This reduces color fringes for LCD smoothed glyphs.
+- // The default has changed over time, so this doesn't mean the same thing to all users.
+- if (FT_Library_SetLcdFilter(fLibrary, FT_LCD_FILTER_DEFAULT) == 0) {
+- fIsLCDSupported = true;
+- fLCDExtra = 2; //Using a filter adds one full pixel to each side.
+- }
++ FT_Library_SetLcdFilter(fLibrary, FT_LCD_FILTER_DEFAULT);
+ }
+ ~FreeTypeLibrary() {
+ if (fLibrary) {
+@@ -161,8 +153,6 @@
+ }
+
+ FT_Library library() { return fLibrary; }
+- bool isLCDSupported() { return fIsLCDSupported; }
+- int lcdExtra() { return fLCDExtra; }
+
+ // FT_Get_{MM,Var}_{Blend,Design}_Coordinates were added in FreeType 2.7.1.
+ // Prior to this there was no way to get the coordinates out of the FT_Face.
+@@ -173,8 +163,6 @@
+
+ private:
+ FT_Library fLibrary;
+- bool fIsLCDSupported;
+- int fLCDExtra;
+
+ // FT_Library_SetLcdFilterWeights was introduced in FreeType 2.4.0.
+ // The following platforms provide FreeType of at least 2.4.0.
+@@ -704,17 +692,6 @@
+ rec->fTextSize = SkIntToScalar(1 << 14);
+ }
+
+- if (isLCD(*rec)) {
+- // TODO: re-work so that FreeType is set-up and selected by the SkFontMgr.
+- SkAutoMutexAcquire ama(gFTMutex);
+- ref_ft_library();
+- if (!gFTLibrary->isLCDSupported()) {
+- // If the runtime Freetype library doesn't support LCD, disable it here.
+- rec->fMaskFormat = SkMask::kA8_Format;
+- }
+- unref_ft_library();
+- }
+-
+ SkPaint::Hinting h = rec->getHinting();
+ if (SkPaint::kFull_Hinting == h && !isLCD(*rec)) {
+ // collapse full->normal hinting if we're not doing LCD
+@@ -1115,11 +1092,11 @@
+ void SkScalerContext_FreeType::updateGlyphIfLCD(SkGlyph* glyph) {
+ if (isLCD(fRec)) {
+ if (fLCDIsVert) {
+- glyph->fHeight += gFTLibrary->lcdExtra();
+- glyph->fTop -= gFTLibrary->lcdExtra() >> 1;
++ glyph->fHeight += 2;
++ glyph->fTop -= 1;
+ } else {
+- glyph->fWidth += gFTLibrary->lcdExtra();
+- glyph->fLeft -= gFTLibrary->lcdExtra() >> 1;
++ glyph->fWidth += 2;
++ glyph->fLeft -= 1;
+ }
+ }
+ }
diff --git a/community/chromium/gcc6.patch b/community/chromium/gcc6.patch
index eeef288144..036502c57e 100644
--- a/community/chromium/gcc6.patch
+++ b/community/chromium/gcc6.patch
@@ -10,16 +10,3 @@ index 45fee9a..0769c41 100644
}
# This is included by reference in the //build/config/compiler:runtime_library
-diff --git a/third_party/angle/src/compiler/translator/Types.h b/third_party/angle/src/compiler/translator/Types.h
-index 77db3ac..201ed4e 100644
---- third_party/angle/src/compiler/translator/Types.h
-+++ third_party/angle/src/compiler/translator/Types.h
-@@ -236,7 +236,7 @@ class TType
- {
- }
-
-- TBasicType getBasicType() const { return type; }
-+ constexpr TBasicType getBasicType() const { return type; }
- void setBasicType(TBasicType t);
-
- TPrecision getPrecision() const { return precision; }
diff --git a/community/chromium/gn_bootstrap.patch b/community/chromium/gn_bootstrap.patch
index 82def2e1a5..5929742125 100644
--- a/community/chromium/gn_bootstrap.patch
+++ b/community/chromium/gn_bootstrap.patch
@@ -1,8 +1,21 @@
+diff --git a/base/message_loop/message_pump_libevent.cc b/base/message_loop/message_pump_libevent.cc
+index dc5efc6..a9f1ec0 100644
+--- base/message_loop/message_pump_libevent.cc
++++ base/message_loop/message_pump_libevent.cc
+@@ -14,7 +14,7 @@
+ #include "base/files/file_util.h"
+ #include "base/logging.h"
+ #include "base/posix/eintr_wrapper.h"
+-#include "base/third_party/libevent/event.h"
++#include "event.h"
+ #include "base/time/time.h"
+ #include "base/trace_event/trace_event.h"
+ #include "build/build_config.h"
diff --git a/tools/gn/bootstrap/bootstrap.py b/tools/gn/bootstrap/bootstrap.py
-index 1390560..5ce7832 100755
+index 2bf25e5..0ddc537 100755
--- tools/gn/bootstrap/bootstrap.py
+++ tools/gn/bootstrap/bootstrap.py
-@@ -31,6 +32,7 @@ SRC_ROOT = os.path.dirname(os.path.dirname(GN_ROOT))
+@@ -32,6 +32,7 @@ SRC_ROOT = os.path.dirname(os.path.dirname(GN_ROOT))
is_win = sys.platform.startswith('win')
is_linux = sys.platform.startswith('linux')
@@ -10,16 +23,16 @@ index 1390560..5ce7832 100755
is_mac = sys.platform.startswith('darwin')
is_aix = sys.platform.startswith('aix')
is_posix = is_linux or is_mac or is_aix
-@@ -167,7 +169,7 @@ def build_gn_with_ninja_manually(tempdir, options):
- mkdir_p(root_gen_dir)
+@@ -184,7 +185,7 @@ def build_gn_with_ninja_manually(tempdir, options):
+ {'ENABLE_MUTEX_PRIORITY_INHERITANCE': 'false'})
- write_buildflag_header_manually(root_gen_dir, 'base/allocator/features.h',
+ write_buildflag_header_manually(root_gen_dir, 'base/allocator/buildflags.h',
- {'USE_ALLOCATOR_SHIM': 'true' if is_linux else 'false'})
+ {'USE_ALLOCATOR_SHIM': 'true' if is_gnu_linux else 'false'})
- write_buildflag_header_manually(root_gen_dir, 'base/debug/debugging_flags.h',
- {
-@@ -395,8 +397,6 @@ def write_gn_ninja(path, root_gen_dir, options):
+ write_buildflag_header_manually(root_gen_dir,
+ 'base/debug/debugging_buildflags.h',
+@@ -438,8 +439,6 @@ def write_gn_ninja(path, root_gen_dir, options):
'base/third_party/superfasthash/superfasthash.c',
])
static_libraries['base']['sources'].extend([
@@ -28,19 +41,54 @@ index 1390560..5ce7832 100755
'base/at_exit.cc',
'base/base_paths.cc',
'base/base_switches.cc',
-@@ -653,10 +654,11 @@ def write_gn_ninja(path, root_gen_dir, options):
- 'base/threading/platform_thread_linux.cc',
+@@ -641,26 +640,6 @@ def write_gn_ninja(path, root_gen_dir, options):
+ 'base/time/time_conversion_posix.cc',
+ 'base/trace_event/heap_profiler_allocation_register_posix.cc',
])
- if is_linux:
+- static_libraries['libevent'] = {
+- 'sources': [
+- 'base/third_party/libevent/buffer.c',
+- 'base/third_party/libevent/evbuffer.c',
+- 'base/third_party/libevent/evdns.c',
+- 'base/third_party/libevent/event.c',
+- 'base/third_party/libevent/event_tagging.c',
+- 'base/third_party/libevent/evrpc.c',
+- 'base/third_party/libevent/evutil.c',
+- 'base/third_party/libevent/http.c',
+- 'base/third_party/libevent/log.c',
+- 'base/third_party/libevent/poll.c',
+- 'base/third_party/libevent/select.c',
+- 'base/third_party/libevent/signal.c',
+- 'base/third_party/libevent/strlcpy.c',
+- ],
+- 'tool': 'cc',
+- 'include_dirs': [],
+- 'cflags': cflags + ['-DHAVE_CONFIG_H'],
+- }
+
+ if is_linux or is_aix:
+ static_libraries['xdg_user_dirs'] = {
+@@ -767,17 +746,12 @@ def write_gn_ninja(path, root_gen_dir, options):
+ '-D_LIBCXXABI_NO_EXCEPTIONS',
+ ]
+ }
- static_libraries['base']['sources'].extend([
- 'base/allocator/allocator_shim.cc',
- 'base/allocator/allocator_shim_default_dispatch_to_glibc.cc',
- ])
+- libs.extend(['-lrt', '-latomic'])
+- static_libraries['libevent']['include_dirs'].extend([
+- os.path.join(SRC_ROOT, 'base', 'third_party', 'libevent', 'linux')
+- ])
+- static_libraries['libevent']['sources'].extend([
+- 'base/third_party/libevent/epoll.c',
+- ])
+ if is_gnu_linux:
+ static_libraries['base']['sources'].extend([
+ 'base/allocator/allocator_shim.cc',
+ 'base/allocator/allocator_shim_default_dispatch_to_glibc.cc',
+ ])
- libs.extend(['-lrt', '-latomic'])
- static_libraries['libevent']['include_dirs'].extend([
- os.path.join(SRC_ROOT, 'base', 'third_party', 'libevent', 'linux')
++ libs.extend(['-lrt', '-levent'])
+ else:
+ ldflags.extend(['-pthread'])
+ libs.extend(['-lrt'])
diff --git a/community/chromium/no-execinfo.patch b/community/chromium/no-execinfo.patch
index 231cf33cff..4b5e2fa4e6 100644
--- a/community/chromium/no-execinfo.patch
+++ b/community/chromium/no-execinfo.patch
@@ -86,25 +86,3 @@ index 9bdece7..0c76188 100644
#include <cxxabi.h>
#include <dlfcn.h>
#include <execinfo.h>
-diff --git a/third_party/webrtc/rtc_base/checks.cc b/third_party/webrtc/rtc_base/checks.cc
-index 533240f..08b3f3e 100644
---- a/third_party/webrtc/rtc_base/checks.cc
-+++ third_party/webrtc/rtc_base/checks.cc
-@@ -16,7 +16,7 @@
- #include <cstdio>
- #include <cstdlib>
-
--#if defined(__GLIBCXX__) && !defined(__UCLIBC__)
-+#if defined(__GLIBCXX__) && defined(__GLIBC__)
- #include <cxxabi.h>
- #include <execinfo.h>
- #endif
-@@ -60,7 +60,7 @@ void PrintError(const char* format, ...) {
- // to get usable symbols on Linux. This is copied from V8. Chromium has a more
- // advanced stace trace system; also more difficult to copy.
- void DumpBacktrace() {
--#if defined(__GLIBCXX__) && !defined(__UCLIBC__)
-+#if defined(__GLIBCXX__) && defined(__GLIBC__)
- void* trace[100];
- int size = backtrace(trace, sizeof(trace) / sizeof(*trace));
- char** symbols = backtrace_symbols(trace, size);
diff --git a/community/chromium/secure_getenv.patch b/community/chromium/secure_getenv.patch
index b28b77ef79..d142819ffb 100644
--- a/community/chromium/secure_getenv.patch
+++ b/community/chromium/secure_getenv.patch
@@ -1,22 +1,7 @@
-diff --git a/third_party/angle/src/vulkan_support/BUILD.gn b/third_party/angle/src/vulkan_support/BUILD.gn
-index 51c8c10..fb70649 100644
---- third_party/angle/src/vulkan_support/BUILD.gn
-+++ third_party/angle/src/vulkan_support/BUILD.gn
-@@ -204,8 +204,8 @@ config("vulkan_loader_config") {
- cflags = [ "/wd4201" ]
- }
- if (is_linux) {
-- # assume secure_getenv() is available
-- defines += [ "HAVE_SECURE_GETENV" ]
-+ # assume getauxval() is available
-+ defines += [ "HAVE_GETAUXVAL" ]
- }
- }
-
diff --git a/third_party/vulkan-validation-layers/src/loader/loader.c b/third_party/vulkan-validation-layers/src/loader/loader.c
index facddc1..b6a8ee9 100644
---- third_party/vulkan-validation-layers/src/loader/loader.c
-+++ third_party/vulkan-validation-layers/src/loader/loader.c
+--- ./third_party/angle/third_party/vulkan-validation-layers/src/loader/loader.c
++++ ./third_party/angle/third_party/vulkan-validation-layers/src/loader/loader.c
@@ -31,6 +31,9 @@
#include <stdbool.h>
#include <string.h>
@@ -36,3 +21,15 @@ index facddc1..b6a8ee9 100644
#else
#pragma message("Warning: Falling back to non-secure getenv for environmental lookups! Consider" \
" updating to a different libc.")
+--- ./third_party/angle/third_party/vulkan-validation-layers/BUILD.gn.orig
++++ ./third_party/angle/third_party/vulkan-validation-layers/BUILD.gn
+@@ -264,8 +264,7 @@
+ cflags = [ "/wd4201" ]
+ }
+ if (is_linux) {
+- # assume secure_getenv() is available
+- defines += [ "HAVE_SECURE_GETENV" ]
++ defines += [ "HAVE_GETAUXVAL" ]
+ }
+ }
+