├── .dockerignore ├── .gitattributes ├── .github ├── CODEOWNERS ├── PULL_REQUEST_TEMPLATE.md └── config.yml ├── .gitignore ├── .gitmodules ├── DEPS ├── LICENSE.txt ├── README.md ├── VERSION ├── chromiumcontent ├── BUILD.gn ├── args │ ├── ffmpeg.gn │ ├── native_mksnapshot.gn │ ├── shared_library.gn │ ├── static_library.gn │ └── tests.gn ├── build_libs.py └── config │ ├── BUILD.gn │ └── features.gni ├── patches ├── common │ ├── angle │ │ ├── .patches.yaml │ │ └── dcheck.patch │ ├── boringssl │ │ ├── .patches.yaml │ │ ├── 0001-Implement-legacy-OCSP-APIs-for-libssl.patch │ │ └── implement-SSL_get_tlsext_status_type.patch │ ├── chromium │ │ ├── .patches.yaml │ │ ├── accelerator.patch │ │ ├── add_atomic_lib_to_dependencies_even_for_sysroot_builds.patch │ │ ├── add_realloc.patch │ │ ├── allow_chromiumcontent_to_depend_on_device_service.patch │ │ ├── allow_nested_error_trackers.patch │ │ ├── allow_new_privs.patch │ │ ├── allow_webview_file_url.patch │ │ ├── app_indicator_icon_menu.patch │ │ ├── backport_d65792a.patch │ │ ├── blink-worker-enable-csp-in-file-scheme.patch │ │ ├── blink_file_path.patch │ │ ├── blink_fix_prototype_assert.patch │ │ ├── blink_initialization_order.patch │ │ ├── blink_local_frame.patch │ │ ├── blink_world_context.patch │ │ ├── boringssl_build_gn.patch │ │ ├── browser_compositor_mac.patch │ │ ├── browser_plugin_guest.patch │ │ ├── browser_plugin_wheel.patch │ │ ├── build_gn.patch │ │ ├── build_toolchain_win_patch.patch │ │ ├── can_create_window.patch │ │ ├── chrome_key_systems.patch │ │ ├── compositor_delegate.patch │ │ ├── content_browser_manifest.patch │ │ ├── crashpad-disabled-windows.patch │ │ ├── dcheck.patch │ │ ├── desktop_screen_win.patch │ │ ├── disable-recursive-surface-sync.patch │ │ ├── disable-redraw-lock.patch │ │ ├── disable_detach_webview_frame.patch │ │ ├── disable_hidden.patch │ │ ├── disable_scroll_begin_dcheck.patch │ │ ├── disable_user_gesture_requirement_for_beforeunload_dialogs.patch │ │ ├── dom_storage_map.patch │ │ ├── enable_osr_components.patch │ │ ├── enable_widevine.patch │ │ ├── export_blink_webdisplayitemlist.patch │ │ ├── fix-arm64-linking-error.patch │ │ ├── frame_host_manager.patch │ │ ├── gin_enable_disable_v8_platform.patch │ │ ├── gtk_visibility.patch │ │ ├── ignore_rc_check.patch │ │ ├── latency_info.patch │ │ ├── leveldb_ssize_t.patch │ │ ├── libgtkui_export.patch │ │ ├── mas-audiodeviceduck.patch │ │ ├── mas-cfisobjc.patch │ │ ├── mas-cgdisplayusesforcetogray.patch │ │ ├── mas-lssetapplicationlaunchservicesserverconnectionstatus.patch │ │ ├── mas_blink_no_private_api.patch │ │ ├── mas_no_private_api.patch │ │ ├── net_url_request_job.patch │ │ ├── no_cache_storage_check.patch │ │ ├── no_stack_dumping.patch │ │ ├── out_of_process_instance.patch │ │ ├── pepper_flash.patch │ │ ├── protobuf_build_gn.patch │ │ ├── render_widget_host_view_base.patch │ │ ├── render_widget_host_view_mac.patch │ │ ├── resource_file_conflict.patch │ │ ├── scoped_clipboard_writer.patch │ │ ├── scroll_bounce_flag.patch │ │ ├── ssl_security_state_tab_helper.patch │ │ ├── statically_build_power_save_blocker.patch │ │ ├── stream_resource_handler.patch │ │ ├── sysroot.patch │ │ ├── thread_capabilities.patch │ │ ├── use_transparent_window.patch │ │ ├── v8_context_snapshot_generator.patch │ │ ├── web_contents.patch │ │ ├── webgl_context_attributes.patch │ │ ├── webui_in_subframes.patch │ │ ├── webview_cross_drag.patch │ │ ├── webview_reattach.patch │ │ ├── windows_cc_wrapper.patch │ │ └── worker_context_will_destroy.patch │ ├── crashpad │ │ ├── .patches.yaml │ │ └── http_status.patch │ ├── ffmpeg │ │ ├── .patches.yaml │ │ ├── build_gn.patch │ │ └── fix_build_on_linux_x86.patch │ ├── icu │ │ ├── .patches.yaml │ │ ├── build_gn.patch │ │ └── no_inline_default_constructor.patch │ ├── skia │ │ ├── .patches.yaml │ │ └── dcheck.patch │ ├── v8 │ │ ├── .patches.yaml │ │ ├── add_realloc.patch │ │ ├── array_buffer.patch │ │ ├── backport_23652c5f.patch │ │ ├── backport_39d546a.patch │ │ ├── backport_91ddb65d.patch │ │ ├── backport_9fb02b526.patch │ │ ├── backport_aa6ce3e.patch │ │ ├── backport_ff0a97933.patch │ │ ├── build_gn.patch │ │ ├── cherry-pick_5dd3395.patch │ │ ├── cherry-pick_6989b3f6d7.patch │ │ ├── cherry-pick_70c4340.patch │ │ ├── cherry-pick_a440efb27f.patch │ │ ├── cherry-pick_acc336c.patch │ │ ├── cherry-pick_b20faff.patch │ │ ├── dcheck.patch │ │ ├── disable-warning-win.patch │ │ ├── export_platform.patch │ │ └── ostreams.patch │ └── webrtc │ │ ├── .patches.yaml │ │ ├── allow_chromiumcontent_to_depend_on_webrtc_common.patch │ │ ├── disable-warning-win.patch │ │ ├── webrtc-desktop_capturer_mac.patch │ │ └── webrtc-rwlock_null.patch └── mips64el │ ├── chromium │ ├── .patches.yaml │ ├── Add-mips64el-redhat-linux-to-gcc_toolchain-for-mips6.patch │ ├── Add-support-for-using-seccomp_bpf-on-mips64el.patch │ ├── Fix-error-about-relocation-truncated-to-fit-R_MIPS_C.patch │ ├── Fix-mips-cross-toolchain-build-src-crypto-ec-p256-64.patch │ ├── Set-kernal-page-size-to-16K-on-loongson-MIPS-archtec.patch │ ├── backport-sqlite-3d8ec48.patch │ ├── backport-sqlite-8a87f7e.patch │ ├── backport-sqlite-9851f2e.patch │ └── support-old-nss.patch │ ├── ffmpeg │ ├── .patches.yaml │ └── Fix-build_ffmpeg-with-cross-prefix-mips64el-redhat-l.patch │ └── v8 │ ├── .patches.yaml │ └── Fix-v8-loongson-page-size.patch ├── resources ├── about_credits.tmpl └── about_credits_entry.tmpl ├── script ├── README.md ├── apply-patches ├── bootstrap ├── build ├── build-clang.py ├── cibuild ├── cibuild-libchromiumcontent-linux ├── cibuild-libchromiumcontent-linux-arm ├── cibuild-libchromiumcontent-linux-arm64 ├── cibuild-libchromiumcontent-linux-ia32 ├── cibuild-libchromiumcontent-linux-mips64el ├── cibuild-libchromiumcontent-linux-x64 ├── cibuild.ps1 ├── create-dist ├── disabled-tests.yaml ├── docker-install-build-deps.sh ├── download ├── get-patch ├── lib │ ├── __init__.py │ ├── config.py │ ├── filesystem.py │ ├── git.py │ ├── gn.py │ ├── ninja.py │ ├── patches.py │ ├── sccache.py │ └── util.py ├── package-clang.py ├── patch.py ├── run-gn ├── run_tests ├── sccache ├── update └── upload └── tools ├── copy.py ├── generate_filenames_gypi.py ├── licenses.py ├── linux └── ar-combine.sh └── sccache ├── README.md └── aad2120 ├── LICENSE ├── README.md ├── linux └── sccache ├── mac └── sccache └── windows └── sccache.exe /.dockerignore: -------------------------------------------------------------------------------- 1 | src 2 | dist 3 | .git 4 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Don't mess up with CRLF line ending on Windows 2 | *.py text eol=lf 3 | *.patch text eol=lf 4 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Order is important. The LAST matching pattern has the MOST precedence. 2 | # gitignore style patterns are used, not globs. 3 | # https://help.github.com/articles/about-codeowners 4 | # https://git-scm.com/docs/gitignore 5 | 6 | * @electron/libcc 7 | /.github/ @electron/hubbers -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ##### Description of Change 2 | 3 | 4 | ##### Checklist 5 | 6 | 7 | - [ ] PR description included and stakeholders cc'd 8 | - [ ] Patch information is added to appropriate `.patches.yaml` 9 | - [ ] `script/update` runs without error 10 | - [ ] PR title follows semantic [commit guidelines](https://github.com/electron/electron/blob/master/docs/development/pull-requests.md#commit-message-guidelines) -------------------------------------------------------------------------------- /.github/config.yml: -------------------------------------------------------------------------------- 1 | authorizedUsers: 2 | - alexeykuzmin 3 | - ckerr 4 | - codebytere 5 | - deepak1556 6 | - jkleinsc 7 | - MarshallOfSound 8 | - nitsakh 9 | - nornagon 10 | - zcbenz 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.swp 3 | *.pyc 4 | /dist/ 5 | /src/ 6 | /libchromiumcontent.tar.bz2 7 | /libchromiumcontent-static.tar.bz2 8 | /vendor/binutils-aarch64 9 | /vendor/cross-gcc-4.9.3-n64-loongson-rc5.4 10 | .gclient 11 | .gclient_entries 12 | _gclient_src_* 13 | s3credentials 14 | /native-mksnapshot.tar.bz2 15 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "vendor/depot_tools"] 2 | path = vendor/depot_tools 3 | url = https://chromium.googlesource.com/chromium/tools/depot_tools.git 4 | [submodule "vendor/boto"] 5 | path = vendor/boto 6 | url = https://github.com/piotrbulinski/boto.git 7 | ignore = untracked 8 | [submodule "vendor/pyyaml"] 9 | path = vendor/pyyaml 10 | url = https://github.com/yaml/pyyaml.git 11 | ignore = dirty 12 | -------------------------------------------------------------------------------- /DEPS: -------------------------------------------------------------------------------- 1 | use_relative_paths = True 2 | 3 | vars = { 4 | 'pyyaml_version': '3.12', 5 | 'yaml_git': 6 | 'https://github.com/yaml', 7 | } 8 | 9 | deps = { 10 | "vendor/pyyaml": (Var("yaml_git")) + '/pyyaml.git@' + (Var("pyyaml_version")), 11 | } 12 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Adam Roben 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 7 | of the Software, and to permit persons to whom the Software is furnished to do 8 | so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ⚠️⚠️⚠️ DEPRECATED ⚠️⚠️⚠️ 2 | 3 | As of Electron 4.0.0, libchromiumcontent is no longer built separately from Electron. 4 | 5 | See [Updated Electron build instructions](https://github.com/electron/electron/blob/master/docs/development/build-instructions-gn.md). 6 | 7 | ### Older versions 8 | 9 | If you're trying to build a pre-4.0.0 version of Electron, look at one of the old branches in this repo: 10 | 11 | - [electron-3-0-x](https://github.com/electron/libchromiumcontent/tree/electron-3-0-x) 12 | - [electron-2-0-x](https://github.com/electron/libchromiumcontent/tree/electron-2-0-x) 13 | - [electron-1-8-x](https://github.com/electron/libchromiumcontent/tree/electron-1-8-x) 14 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 67.0.3396.99 2 | -------------------------------------------------------------------------------- /chromiumcontent/args/ffmpeg.gn: -------------------------------------------------------------------------------- 1 | root_extra_deps = [ "//libchromiumcontent/chromiumcontent" ] 2 | is_component_build = false 3 | is_mas_build = getenv("MAS_BUILD") != "" 4 | is_debug = false 5 | enable_nacl = false 6 | proprietary_codecs = false 7 | is_component_ffmpeg = true 8 | ffmpeg_branding = "Chromium" 9 | 10 | # As of Chromium 67.0.3396.99 widevine is only supported on Mac and Windows. 11 | if (target_os != "linux") { 12 | enable_widevine = true 13 | } 14 | 15 | # Use the system provided standard library on platforms other than Linux. 16 | if (target_os != "linux") { 17 | use_custom_libcxx = false 18 | } 19 | 20 | # Jumbo build should improve compilation times. 21 | # https://chromium.googlesource.com/chromium/src/+/master/docs/jumbo.md 22 | use_jumbo_build = true 23 | 24 | if (target_cpu == "arm64") { 25 | # Suppress the linking warning for arm64: 26 | # warning: libfreetype.so.6, needed by ../../build/linux/debian_jessie_arm64-sysroot/usr/lib/aarch64-linux-gnu/libfontconfig.so, may conflict with libfreetype.so.6 27 | fatal_linker_warnings = false 28 | } 29 | 30 | # ERROR at //chrome/installer/linux/BUILD.gn:385:7: Assertion failed. 31 | # Linux installer not configured for this architecture. 32 | if (target_cpu == "arm64") { 33 | enable_linux_installer = false 34 | } 35 | 36 | # Configuration for mips64el 37 | if (target_cpu == "mips64el") { 38 | is_clang = false 39 | use_allocator = "none" 40 | mips_arch_variant = "loongson3" 41 | # Use custom sysroot image. 42 | use_sysroot = true 43 | target_sysroot = "//build/linux/debian_jessie_mips64-sysroot" 44 | system_libdir = "lib64" 45 | } 46 | -------------------------------------------------------------------------------- /chromiumcontent/args/native_mksnapshot.gn: -------------------------------------------------------------------------------- 1 | root_extra_deps = [ "//v8:v8_maybe_snapshot" ] 2 | is_electron_build = true 3 | is_mas_build = getenv("MAS_BUILD") != "" 4 | is_component_build = false 5 | is_debug = false 6 | enable_linux_installer = false 7 | v8_use_snapshot = true 8 | v8_enable_i18n_support = false 9 | enable_nacl = false 10 | if (target_cpu == "arm") { 11 | v8_snapshot_toolchain="//build/toolchain/linux:clang_arm" 12 | } 13 | 14 | if (target_cpu == "arm64") { 15 | v8_snapshot_toolchain="//build/toolchain/linux:clang_arm64" 16 | } 17 | -------------------------------------------------------------------------------- /chromiumcontent/args/shared_library.gn: -------------------------------------------------------------------------------- 1 | root_extra_deps = [ "//libchromiumcontent/chromiumcontent" ] 2 | is_electron_build = true 3 | is_component_build = true 4 | is_mas_build = getenv("MAS_BUILD") != "" 5 | is_debug = true 6 | symbol_level = 2 7 | use_allocator = "none" # on Linux this defaults to "tcmalloc", but tcmalloc deadlocks when Electron CI tests are run inside Docker 8 | enable_nacl = false 9 | enable_cdm_host_verification = false 10 | proprietary_codecs = true 11 | is_component_ffmpeg = true 12 | ffmpeg_branding = "Chrome" 13 | 14 | # This may be guarded behind is_chrome_branded alongside 15 | # proprietary_codecs https://webrtc-review.googlesource.com/c/src/+/36321, 16 | # explicitly override here to build OpenH264 encoder/FFmpeg decoder. 17 | # The initialization of the decoder depends on whether ffmpeg has 18 | # been built with H.264 support. 19 | rtc_use_h264 = true 20 | 21 | # As of Chromium 67.0.3396.99 widevine is only supported on Mac and Windows. 22 | if (target_os != "linux") { 23 | enable_widevine = true 24 | } 25 | 26 | # Use the system provided standard library on platforms other than Linux. 27 | if (target_os != "linux") { 28 | use_custom_libcxx = false 29 | } 30 | 31 | # Jumbo build should improve compilation times. 32 | # https://chromium.googlesource.com/chromium/src/+/master/docs/jumbo.md 33 | use_jumbo_build = true 34 | 35 | # This is required by Node.js 36 | # See https://github.com/nodejs/node/pull/13242 37 | v8_promise_internal_field_count = 1 38 | 39 | # This is required by Node.js 40 | # Unconditionally force typed arrays to allocate outside the v8 heap. This 41 | # is to prevent memory pointers from being moved around that are returned by 42 | # Buffer::Data() 43 | v8_typed_array_max_size_in_heap = 0 44 | 45 | # Suppress the linking warning for arm64: 46 | # warning: libfreetype.so.6, needed by ../../build/linux/debian_jessie_arm64-sysroot/usr/lib/aarch64-linux-gnu/libfontconfig.so, may conflict with libfreetype.so.6 47 | if (target_cpu == "arm64") { 48 | fatal_linker_warnings = false 49 | } 50 | 51 | # Configuration for mips64el 52 | if (target_cpu == "mips64el") { 53 | is_clang = false 54 | use_allocator = "none" 55 | mips_arch_variant = "loongson3" 56 | # Use custom sysroot image. 57 | use_sysroot = true 58 | target_sysroot = "//build/linux/debian_jessie_mips64-sysroot" 59 | system_libdir = "lib64" 60 | } 61 | -------------------------------------------------------------------------------- /chromiumcontent/args/static_library.gn: -------------------------------------------------------------------------------- 1 | root_extra_deps = [ "//libchromiumcontent/chromiumcontent" ] 2 | is_electron_build = true 3 | is_component_build = false 4 | is_mas_build = getenv("MAS_BUILD") != "" 5 | is_official_build = true 6 | symbol_level = 2 7 | enable_nacl = false 8 | enable_cdm_host_verification = false 9 | proprietary_codecs = true 10 | is_component_ffmpeg = true 11 | ffmpeg_branding = "Chrome" 12 | 13 | # This may be guarded behind is_chrome_branded alongside 14 | # proprietary_codecs https://webrtc-review.googlesource.com/c/src/+/36321, 15 | # explicitly override here to build OpenH264 encoder/FFmpeg decoder. 16 | # The initialization of the decoder depends on whether ffmpeg has 17 | # been built with H.264 support. 18 | rtc_use_h264 = true 19 | 20 | # As of Chromium 67.0.3396.99 widevine is only supported on Mac and Windows. 21 | if (target_os != "linux") { 22 | enable_widevine = true 23 | } 24 | 25 | # CFI is disabled for the time being, as Electron is not a monolithic binary 26 | # with at least one shared library component (Node) and CFI is tricky in that 27 | # scenario 28 | is_cfi = false 29 | 30 | # Use the system provided standard library on platforms other than Linux. 31 | if (target_os != "linux") { 32 | use_custom_libcxx = false 33 | } 34 | 35 | # Jumbo build should improve compilation times. 36 | # https://chromium.googlesource.com/chromium/src/+/master/docs/jumbo.md 37 | use_jumbo_build = true 38 | 39 | # This is required by Node.js 40 | # See https://github.com/nodejs/node/pull/13242 41 | v8_promise_internal_field_count = 1 42 | 43 | # This is required by Node.js 44 | # Unconditionally force typed arrays to allocate outside the v8 heap. This 45 | # is to prevent memory pointers from being moved around that are returned by 46 | # Buffer::Data() 47 | v8_typed_array_max_size_in_heap = 0 48 | 49 | # Suppress the linking warning for arm64: 50 | # warning: libfreetype.so.6, needed by ../../build/linux/debian_jessie_arm64-sysroot/usr/lib/aarch64-linux-gnu/libfontconfig.so, may conflict with libfreetype.so.6 51 | if (target_cpu == "arm64") { 52 | fatal_linker_warnings = false 53 | } 54 | 55 | # ERROR at //chrome/installer/linux/BUILD.gn:385:7: Assertion failed. 56 | # Linux installer not configured for this architecture. 57 | if (target_cpu == "arm64") { 58 | enable_linux_installer = false 59 | } 60 | 61 | # On Windows, we cannot use allocator shim because even though this is 62 | # a non-component build, we still use the dynamic CRT with which the shim 63 | # does not work 64 | if (target_os == "win") { 65 | use_allocator_shim = false 66 | } 67 | 68 | # Configuration for mips64el 69 | if (target_cpu == "mips64el") { 70 | is_clang = false 71 | use_allocator = "none" 72 | mips_arch_variant = "loongson3" 73 | # Use custom sysroot image. 74 | use_sysroot = true 75 | target_sysroot = "//build/linux/debian_jessie_mips64-sysroot" 76 | system_libdir = "lib64" 77 | } 78 | -------------------------------------------------------------------------------- /chromiumcontent/args/tests.gn: -------------------------------------------------------------------------------- 1 | root_extra_deps = [ "//libchromiumcontent/chromiumcontent:chromiumcontent_tests" ] 2 | is_debug = false 3 | is_electron_build = true 4 | is_mas_build = getenv("MAS_BUILD") != "" 5 | is_component_build = true 6 | dcheck_always_on = true 7 | symbol_level = 1 8 | enable_nacl = false 9 | 10 | # Jumbo build should improve compilation times. 11 | # https://chromium.googlesource.com/chromium/src/+/master/docs/jumbo.md 12 | use_jumbo_build = true 13 | 14 | -------------------------------------------------------------------------------- /chromiumcontent/config/BUILD.gn: -------------------------------------------------------------------------------- 1 | # There are some executable targets whose products are ran during build. 2 | # This config is applied to those targets because we need to give them some 3 | # special treatment. 4 | config("build_time_executable") { 5 | configs = [] 6 | 7 | # The executables which have this config applied are dependent on ICU, 8 | # which is always a shared library in an Electron build. However, in the 9 | # non-component build, Linux executables don't have rpath set to search for 10 | # libraries in the executable's directory, so ICU cannot be found. So let's 11 | # make sure rpath is set here. 12 | # See '//build/config/gcc/BUILD.gn' for details on the rpath setting. 13 | if (is_electron_build && is_linux && !is_component_build) { 14 | configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ] 15 | } 16 | 17 | if (is_electron_build && is_mac && !is_component_build) { 18 | ldflags = [ 19 | "-Wl,-rpath,@loader_path/." 20 | ] 21 | } 22 | } 23 | 24 | # For MAS build, we force defining "MAS_BUILD". 25 | config("mas_build") { 26 | if (is_mas_build) { 27 | defines = [ "MAS_BUILD" ] 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /chromiumcontent/config/features.gni: -------------------------------------------------------------------------------- 1 | declare_args() { 2 | # Build pepper flash library for flash plugin support. 3 | enable_pepper_flash = true 4 | } 5 | -------------------------------------------------------------------------------- /patches/common/angle/.patches.yaml: -------------------------------------------------------------------------------- 1 | repo: src/third_party/angle 2 | patches: 3 | - 4 | author: Ales Pergl 5 | file: dcheck.patch 6 | description: null 7 | -------------------------------------------------------------------------------- /patches/common/angle/dcheck.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/common/debug.h b/src/common/debug.h 2 | index 0108ff655..57fbc5ac5 100644 3 | --- a/src/common/debug.h 4 | +++ b/src/common/debug.h 5 | @@ -190,7 +190,7 @@ std::ostream &FmtHexInt(std::ostream &os, T value) 6 | 7 | #define ANGLE_EMPTY_STATEMENT for (;;) break 8 | #if !defined(NDEBUG) || defined(ANGLE_ENABLE_RELEASE_ASSERTS) 9 | -#define ANGLE_ENABLE_ASSERTS 10 | +// #define ANGLE_ENABLE_ASSERTS 11 | #endif 12 | 13 | #define WARN() ANGLE_LOG(WARN) 14 | -------------------------------------------------------------------------------- /patches/common/boringssl/.patches.yaml: -------------------------------------------------------------------------------- 1 | repo: src/third_party/boringssl/src 2 | patches: 3 | - 4 | author: Jeremy Apthorp 5 | file: 0001-Implement-legacy-OCSP-APIs-for-libssl.patch 6 | description: see patch header 7 | - 8 | author: Aleksei Kuzmin 9 | file: implement-SSL_get_tlsext_status_type.patch 10 | description: | 11 | BoringSSL doesn't implement `SSL_get_tlsext_status_type()`, 12 | but Node.js expects it to be present cause OpenSSL has it. 13 | -------------------------------------------------------------------------------- /patches/common/boringssl/implement-SSL_get_tlsext_status_type.patch: -------------------------------------------------------------------------------- 1 | diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h 2 | index d04390df..0b8677ce 100644 3 | --- a/include/openssl/ssl.h 4 | +++ b/include/openssl/ssl.h 5 | @@ -4120,6 +4120,8 @@ extern "C++" OPENSSL_EXPORT void SSL_CTX_sess_set_get_cb( 6 | // Use |SSL_enable_ocsp_stapling| instead. 7 | OPENSSL_EXPORT int SSL_set_tlsext_status_type(SSL *ssl, int type); 8 | 9 | +OPENSSL_EXPORT int SSL_get_tlsext_status_type(SSL *ssl); 10 | + 11 | // SSL_set_tlsext_status_ocsp_resp sets the OCSP response. It returns one on 12 | // success and zero on error. On success, |ssl| takes ownership of |resp|, which 13 | // must have been allocated by |OPENSSL_malloc|. 14 | diff --git a/ssl/ssl_lib.cc b/ssl/ssl_lib.cc 15 | index 0c004fd4..6c849b5b 100644 16 | --- a/ssl/ssl_lib.cc 17 | +++ b/ssl/ssl_lib.cc 18 | @@ -2723,6 +2723,14 @@ int SSL_set_tlsext_status_type(SSL *ssl, int type) { 19 | return 1; 20 | } 21 | 22 | +int SSL_get_tlsext_status_type(SSL *ssl) { 23 | + if (ssl->ocsp_stapling_enabled) { 24 | + return TLSEXT_STATUSTYPE_ocsp; 25 | + } 26 | + 27 | + return TLSEXT_STATUSTYPE_nothing; 28 | +} 29 | + 30 | int SSL_set_tlsext_status_ocsp_resp(SSL *ssl, uint8_t *resp, size_t resp_len) { 31 | if (SSL_set_ocsp_response(ssl, resp, resp_len)) { 32 | OPENSSL_free(resp); 33 | -------------------------------------------------------------------------------- /patches/common/chromium/accelerator.patch: -------------------------------------------------------------------------------- 1 | diff --git a/ui/base/accelerators/accelerator.cc b/ui/base/accelerators/accelerator.cc 2 | index a6756c2..5352958 100644 3 | --- a/ui/base/accelerators/accelerator.cc 4 | +++ b/ui/base/accelerators/accelerator.cc 5 | @@ -11,6 +11,7 @@ 6 | #include "base/logging.h" 7 | #include "base/strings/strcat.h" 8 | #include "base/strings/string_util.h" 9 | +#include "base/strings/stringprintf.h" 10 | #include "base/strings/utf_string_conversions.h" 11 | #include "build/build_config.h" 12 | #include "ui/base/l10n/l10n_util.h" 13 | @@ -21,9 +22,7 @@ 14 | #include 15 | #endif 16 | 17 | -#if !defined(OS_WIN) && (defined(USE_AURA) || defined(OS_MACOSX)) 18 | #include "ui/events/keycodes/keyboard_code_conversion.h" 19 | -#endif 20 | 21 | namespace ui { 22 | 23 | @@ -145,7 +144,17 @@ base::string16 Accelerator::GetShortcutText() const { 24 | shortcut = KeyCodeToName(key_code_); 25 | #endif 26 | 27 | + unsigned int flags = 0; 28 | if (shortcut.empty()) { 29 | + if (IsShiftDown()) 30 | + flags = ui::EF_SHIFT_DOWN; 31 | + const uint16_t c = DomCodeToUsLayoutCharacter( 32 | + UsLayoutKeyboardCodeToDomCode(key_code_), flags); 33 | + if (c != 0) { 34 | + shortcut = 35 | + static_cast( 36 | + base::ToUpperASCII(static_cast(c))); 37 | + } 38 | #if defined(OS_WIN) 39 | // Our fallback is to try translate the key code to a regular character 40 | // unless it is one of digits (VK_0 to VK_9). Some keyboard 41 | @@ -154,17 +163,20 @@ base::string16 Accelerator::GetShortcutText() const { 42 | // accent' for '0'). For display in the menu (e.g. Ctrl-0 for the 43 | // default zoom level), we leave VK_[0-9] alone without translation. 44 | wchar_t key; 45 | - if (base::IsAsciiDigit(key_code_)) 46 | + if (base::IsAsciiDigit(key_code_)) { 47 | key = static_cast(key_code_); 48 | - else 49 | - key = LOWORD(::MapVirtualKeyW(key_code_, MAPVK_VK_TO_CHAR)); 50 | - shortcut += key; 51 | -#elif defined(USE_AURA) || defined(OS_MACOSX) 52 | - const uint16_t c = DomCodeToUsLayoutCharacter( 53 | - UsLayoutKeyboardCodeToDomCode(key_code_), false); 54 | - if (c != 0) 55 | - shortcut += 56 | - static_cast(base::ToUpperASCII(c)); 57 | + shortcut = key; 58 | + } 59 | +#endif 60 | + if (key_code_ > VKEY_F1 && key_code_ <= VKEY_F24) 61 | + shortcut = base::UTF8ToUTF16( 62 | + base::StringPrintf("F%d", key_code_ - VKEY_F1 + 1)); 63 | + } else if (IsShiftDown()) { 64 | +#if defined(OS_MACOSX) 65 | + const base::char16 kShiftSymbol[] = {0x21e7, 0}; 66 | + shortcut = kShiftSymbol; 67 | +#else 68 | + shortcut = l10n_util::GetStringFUTF16(IDS_APP_SHIFT_MODIFIER, shortcut); 69 | #endif 70 | } 71 | 72 | @@ -221,15 +233,12 @@ base::string16 Accelerator::GetShortcutText() const { 73 | 74 | base::string16 Accelerator::ApplyLongFormModifiers( 75 | base::string16 shortcut) const { 76 | - if (IsShiftDown()) 77 | - shortcut = l10n_util::GetStringFUTF16(IDS_APP_SHIFT_MODIFIER, shortcut); 78 | - 79 | // Note that we use 'else-if' in order to avoid using Ctrl+Alt as a shortcut. 80 | // See http://blogs.msdn.com/oldnewthing/archive/2004/03/29/101121.aspx for 81 | // more information. 82 | if (IsCtrlDown()) 83 | shortcut = l10n_util::GetStringFUTF16(IDS_APP_CONTROL_MODIFIER, shortcut); 84 | - else if (IsAltDown()) 85 | + if (IsAltDown()) 86 | shortcut = l10n_util::GetStringFUTF16(IDS_APP_ALT_MODIFIER, shortcut); 87 | 88 | if (IsCmdDown()) { 89 | @@ -249,14 +258,12 @@ base::string16 Accelerator::ApplyShortFormModifiers( 90 | base::string16 shortcut) const { 91 | const base::char16 kCommandSymbol[] = {0x2318, 0}; 92 | const base::char16 kCtrlSymbol[] = {0x2303, 0}; 93 | - const base::char16 kShiftSymbol[] = {0x21e7, 0}; 94 | const base::char16 kOptionSymbol[] = {0x2325, 0}; 95 | const base::char16 kNoSymbol[] = {0}; 96 | 97 | std::vector parts; 98 | parts.push_back(base::string16(IsCtrlDown() ? kCtrlSymbol : kNoSymbol)); 99 | parts.push_back(base::string16(IsAltDown() ? kOptionSymbol : kNoSymbol)); 100 | - parts.push_back(base::string16(IsShiftDown() ? kShiftSymbol : kNoSymbol)); 101 | parts.push_back(base::string16(IsCmdDown() ? kCommandSymbol : kNoSymbol)); 102 | parts.push_back(shortcut); 103 | return base::StrCat(parts); 104 | -------------------------------------------------------------------------------- /patches/common/chromium/add_atomic_lib_to_dependencies_even_for_sysroot_builds.patch: -------------------------------------------------------------------------------- 1 | diff --git a/base/BUILD.gn b/base/BUILD.gn 2 | index b674e703617d..5a7a11d816cf 100644 3 | --- a/base/BUILD.gn 4 | +++ b/base/BUILD.gn 5 | @@ -1131,7 +1131,7 @@ component("base") { 6 | # Needed for if using newer C++ library than sysroot, except if 7 | # building inside the cros_sdk environment - use host_toolchain as a 8 | # more robust check for this. 9 | - if (!use_sysroot && (is_android || (is_linux && !is_chromecast)) && 10 | + if ((is_android || (is_linux && !is_chromecast)) && 11 | host_toolchain != "//build/toolchain/cros:host") { 12 | libs = [ "atomic" ] 13 | } 14 | -------------------------------------------------------------------------------- /patches/common/chromium/add_realloc.patch: -------------------------------------------------------------------------------- 1 | diff --git a/gin/array_buffer.cc b/gin/array_buffer.cc 2 | index f84934bfd712..63bce16a9d06 100644 3 | --- a/gin/array_buffer.cc 4 | +++ b/gin/array_buffer.cc 5 | @@ -43,6 +43,10 @@ void* ArrayBufferAllocator::AllocateUninitialized(size_t length) { 6 | return malloc(length); 7 | } 8 | 9 | +void* ArrayBufferAllocator::Realloc(void* data, size_t length) { 10 | + return realloc(data, length); 11 | +} 12 | + 13 | void ArrayBufferAllocator::Free(void* data, size_t length) { 14 | free(data); 15 | } 16 | diff --git a/gin/array_buffer.h b/gin/array_buffer.h 17 | index 2aef366ac819..c037808a9bb3 100644 18 | --- a/gin/array_buffer.h 19 | +++ b/gin/array_buffer.h 20 | @@ -21,6 +21,7 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { 21 | public: 22 | void* Allocate(size_t length) override; 23 | void* AllocateUninitialized(size_t length) override; 24 | + void* Realloc(void* data, size_t length) override; 25 | void Free(void* data, size_t length) override; 26 | 27 | GIN_EXPORT static ArrayBufferAllocator* SharedInstance(); 28 | diff --git a/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_contents.cc b/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_contents.cc 29 | index 053babce1051..e33d6d4ceb5a 100644 30 | --- a/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_contents.cc 31 | +++ b/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_contents.cc 32 | @@ -121,6 +121,11 @@ void* ArrayBufferContents::AllocateMemoryOrNull(size_t size, 33 | return AllocateMemoryWithFlags(size, policy, base::PartitionAllocReturnNull); 34 | } 35 | 36 | +void* ArrayBufferContents::Realloc(void* data, size_t size) { 37 | + return Partitions::ArrayBufferPartition()->Realloc(data, size, 38 | + WTF_HEAP_PROFILER_TYPE_NAME(ArrayBufferContents)); 39 | +} 40 | + 41 | void ArrayBufferContents::FreeMemory(void* data) { 42 | Partitions::ArrayBufferPartition()->Free(data); 43 | } 44 | diff --git a/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_contents.h b/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_contents.h 45 | index 809229caa872..6248ad32d6b0 100644 46 | --- a/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_contents.h 47 | +++ b/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_contents.h 48 | @@ -178,6 +178,7 @@ class WTF_EXPORT ArrayBufferContents { 49 | void CopyTo(ArrayBufferContents& other); 50 | 51 | static void* AllocateMemoryOrNull(size_t, InitializationPolicy); 52 | + static void* Realloc(void* data, size_t); 53 | static void FreeMemory(void*); 54 | static DataHandle CreateDataHandle(size_t, InitializationPolicy); 55 | static void Initialize( 56 | diff --git a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc 57 | index cf2762ede559..f065b5ebafb8 100644 58 | --- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc 59 | +++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc 60 | @@ -555,6 +555,10 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { 61 | size, WTF::ArrayBufferContents::kDontInitialize); 62 | } 63 | 64 | + void* Realloc(void* data, size_t size) override { 65 | + return WTF::ArrayBufferContents::Realloc(data, size); 66 | + } 67 | + 68 | void Free(void* data, size_t size) override { 69 | WTF::ArrayBufferContents::FreeMemory(data); 70 | } 71 | -------------------------------------------------------------------------------- /patches/common/chromium/allow_chromiumcontent_to_depend_on_device_service.patch: -------------------------------------------------------------------------------- 1 | diff --git a/services/device/BUILD.gn b/services/device/BUILD.gn 2 | index 20301dbd005d..31a7568a8aa8 100644 3 | --- a/services/device/BUILD.gn 4 | +++ b/services/device/BUILD.gn 5 | @@ -18,6 +18,7 @@ source_set("lib") { 6 | # dependence should only be for the purpose of embedding the Device Service. 7 | visibility = [ 8 | ":test_support", 9 | + "//libchromiumcontent/chromiumcontent:device_service", 10 | "//content/browser", 11 | ] 12 | sources = [ 13 | -------------------------------------------------------------------------------- /patches/common/chromium/allow_nested_error_trackers.patch: -------------------------------------------------------------------------------- 1 | diff --git a/ui/gfx/x/x11_error_tracker.cc b/ui/gfx/x/x11_error_tracker.cc 2 | index af031de356c5..2a5c18dc473a 100644 3 | --- a/ui/gfx/x/x11_error_tracker.cc 4 | +++ b/ui/gfx/x/x11_error_tracker.cc 5 | @@ -24,7 +24,7 @@ namespace gfx { 6 | X11ErrorTracker::X11ErrorTracker() { 7 | // This is a non-exhaustive check for incorrect usage. It disallows nested 8 | // X11ErrorTracker instances on the same thread. 9 | - DCHECK(g_handler == NULL); 10 | + // DCHECK(g_handler == NULL); 11 | g_handler = this; 12 | XSync(GetXDisplay(), False); 13 | old_handler_ = XSetErrorHandler(X11ErrorHandler); 14 | -------------------------------------------------------------------------------- /patches/common/chromium/allow_new_privs.patch: -------------------------------------------------------------------------------- 1 | diff --git a/base/process/launch.h b/base/process/launch.h 2 | index 20b76fc..9db73bf 100644 3 | --- a/base/process/launch.h 4 | +++ b/base/process/launch.h 5 | @@ -147,7 +147,7 @@ struct BASE_EXPORT LaunchOptions { 6 | 7 | // By default, child processes will have the PR_SET_NO_NEW_PRIVS bit set. If 8 | // true, then this bit will not be set in the new child process. 9 | - bool allow_new_privs = false; 10 | + bool allow_new_privs = true; 11 | 12 | // Sets parent process death signal to SIGKILL. 13 | bool kill_on_parent_death = false; 14 | -------------------------------------------------------------------------------- /patches/common/chromium/allow_webview_file_url.patch: -------------------------------------------------------------------------------- 1 | diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc 2 | index 0c57d20..0916ed0 100644 3 | --- a/content/browser/loader/resource_dispatcher_host_impl.cc 4 | +++ b/content/browser/loader/resource_dispatcher_host_impl.cc 5 | @@ -1870,6 +1870,8 @@ void ResourceDispatcherHostImpl::BeginNavigationRequest( 6 | !policy->IsWebSafeScheme(info.common_params.url.scheme()) && 7 | !is_external_protocol; 8 | 9 | + non_web_url_in_guest = false; 10 | + 11 | if (is_shutdown_ || non_web_url_in_guest || 12 | (delegate_ && !delegate_->ShouldBeginRequest( 13 | info.common_params.method, 14 | -------------------------------------------------------------------------------- /patches/common/chromium/app_indicator_icon_menu.patch: -------------------------------------------------------------------------------- 1 | diff --git a/chrome/browser/ui/libgtkui/app_indicator_icon_menu.cc b/chrome/browser/ui/libgtkui/app_indicator_icon_menu.cc 2 | index 91674b9..8a4c391 100644 3 | --- a/chrome/browser/ui/libgtkui/app_indicator_icon_menu.cc 4 | +++ b/chrome/browser/ui/libgtkui/app_indicator_icon_menu.cc 5 | @@ -116,7 +116,7 @@ void AppIndicatorIconMenu::OnMenuItemActivated(GtkWidget* menu_item) { 6 | return; 7 | 8 | // The menu item can still be activated by hotkeys even if it is disabled. 9 | - if (menu_model_->IsEnabledAt(id)) 10 | + if (model->IsEnabledAt(id)) 11 | ExecuteCommand(model, id); 12 | } 13 | 14 | -------------------------------------------------------------------------------- /patches/common/chromium/backport_d65792a.patch: -------------------------------------------------------------------------------- 1 | diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc 2 | index bf4b1d0..a3b72c4 100644 3 | @@ -995,7 +996,8 @@ 4 | 5 | void Widget::OnSizeConstraintsChanged() { 6 | native_widget_->OnSizeConstraintsChanged(); 7 | - non_client_view_->SizeConstraintsChanged(); 8 | + if (non_client_view_) 9 | + non_client_view_->SizeConstraintsChanged(); 10 | } 11 | 12 | void Widget::OnOwnerClosing() {} 13 | -------------------------------------------------------------------------------- /patches/common/chromium/blink-worker-enable-csp-in-file-scheme.patch: -------------------------------------------------------------------------------- 1 | diff --git a/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc b/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc 2 | index bdd886eff5e3..42a3f0ef6e55 100644 3 | --- a/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc 4 | +++ b/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc 5 | @@ -255,7 +255,6 @@ void WorkerScriptLoader::ProcessContentSecurityPolicy( 6 | // document (which is implemented in WorkerMessagingProxy, and 7 | // m_contentSecurityPolicy should be left as nullptr to inherit the policy). 8 | if (!response.Url().ProtocolIs("blob") && 9 | - !response.Url().ProtocolIs("file") && 10 | !response.Url().ProtocolIs("filesystem")) { 11 | content_security_policy_ = ContentSecurityPolicy::Create(); 12 | content_security_policy_->SetOverrideURLForSelf(response.Url()); 13 | -------------------------------------------------------------------------------- /patches/common/chromium/blink_file_path.patch: -------------------------------------------------------------------------------- 1 | diff --git a/third_party/blink/renderer/core/fileapi/file.h b/third_party/blink/renderer/core/fileapi/file.h 2 | index 0bfe29512050..81439f7ab8f7 100644 3 | --- a/third_party/blink/renderer/core/fileapi/file.h 4 | +++ b/third_party/blink/renderer/core/fileapi/file.h 5 | @@ -170,6 +170,9 @@ class CORE_EXPORT File final : public Blob { 6 | } 7 | const String& name() const { return name_; } 8 | 9 | + // Getter for the path IDL attribute. 10 | + const String& path() const { return GetPath(); } 11 | + 12 | // Getter for the lastModified IDL attribute, 13 | // http://dev.w3.org/2006/webapi/FileAPI/#file-attrs 14 | long long lastModified() const; 15 | diff --git a/third_party/blink/renderer/core/fileapi/file.idl b/third_party/blink/renderer/core/fileapi/file.idl 16 | index df954bc8f818..4683b2853bb4 100644 17 | --- a/third_party/blink/renderer/core/fileapi/file.idl 18 | +++ b/third_party/blink/renderer/core/fileapi/file.idl 19 | @@ -32,6 +32,7 @@ 20 | Exposed=(Window,Worker) 21 | ] interface File : Blob { 22 | readonly attribute DOMString name; 23 | + readonly attribute DOMString path; 24 | readonly attribute long long lastModified; 25 | 26 | // Non-standard APIs 27 | -------------------------------------------------------------------------------- /patches/common/chromium/blink_fix_prototype_assert.patch: -------------------------------------------------------------------------------- 1 | cdiff --git a/third_party/blink/renderer/platform/bindings/v8_object_constructor.cc b/third_party/blink/renderer/platform/bindings/v8_object_constructor.cc 2 | index aedc832..8c26681 100644 3 | --- a/third_party/blink/renderer/platform/bindings/v8_object_constructor.cc 4 | +++ b/third_party/blink/renderer/platform/bindings/v8_object_constructor.cc 5 | @@ -94,8 +94,10 @@ v8::Local V8ObjectConstructor::CreateInterfaceObject( 6 | bool get_prototype_value = 7 | interface_object->Get(context, V8AtomicString(isolate, "prototype")) 8 | .ToLocal(&prototype_value); 9 | - CHECK(get_prototype_value); 10 | - CHECK(prototype_value->IsObject()); 11 | + // CHECK(get_prototype_value); 12 | + // CHECK(prototype_value->IsObject()); 13 | + if (!get_prototype_value || !prototype_value->IsObject()) 14 | + return v8::Local(); 15 | 16 | prototype_object = prototype_value.As(); 17 | if (prototype_object->InternalFieldCount() == 18 | -------------------------------------------------------------------------------- /patches/common/chromium/blink_initialization_order.patch: -------------------------------------------------------------------------------- 1 | diff --git a/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc b/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc 2 | index 33d958fb31ae..47efe62650aa 100644 3 | --- a/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc 4 | +++ b/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc 5 | @@ -170,11 +170,11 @@ void LocalWindowProxy::Initialize() { 6 | GetFrame()->IsMainFrame()); 7 | MainThreadDebugger::Instance()->ContextCreated(script_state_.get(), 8 | GetFrame(), origin); 9 | + 10 | + InstallConditionalFeatures(); 11 | GetFrame()->Client()->DidCreateScriptContext(context, world_->GetWorldId()); 12 | } 13 | 14 | - InstallConditionalFeatures(); 15 | - 16 | if (World().IsMainWorld()) { 17 | GetFrame()->Loader().DispatchDidClearWindowObjectInMainWorld(); 18 | } 19 | -------------------------------------------------------------------------------- /patches/common/chromium/blink_local_frame.patch: -------------------------------------------------------------------------------- 1 | diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc 2 | index 97a5393d40b4..04f88dd2ea15 100644 3 | --- a/third_party/blink/renderer/core/frame/local_frame.cc 4 | +++ b/third_party/blink/renderer/core/frame/local_frame.cc 5 | @@ -303,10 +303,6 @@ void LocalFrame::Detach(FrameDetachType type) { 6 | } 7 | CHECK(!view_ || !view_->IsAttached()); 8 | 9 | - // This is the earliest that scripting can be disabled: 10 | - // - FrameLoader::Detach() can fire XHR abort events 11 | - // - Document::Shutdown() can dispose plugins which can run script. 12 | - ScriptForbiddenScope forbid_script; 13 | if (!Client()) 14 | return; 15 | 16 | @@ -316,6 +312,10 @@ void LocalFrame::Detach(FrameDetachType type) { 17 | // Notify ScriptController that the frame is closing, since its cleanup ends 18 | // up calling back to LocalFrameClient via WindowProxy. 19 | GetScriptController().ClearForClose(); 20 | + // This is the earliest that scripting can be disabled: 21 | + // - FrameLoader::Detach() can fire XHR abort events 22 | + // - Document::Shutdown() can dispose plugins which can run script. 23 | + ScriptForbiddenScope forbid_script; 24 | 25 | // TODO(crbug.com/729196): Trace why LocalFrameView::DetachFromLayout crashes. 26 | CHECK(!view_->IsAttached()); 27 | -------------------------------------------------------------------------------- /patches/common/chromium/blink_world_context.patch: -------------------------------------------------------------------------------- 1 | diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc 2 | index a93834fbe86e..937b7f335693 100644 3 | --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc 4 | +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc 5 | @@ -843,6 +843,13 @@ v8::Local WebLocalFrameImpl::GlobalProxy() const { 6 | return MainWorldScriptContext()->Global(); 7 | } 8 | 9 | +v8::Local WebLocalFrameImpl::WorldScriptContext( 10 | + v8::Isolate* isolate, int world_id) const { 11 | + scoped_refptr world = DOMWrapperWorld::EnsureIsolatedWorld( 12 | + isolate, world_id); 13 | + return ToScriptState(GetFrame(), *world)->GetContext(); 14 | +} 15 | + 16 | bool WebFrame::ScriptCanAccess(WebFrame* target) { 17 | return BindingSecurity::ShouldAllowAccessToFrame( 18 | CurrentDOMWindow(V8PerIsolateData::MainThreadIsolate()), 19 | diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.h b/third_party/blink/renderer/core/frame/web_local_frame_impl.h 20 | index d66499296ff8..bfea68983fda 100644 21 | --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.h 22 | +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.h 23 | @@ -142,6 +142,8 @@ class CORE_EXPORT WebLocalFrameImpl final 24 | int argc, 25 | v8::Local argv[]) override; 26 | v8::Local MainWorldScriptContext() const override; 27 | + v8::Local WorldScriptContext( 28 | + v8::Isolate* isolate, int world_id) const override; 29 | v8::Local GlobalProxy() const override; 30 | void Reload(WebFrameLoadType) override; 31 | void ReloadWithOverrideURL(const WebURL& override_url, 32 | diff --git a/third_party/blink/public/web/web_local_frame.h b/third_party/blink/public/web/web_local_frame.h 33 | index ad0fa84f9511..69f96587b1f1 100644 34 | --- a/third_party/blink/public/web/web_local_frame.h 35 | +++ b/third_party/blink/public/web/web_local_frame.h 36 | @@ -404,6 +404,9 @@ class WebLocalFrame : public WebFrame { 37 | // be calling this API. 38 | virtual v8::Local MainWorldScriptContext() const = 0; 39 | 40 | + virtual v8::Local WorldScriptContext( 41 | + v8::Isolate* isolate, int world_id) const = 0; 42 | + 43 | // Executes script in the context of the current page and returns the value 44 | // that the script evaluated to with callback. Script execution can be 45 | // suspend. 46 | -------------------------------------------------------------------------------- /patches/common/chromium/boringssl_build_gn.patch: -------------------------------------------------------------------------------- 1 | diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn 2 | index c75fb7c2bb7e..423f4b2ddb10 100644 3 | --- a/third_party/boringssl/BUILD.gn 4 | +++ b/third_party/boringssl/BUILD.gn 5 | @@ -44,6 +44,13 @@ config("no_asm_config") { 6 | } 7 | 8 | all_sources = crypto_sources + ssl_sources 9 | +if (is_electron_build) { 10 | + # Needed to build a nodejs-compatible boringssl. 11 | + all_sources += [ 12 | + "src/decrepit/evp/evp_do_all.c", 13 | + "src/decrepit/xts/xts.c", 14 | + ] 15 | +} 16 | 17 | # Windows' assembly is built with Yasm. The other platforms use the platform 18 | # assembler. 19 | -------------------------------------------------------------------------------- /patches/common/chromium/browser_compositor_mac.patch: -------------------------------------------------------------------------------- 1 | diff --git a/content/browser/renderer_host/browser_compositor_view_mac.h b/content/browser/renderer_host/browser_compositor_view_mac.h 2 | index 7426062f7381..bd5cd2fcd230 100644 3 | --- a/content/browser/renderer_host/browser_compositor_view_mac.h 4 | +++ b/content/browser/renderer_host/browser_compositor_view_mac.h 5 | @@ -54,10 +54,13 @@ class CONTENT_EXPORT BrowserCompositorMac : public DelegatedFrameHostClient { 6 | // These will not return nullptr until Destroy is called. 7 | DelegatedFrameHost* GetDelegatedFrameHost(); 8 | 9 | + ui::Layer* GetRootLayer() { return root_layer_.get(); } 10 | + 11 | // Ensure that the currect compositor frame be cleared (even if it is 12 | // potentially visible). 13 | void ClearCompositorFrame(); 14 | 15 | + ui::Compositor* GetCompositor(); 16 | gfx::AcceleratedWidget GetAcceleratedWidget(); 17 | void DidCreateNewRendererCompositorFrameSink( 18 | viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink); 19 | diff --git a/content/browser/renderer_host/browser_compositor_view_mac.mm b/content/browser/renderer_host/browser_compositor_view_mac.mm 20 | index 7fcc24c15c37..7c31977b20f9 100644 21 | --- a/content/browser/renderer_host/browser_compositor_view_mac.mm 22 | +++ b/content/browser/renderer_host/browser_compositor_view_mac.mm 23 | @@ -208,6 +208,12 @@ BrowserCompositorMac::~BrowserCompositorMac() { 24 | g_spare_recyclable_compositors.Get().clear(); 25 | } 26 | 27 | +ui::Compositor* BrowserCompositorMac::GetCompositor() { 28 | + if (recyclable_compositor_) 29 | + return recyclable_compositor_->compositor(); 30 | + return nullptr; 31 | +} 32 | + 33 | gfx::AcceleratedWidget BrowserCompositorMac::GetAcceleratedWidget() { 34 | if (recyclable_compositor_) { 35 | return recyclable_compositor_->accelerated_widget_mac() 36 | -------------------------------------------------------------------------------- /patches/common/chromium/browser_plugin_guest.patch: -------------------------------------------------------------------------------- 1 | diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc 2 | index 964c9a093a3b..f3b3d66ff267 100644 3 | --- a/content/browser/browser_plugin/browser_plugin_guest.cc 4 | +++ b/content/browser/browser_plugin/browser_plugin_guest.cc 5 | @@ -214,8 +214,11 @@ void BrowserPluginGuest::Init() { 6 | 7 | WebContentsImpl* owner_web_contents = static_cast( 8 | delegate_->GetOwnerWebContents()); 9 | - owner_web_contents->CreateBrowserPluginEmbedderIfNecessary(); 10 | - InitInternal(BrowserPluginHostMsg_Attach_Params(), owner_web_contents); 11 | + if (nullptr != owner_web_contents) 12 | + { 13 | + owner_web_contents->CreateBrowserPluginEmbedderIfNecessary(); 14 | + InitInternal(BrowserPluginHostMsg_Attach_Params(), owner_web_contents); 15 | + } 16 | } 17 | 18 | base::WeakPtr BrowserPluginGuest::AsWeakPtr() { 19 | -------------------------------------------------------------------------------- /patches/common/chromium/browser_plugin_wheel.patch: -------------------------------------------------------------------------------- 1 | diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc 2 | index 06762fb..e89b1f0 100644 3 | --- a/content/renderer/browser_plugin/browser_plugin.cc 4 | +++ b/content/renderer/browser_plugin/browser_plugin.cc 5 | @@ -448,15 +448,11 @@ blink::WebInputEventResult BrowserPlugin::handleInputEvent( 6 | 7 | DCHECK(!blink::WebInputEvent::IsTouchEventType(event.GetType())); 8 | 9 | - // With direct event routing turned on, BrowserPlugin should almost never 10 | - // see wheel events any more. The two exceptions are (1) scroll bubbling, and 11 | - // (2) synthetic mouse wheels generated by touchpad GesturePinch events on 12 | - // Mac, which always go to the mainframe and thus may hit BrowserPlugin if 13 | - // it's in a top-level embedder. In both cases we should indicate the event 14 | - // as not handled (for GesturePinch on Mac, indicating the event has been 15 | - // handled leads to touchpad pinch not working). 16 | - if (event.GetType() == blink::WebInputEvent::kMouseWheel) 17 | - return blink::WebInputEventResult::kNotHandled; 18 | + if (event.GetType() == blink::WebInputEvent::kMouseWheel) { 19 | + auto wheel_event = static_cast(event); 20 | + if (wheel_event.resending_plugin_id == browser_plugin_instance_id_) 21 | + return blink::WebInputEventResult::kNotHandled; 22 | + } 23 | 24 | if (blink::WebInputEvent::IsGestureEventType(event.GetType())) { 25 | auto gesture_event = static_cast(event); 26 | -------------------------------------------------------------------------------- /patches/common/chromium/build_gn.patch: -------------------------------------------------------------------------------- 1 | diff --git a/.gn b/.gn 2 | index 50a8a2fe9f1e..66ced79f1627 100644 3 | --- a/.gn 4 | +++ b/.gn 5 | @@ -259,4 +259,8 @@ exec_script_whitelist = 6 | # Not gypi-to-gn. 7 | "//google_apis/BUILD.gn", 8 | "//printing/BUILD.gn", 9 | + # While electron transitions to GN, we use gypi_to_gn to synchronize 10 | + # file lists 11 | + "//electron/BUILD.gn", 12 | + "//electron/brightray/BUILD.gn", 13 | ] 14 | diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn 15 | index 7d60dd920904..d2f2cbc99915 100644 16 | --- a/build/config/BUILDCONFIG.gn 17 | +++ b/build/config/BUILDCONFIG.gn 18 | @@ -123,6 +123,10 @@ if (current_os == "") { 19 | # even if the value is overridden, which is wasteful. See first bullet. 20 | 21 | declare_args() { 22 | + is_electron_build = false 23 | + is_electron_gn_build = false 24 | + is_mas_build = false 25 | + 26 | # Set to enable the official build level of optimization. This has nothing 27 | # to do with branding, but enables an additional level of optimization above 28 | # release (!is_debug). This might be better expressed as a tri-state 29 | @@ -539,6 +539,7 @@ default_compiler_configs = [ 30 | "//build/config/compiler:thin_archive", 31 | "//build/config/coverage:default_coverage", 32 | "//build/config/sanitizers:default_sanitizer_flags", 33 | + "//libchromiumcontent/chromiumcontent/config:mas_build", 34 | ] 35 | 36 | if (is_win) { 37 | @@ -642,6 +645,7 @@ template("component") { 38 | _component_mode = "shared_library" 39 | } else if (defined(invoker.static_component_type)) { 40 | assert(invoker.static_component_type == "static_library" || 41 | + (is_electron_build && invoker.static_component_type == "shared_library") || 42 | invoker.static_component_type == "source_set") 43 | _component_mode = invoker.static_component_type 44 | } else if (is_android || !defined(invoker.sources)) { 45 | diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn 46 | index 9a10137aa405..bb33e5450eaa 100644 47 | --- a/build/config/compiler/BUILD.gn 48 | +++ b/build/config/compiler/BUILD.gn 49 | @@ -579,10 +579,13 @@ config("compiler") { 50 | ldflags += [ "-Wl,--lto-O0" ] 51 | } 52 | 53 | - cflags += [ "-fwhole-program-vtables" ] 54 | - if (!is_win) { 55 | - ldflags += [ "-fwhole-program-vtables" ] 56 | - } 57 | + # -fwhole-program-vtables doesn't work well in Electron right now, as it's 58 | + # not a single binary and the optimizations break interfaces used across 59 | + # binary boundaries. 60 | + # cflags += [ "-fwhole-program-vtables" ] 61 | + # if (!is_win) { 62 | + # ldflags += [ "-fwhole-program-vtables" ] 63 | + #} 64 | 65 | # Work-around for http://openradar.appspot.com/20356002 66 | if (is_mac) { 67 | diff --git a/build/config/win/BUILD.gn b/build/config/win/BUILD.gn 68 | index 1f6bc13e087f..4630045ff554 100644 69 | --- a/build/config/win/BUILD.gn 70 | +++ b/build/config/win/BUILD.gn 71 | @@ -314,7 +314,7 @@ config("cfi_linker") { 72 | # See https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx for a reference of 73 | # what each value does. 74 | config("default_crt") { 75 | - if (is_component_build) { 76 | + if (is_component_build || (is_electron_build && !is_electron_gn_build)) { 77 | # Component mode: dynamic CRT. Since the library is shared, it requires 78 | # exceptions or will give errors about things not matching, so keep 79 | # exceptions on. 80 | diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn 81 | index bc9fe2cc2000..9173f6f0324c 100644 82 | --- a/third_party/blink/renderer/platform/BUILD.gn 83 | +++ b/third_party/blink/renderer/platform/BUILD.gn 84 | @@ -134,6 +134,7 @@ action("instrumentation_probes") { 85 | } 86 | 87 | executable("character_data_generator") { 88 | + configs += [ "//libchromiumcontent/chromiumcontent/config:build_time_executable" ] 89 | sources = [ 90 | "text/character_property_data_generator.cc", 91 | "text/character_property_data_generator.h", 92 | -------------------------------------------------------------------------------- /patches/common/chromium/build_toolchain_win_patch.patch: -------------------------------------------------------------------------------- 1 | diff --git a/build/toolchain/win/BUILD.gn b/build/toolchain/win/BUILD.gn 2 | index 53f767a0bddb..661466b779e8 100644 3 | --- a/build/toolchain/win/BUILD.gn 4 | +++ b/build/toolchain/win/BUILD.gn 5 | @@ -176,6 +176,12 @@ template("msvc_toolchain") { 6 | ] 7 | 8 | command = "$env_wrapper$cl /nologo /showIncludes ${clflags} $sys_include_flags{{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} /c {{source}} /Fo{{output}} /Fd\"$pdbname\"" 9 | + 10 | + if (is_electron_build && !is_component_build) { 11 | + pdbdir = "{{target_out_dir}}" 12 | + pdbname = "{{label_name}}_c.pdb" 13 | + command = "$python_path $tool_wrapper_path cl-wrapper $env_wrapper$cl /nologo /showIncludes ${clflags} $sys_include_flags{{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} /c {{source}} /Fo{{output}} $pdbdir \"$pdbname\"" 14 | + } 15 | } 16 | 17 | tool("cxx") { 18 | @@ -192,6 +198,12 @@ template("msvc_toolchain") { 19 | ] 20 | 21 | command = "$env_wrapper$cl /nologo /showIncludes ${clflags} $sys_include_flags{{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} /c {{source}} /Fo{{output}} /Fd\"$pdbname\"" 22 | + 23 | + if (is_electron_build && !is_component_build) { 24 | + pdbdir = "{{target_out_dir}}" 25 | + pdbname = "{{label_name}}_cc.pdb" 26 | + command = "$python_path $tool_wrapper_path cl-wrapper $env_wrapper$cl /nologo /showIncludes ${clflags} $sys_include_flags{{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} /c {{source}} /Fo{{output}} $pdbdir \"$pdbname\"" 27 | + } 28 | } 29 | 30 | tool("rc") { 31 | diff --git a/build/toolchain/win/tool_wrapper.py b/build/toolchain/win/tool_wrapper.py 32 | index 3a81368f3469..7c5ef1ea5db4 100644 33 | --- a/build/toolchain/win/tool_wrapper.py 34 | +++ b/build/toolchain/win/tool_wrapper.py 35 | @@ -315,6 +315,25 @@ class WinTool(object): 36 | dirname = dirname[0] if dirname else None 37 | return subprocess.call(args, shell=True, env=env, cwd=dirname) 38 | 39 | + def ExecClWrapper(self, *args): 40 | + """Invokes cl.exe to compile a C/C++ source file.""" 41 | + args = list(args) 42 | + # Incorporate the PDB output dir into the PDB name to ensure the PDB name 43 | + # is unique (see https://github.com/electron/libchromiumcontent/issues/287) 44 | + pdb_name = args.pop() 45 | + pdb_dir = args.pop() 46 | + pdb_filename = '%s/%s_%s' % (pdb_dir, pdb_dir.replace('/', '_'), pdb_name) 47 | + # On Windows when args is a sequence instead of a single string 48 | + # subprocess.call() will use subprocess.list2cmdline() to convert the 49 | + # sequence to a string. Unfortunately the double-quote escaping done by 50 | + # subprocess.list2cmdline() mangles the /Fd"path/to/some.pdb" arg to 51 | + # /Fd\"path/to/some.pdb\", and cl.exe then fails to parse the PDB filename 52 | + # correctly. To work around this we use subprocess.list2cmdline() 53 | + # (even though it's not part of the public API) to construct most of the 54 | + # command line, and then append the /Fd flag. 55 | + pdb_flag = '/Fd"%s"' % pdb_filename 56 | + cmdline = '%s %s' % (subprocess.list2cmdline(args), pdb_flag) 57 | + return subprocess.call(cmdline, shell=False) 58 | 59 | if __name__ == '__main__': 60 | sys.exit(main(sys.argv[1:])) 61 | -------------------------------------------------------------------------------- /patches/common/chromium/chrome_key_systems.patch: -------------------------------------------------------------------------------- 1 | diff --git a/chrome/renderer/media/chrome_key_systems.cc b/chrome/renderer/media/chrome_key_systems.cc 2 | index f3033337199b..856bc8f0b143 100644 3 | --- a/chrome/renderer/media/chrome_key_systems.cc 4 | +++ b/chrome/renderer/media/chrome_key_systems.cc 5 | @@ -14,7 +14,9 @@ 6 | #include "base/strings/string_split.h" 7 | #include "base/strings/utf_string_conversions.h" 8 | #include "build/build_config.h" 9 | +#if 0 10 | #include "chrome/renderer/chrome_render_thread_observer.h" 11 | +#endif 12 | #include "components/cdm/renderer/external_clear_key_key_system_properties.h" 13 | #include "components/cdm/renderer/widevine_key_system_properties.h" 14 | #include "content/public/renderer/render_thread.h" 15 | @@ -140,12 +142,14 @@ static void AddExternalClearKey( 16 | #if defined(WIDEVINE_CDM_AVAILABLE) 17 | // Returns persistent-license session support. 18 | EmeSessionTypeSupport GetPersistentLicenseSupport(bool supported_by_the_cdm) { 19 | +#if 0 20 | // Do not support persistent-license if the process cannot persist data. 21 | // TODO(crbug.com/457487): Have a better plan on this. See bug for details. 22 | if (ChromeRenderThreadObserver::is_incognito_process()) { 23 | DVLOG(2) << __func__ << ": Not supported in incognito process."; 24 | return EmeSessionTypeSupport::NOT_SUPPORTED; 25 | } 26 | +#endif 27 | 28 | if (!supported_by_the_cdm) { 29 | DVLOG(2) << __func__ << ": Not supported by the CDM."; 30 | -------------------------------------------------------------------------------- /patches/common/chromium/compositor_delegate.patch: -------------------------------------------------------------------------------- 1 | diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc 2 | index 7b9fc4114c52..bdbbf93f6f0d 100644 3 | --- a/content/browser/compositor/gpu_process_transport_factory.cc 4 | +++ b/content/browser/compositor/gpu_process_transport_factory.cc 5 | @@ -495,9 +495,19 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( 6 | // surfaces as they are not following the correct mode. 7 | DisableGpuCompositing(compositor.get()); 8 | } 9 | + 10 | + std::unique_ptr output_device; 11 | + if (compositor->delegate()) { 12 | + output_device = compositor->delegate()->CreateSoftwareOutputDevice( 13 | + compositor.get()); 14 | + } 15 | + if (!output_device) { 16 | + output_device = CreateSoftwareOutputDevice(compositor->widget()); 17 | + } 18 | + 19 | display_output_surface = 20 | std::make_unique( 21 | - CreateSoftwareOutputDevice(compositor->widget()), 22 | + std::move(output_device), 23 | std::move(vsync_callback), compositor->task_runner()); 24 | } else { 25 | DCHECK(context_provider); 26 | diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h 27 | index d842aa55175b..2c2131774b71 100644 28 | --- a/ui/compositor/compositor.h 29 | +++ b/ui/compositor/compositor.h 30 | @@ -24,6 +24,7 @@ 31 | #include "components/viz/common/surfaces/frame_sink_id.h" 32 | #include "components/viz/common/surfaces/local_surface_id.h" 33 | #include "components/viz/host/host_frame_sink_client.h" 34 | +#include "components/viz/service/display/software_output_device.h" 35 | #include "third_party/skia/include/core/SkColor.h" 36 | #include "third_party/skia/include/core/SkMatrix44.h" 37 | #include "ui/compositor/compositor_animation_observer.h" 38 | @@ -182,6 +183,15 @@ class COMPOSITOR_EXPORT ContextFactory { 39 | virtual void RemoveObserver(ContextFactoryObserver* observer) = 0; 40 | }; 41 | 42 | +class COMPOSITOR_EXPORT CompositorDelegate { 43 | + public: 44 | + virtual std::unique_ptr CreateSoftwareOutputDevice( 45 | + ui::Compositor* compositor) = 0; 46 | + 47 | + protected: 48 | + virtual ~CompositorDelegate() {} 49 | +}; 50 | + 51 | // Compositor object to take care of GPU painting. 52 | // A Browser compositor object is responsible for generating the final 53 | // displayable form of pixels comprising a single widget's contents. It draws an 54 | @@ -221,6 +231,9 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient, 55 | // Schedules a redraw of the layer tree associated with this compositor. 56 | void ScheduleDraw(); 57 | 58 | + CompositorDelegate* delegate() const { return delegate_; } 59 | + void SetDelegate(CompositorDelegate* delegate) { delegate_ = delegate; } 60 | + 61 | // Sets the root of the layer tree drawn by this Compositor. The root layer 62 | // must have no parent. The compositor's root layer is reset if the root layer 63 | // is destroyed. NULL can be passed to reset the root layer, in which case the 64 | @@ -426,6 +439,8 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient, 65 | ui::ContextFactory* context_factory_; 66 | ui::ContextFactoryPrivate* context_factory_private_; 67 | 68 | + CompositorDelegate* delegate_ = nullptr; 69 | + 70 | // The root of the Layer tree drawn by this compositor. 71 | Layer* root_layer_ = nullptr; 72 | 73 | -------------------------------------------------------------------------------- /patches/common/chromium/content_browser_manifest.patch: -------------------------------------------------------------------------------- 1 | diff --git a/content/public/app/mojo/content_browser_manifest.json b/content/public/app/mojo/content_browser_manifest.json 2 | index 5a217fa9b741..8fd1b39ea6ca 100644 3 | --- a/content/public/app/mojo/content_browser_manifest.json 4 | +++ b/content/public/app/mojo/content_browser_manifest.json 5 | @@ -82,6 +82,7 @@ 6 | "device:battery_monitor", 7 | "device:generic_sensor", 8 | "device:geolocation", 9 | + "device:geolocation_control", 10 | "device:hid", 11 | "device:input_service", 12 | "device:nfc", 13 | -------------------------------------------------------------------------------- /patches/common/chromium/crashpad-disabled-windows.patch: -------------------------------------------------------------------------------- 1 | diff --git a/components/crash/core/common/BUILD.gn b/components/crash/core/common/BUILD.gn 2 | index 4f67529f5c9a..a41bdf709d99 100644 3 | --- a/components/crash/core/common/BUILD.gn 4 | +++ b/components/crash/core/common/BUILD.gn 5 | @@ -13,7 +13,7 @@ group("common") { 6 | } 7 | } 8 | 9 | -use_crashpad = is_mac || is_win 10 | +use_crashpad = is_mac 11 | use_stubs = is_fuchsia 12 | 13 | # Crashpad's annotation system can store data on a per-module basis (i.e., 14 | @@ -128,7 +128,7 @@ source_set("unit_tests") { 15 | sources += [ "objc_zombie_unittest.mm" ] 16 | } 17 | 18 | - if (!is_mac && !is_win && !is_fuchsia) { 19 | + if (!is_mac && !is_fuchsia) { 20 | include_dirs = [ "//third_party/breakpad/breakpad/src/" ] 21 | sources += [ "crash_key_breakpad_unittest.cc" ] 22 | } 23 | diff --git a/components/crash/core/common/crash_key.h b/components/crash/core/common/crash_key.h 24 | index 951c7e941962..bdf6bb40e1fb 100644 25 | --- a/components/crash/core/common/crash_key.h 26 | +++ b/components/crash/core/common/crash_key.h 27 | @@ -19,7 +19,7 @@ 28 | // Annotation interface. Because not all platforms use Crashpad yet, a 29 | // source-compatible interface is provided on top of the older Breakpad 30 | // storage mechanism. 31 | -#if (defined(OS_MACOSX) && !defined(OS_IOS)) || defined(OS_WIN) 32 | +#if (defined(OS_MACOSX) && !defined(OS_IOS)) 33 | #define USE_CRASHPAD_ANNOTATION 1 34 | #endif 35 | 36 | diff --git a/components/crash/core/common/crash_key_breakpad.cc b/components/crash/core/common/crash_key_breakpad.cc 37 | index 0351e01fa18f..1c355bd89844 100644 38 | --- a/components/crash/core/common/crash_key_breakpad.cc 39 | +++ b/components/crash/core/common/crash_key_breakpad.cc 40 | @@ -15,7 +15,7 @@ 41 | #include "components/crash/core/common/crash_key_base_support.h" 42 | #include "components/crash/core/common/crash_key_internal.h" 43 | 44 | -#if defined(OS_MACOSX) || defined(OS_IOS) || defined(OS_WIN) 45 | +#if defined(OS_MACOSX) || defined(OS_IOS) 46 | #error "This file should not be used when Crashpad is available, nor on iOS." 47 | #endif 48 | 49 | -------------------------------------------------------------------------------- /patches/common/chromium/desktop_screen_win.patch: -------------------------------------------------------------------------------- 1 | diff --git a/ui/views/widget/desktop_aura/desktop_screen_win.cc b/ui/views/widget/desktop_aura/desktop_screen_win.cc 2 | index f772f64..7d13f9f 100644 3 | --- a/ui/views/widget/desktop_aura/desktop_screen_win.cc 4 | +++ b/ui/views/widget/desktop_aura/desktop_screen_win.cc 5 | @@ -32,6 +32,8 @@ display::Display DesktopScreenWin::GetDisplayMatching( 6 | } 7 | 8 | HWND DesktopScreenWin::GetHWNDFromNativeView(gfx::NativeView window) const { 9 | + if (!window) 10 | + return NULL; 11 | aura::WindowTreeHost* host = window->GetHost(); 12 | return host ? host->GetAcceleratedWidget() : NULL; 13 | } 14 | -------------------------------------------------------------------------------- /patches/common/chromium/disable-recursive-surface-sync.patch: -------------------------------------------------------------------------------- 1 | diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc 2 | index a9b9d180b0eb..5ad8b93114a7 100644 3 | --- a/content/browser/renderer_host/render_widget_host_impl.cc 4 | +++ b/content/browser/renderer_host/render_widget_host_impl.cc 5 | @@ -972,6 +975,11 @@ void RenderWidgetHostImpl::PauseForPendingResizeOrRepaints() { 6 | if (is_hidden()) 7 | return; 8 | 9 | + // Do not pause if there is already a pending operation with the 10 | + // backing store. 11 | + if (in_get_backing_store_) 12 | + return; 13 | + 14 | // Do not pause if there is not a paint or resize already coming. 15 | if (!repaint_ack_pending_ && !resize_ack_pending_) 16 | return; 17 | -------------------------------------------------------------------------------- /patches/common/chromium/disable-redraw-lock.patch: -------------------------------------------------------------------------------- 1 | diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc 2 | index c8fb7eecb9c8..3d995aa331b1 100644 3 | --- a/ui/views/win/hwnd_message_handler.cc 4 | +++ b/ui/views/win/hwnd_message_handler.cc 5 | @@ -251,6 +251,10 @@ const int kSynthesizedMouseMessagesTimeDifference = 500; 6 | 7 | } // namespace 8 | 9 | +bool HWNDMessageHandlerDelegate::HasNativeFrame() const { 10 | + return false; 11 | +} 12 | + 13 | // A scoping class that prevents a window from being able to redraw in response 14 | // to invalidations that may occur within it for the lifetime of the object. 15 | // 16 | @@ -302,6 +306,7 @@ class HWNDMessageHandler::ScopedRedrawLock { 17 | cancel_unlock_(false), 18 | should_lock_(owner_->IsVisible() && !owner->HasChildRenderingWindow() && 19 | ::IsWindow(hwnd_) && 20 | + !owner_->HasNativeFrame() && 21 | (!(GetWindowLong(hwnd_, GWL_STYLE) & WS_CAPTION) || 22 | !ui::win::IsAeroGlassEnabled())) { 23 | if (should_lock_) 24 | @@ -903,6 +908,10 @@ bool HWNDMessageHandler::HasChildRenderingWindow() { 25 | hwnd()); 26 | } 27 | 28 | +bool HWNDMessageHandler::HasNativeFrame() { 29 | + return delegate_->HasNativeFrame(); 30 | +} 31 | + 32 | //////////////////////////////////////////////////////////////////////////////// 33 | // HWNDMessageHandler, gfx::WindowImpl overrides: 34 | 35 | diff --git a/ui/views/win/hwnd_message_handler.h b/ui/views/win/hwnd_message_handler.h 36 | index 5d5765c1928e..d77991cfa737 100644 37 | --- a/ui/views/win/hwnd_message_handler.h 38 | +++ b/ui/views/win/hwnd_message_handler.h 39 | @@ -227,6 +227,8 @@ class VIEWS_EXPORT HWNDMessageHandler : public gfx::WindowImpl, 40 | typedef std::set TouchIDs; 41 | enum class DwmFrameState { OFF, ON }; 42 | 43 | + bool HasNativeFrame(); 44 | + 45 | // Overridden from WindowImpl: 46 | HICON GetDefaultWindowIcon() const override; 47 | HICON GetSmallWindowIcon() const override; 48 | diff --git a/ui/views/win/hwnd_message_handler_delegate.h b/ui/views/win/hwnd_message_handler_delegate.h 49 | index d13f807e4a75..877189d63616 100644 50 | --- a/ui/views/win/hwnd_message_handler_delegate.h 51 | +++ b/ui/views/win/hwnd_message_handler_delegate.h 52 | @@ -46,6 +46,8 @@ class VIEWS_EXPORT HWNDMessageHandlerDelegate { 53 | // True if the widget associated with this window has a non-client view. 54 | virtual bool HasNonClientView() const = 0; 55 | 56 | + virtual bool HasNativeFrame() const; 57 | + 58 | // Returns who we want to be drawing the frame. Either the system (Windows) 59 | // will handle it or Chrome will custom draw it. 60 | virtual FrameMode GetFrameMode() const = 0; 61 | -------------------------------------------------------------------------------- /patches/common/chromium/disable_detach_webview_frame.patch: -------------------------------------------------------------------------------- 1 | diff --git a/content/browser/frame_host/render_frame_proxy_host.cc b/content/browser/frame_host/render_frame_proxy_host.cc 2 | index b44b0fd..a74d827 100644 3 | --- a/content/browser/frame_host/render_frame_proxy_host.cc 4 | +++ b/content/browser/frame_host/render_frame_proxy_host.cc 5 | @@ -253,6 +253,12 @@ void RenderFrameProxyHost::SetDestructionCallback( 6 | 7 | void RenderFrameProxyHost::OnDetach() { 8 | if (frame_tree_node_->render_manager()->ForInnerDelegate()) { 9 | + // Don't detach the frame for webview, we will manage the WebContents 10 | + // manually. 11 | + // We should revisit this bug after upgrading to newer versions of Chrome, 12 | + // this patch was introduced in Chrome 66. 13 | + return; 14 | + 15 | // Only main frame proxy can detach for inner WebContents. 16 | DCHECK(frame_tree_node_->IsMainFrame()); 17 | frame_tree_node_->render_manager()->RemoveOuterDelegateFrame(); 18 | -------------------------------------------------------------------------------- /patches/common/chromium/disable_hidden.patch: -------------------------------------------------------------------------------- 1 | diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc 2 | index 77c870b8a075..f1c4076788c5 100644 3 | --- a/content/browser/renderer_host/render_widget_host_impl.cc 4 | +++ b/content/browser/renderer_host/render_widget_host_impl.cc 5 | @@ -664,6 +664,9 @@ void RenderWidgetHostImpl::WasHidden() { 6 | if (is_hidden_) 7 | return; 8 | 9 | + if (disable_hidden_) 10 | + return; 11 | + 12 | RejectMouseLockOrUnlockIfNecessary(); 13 | 14 | TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::WasHidden"); 15 | diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h 16 | index b6aa99e..ef4fa35 100644 17 | --- a/content/browser/renderer_host/render_widget_host_impl.h 18 | +++ b/content/browser/renderer_host/render_widget_host_impl.h 19 | @@ -124,6 +124,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl : public RenderWidgetHost, 20 | // RenderWidgetHostImpl. 21 | static RenderWidgetHostImpl* From(RenderWidgetHost* rwh); 22 | 23 | + // Electron: Prevents the widget from getting hidden. 24 | + bool disable_hidden_ = false; 25 | + 26 | void set_hung_renderer_delay(const base::TimeDelta& delay) { 27 | hung_renderer_delay_ = delay; 28 | } 29 | -------------------------------------------------------------------------------- /patches/common/chromium/disable_scroll_begin_dcheck.patch: -------------------------------------------------------------------------------- 1 | diff --git a/content/browser/renderer_host/input/mouse_wheel_event_queue.cc b/content/browser/renderer_host/input/mouse_wheel_event_queue.cc 2 | index 5d5bead..f2ac4d8 100644 3 | --- a/content/browser/renderer_host/input/mouse_wheel_event_queue.cc 4 | +++ b/content/browser/renderer_host/input/mouse_wheel_event_queue.cc 5 | @@ -339,7 +339,7 @@ void MouseWheelEventQueue::SendScrollBegin( 6 | (synthetic && !needs_scroll_begin_when_scroll_latching_disabled_) || 7 | needs_scroll_begin_when_scroll_latching_disabled_); 8 | 9 | - DCHECK(!scroll_in_progress_); 10 | + // DCHECK(!scroll_in_progress_); 11 | scroll_in_progress_ = true; 12 | 13 | WebGestureEvent scroll_begin(gesture_update); 14 | diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc 15 | index 97ca37d843be..fdc4a3f90c64 100644 16 | --- a/content/browser/renderer_host/render_widget_host_impl.cc 17 | +++ b/content/browser/renderer_host/render_widget_host_impl.cc 18 | @@ -1230,8 +1238,8 @@ void RenderWidgetHostImpl::ForwardGestureEventWithLatencyInfo( 19 | // GSB and GSU events instead of sending them to the renderer and continues 20 | // to progress the fling. So, the renderer doesn't receive two GSB events 21 | // without any GSE in between. 22 | - DCHECK(!is_in_gesture_scroll_[gesture_event.SourceDevice()] || 23 | - FlingCancellationIsDeferred()); 24 | + // DCHECK(!is_in_gesture_scroll_[gesture_event.SourceDevice()] || 25 | + // FlingCancellationIsDeferred()); 26 | is_in_gesture_scroll_[gesture_event.SourceDevice()] = true; 27 | } else if (gesture_event.GetType() == 28 | blink::WebInputEvent::kGestureScrollEnd) { 29 | -------------------------------------------------------------------------------- /patches/common/chromium/disable_user_gesture_requirement_for_beforeunload_dialogs.patch: -------------------------------------------------------------------------------- 1 | diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc 2 | index a39067db8c52..4a0d69dc3fb5 100644 3 | --- a/third_party/blink/renderer/core/dom/document.cc 4 | +++ b/third_party/blink/renderer/core/dom/document.cc 5 | @@ -3239,7 +3239,9 @@ bool Document::DispatchBeforeUnloadEvent(ChromeClient& chrome_client, 6 | "Blocked attempt to show a 'beforeunload' confirmation panel for a " 7 | "frame that never had a user gesture since its load. " 8 | "https://www.chromestatus.com/feature/5082396709879808")); 9 | - return true; 10 | + // TODO(alexeykuzmin): Uncomment `return true` when Electron tests are fixed. 11 | + // See https://github.com/electron/electron/issues/10754 12 | + // return true; 13 | } 14 | 15 | if (did_allow_navigation) { 16 | -------------------------------------------------------------------------------- /patches/common/chromium/dom_storage_map.patch: -------------------------------------------------------------------------------- 1 | diff --git a/content/common/dom_storage/dom_storage_map.cc b/content/common/dom_storage/dom_storage_map.cc 2 | index 0a6b0176a982..35a1c3c11a58 100644 3 | --- a/content/common/dom_storage/dom_storage_map.cc 4 | +++ b/content/common/dom_storage/dom_storage_map.cc 5 | @@ -182,10 +182,12 @@ bool DOMStorageMap::SetItemInternal(MapType* map_type, 6 | size_t new_item_size = size_in_storage(key, value); 7 | size_t new_storage_used = storage_used_ - old_item_size + new_item_size; 8 | 9 | +#if 0 // Disable localStorage size limit for Electron. 10 | // Only check quota if the size is increasing, this allows 11 | // shrinking changes to pre-existing files that are over budget. 12 | if (new_item_size > old_item_size && new_storage_used > quota_) 13 | return false; 14 | +#endif 15 | 16 | (*map_type)[key] = value; 17 | ResetKeyIterator(); 18 | -------------------------------------------------------------------------------- /patches/common/chromium/enable_osr_components.patch: -------------------------------------------------------------------------------- 1 | diff --git a/content/browser/renderer_host/input/mouse_wheel_phase_handler.h b/content/browser/renderer_host/input/mouse_wheel_phase_handler.h 2 | index 4f7c03d62930..25b74d9b5236 100644 3 | --- a/content/browser/renderer_host/input/mouse_wheel_phase_handler.h 4 | +++ b/content/browser/renderer_host/input/mouse_wheel_phase_handler.h 5 | @@ -7,6 +7,7 @@ 6 | 7 | #include "base/timer/timer.h" 8 | #include "content/browser/renderer_host/render_widget_host_delegate.h" 9 | +#include "content/common/content_export.h" 10 | #include "content/public/common/input_event_ack_state.h" 11 | #include "third_party/blink/public/platform/web_mouse_wheel_event.h" 12 | 13 | @@ -55,7 +56,7 @@ enum class FirstScrollUpdateAckState { 14 | // The MouseWheelPhaseHandler is responsible for adding the proper phase to 15 | // wheel events. Phase information is necessary for wheel scrolling since it 16 | // shows the start and end of a scrolling sequence. 17 | -class MouseWheelPhaseHandler { 18 | +class CONTENT_EXPORT MouseWheelPhaseHandler { 19 | public: 20 | MouseWheelPhaseHandler(RenderWidgetHostViewBase* const host_view); 21 | ~MouseWheelPhaseHandler() {} 22 | -------------------------------------------------------------------------------- /patches/common/chromium/enable_widevine.patch: -------------------------------------------------------------------------------- 1 | diff --git a/third_party/widevine/cdm/widevine.gni b/third_party/widevine/cdm/widevine.gni 2 | index 82a93622585a..cbd10bed9f3b 100644 3 | --- a/third_party/widevine/cdm/widevine.gni 4 | +++ b/third_party/widevine/cdm/widevine.gni 5 | @@ -7,7 +7,7 @@ import("//media/media_options.gni") 6 | 7 | declare_args() { 8 | # Allow Widevine key system support in Chromium. 9 | - enable_widevine = false 10 | + enable_widevine = is_mac || is_win 11 | } 12 | 13 | enable_widevine_cdm_host_verification = 14 | -------------------------------------------------------------------------------- /patches/common/chromium/export_blink_webdisplayitemlist.patch: -------------------------------------------------------------------------------- 1 | diff --git a/third_party/blink/public/platform/web_display_item_list.h b/third_party/blink/public/platform/web_display_item_list.h 2 | index 31a3f6d8d5f4..0b2a13230fbd 100644 3 | --- a/third_party/blink/public/platform/web_display_item_list.h 4 | +++ b/third_party/blink/public/platform/web_display_item_list.h 5 | @@ -6,6 +6,7 @@ 6 | #define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_DISPLAY_ITEM_LIST_H_ 7 | 8 | #include "third_party/blink/public/platform/web_blend_mode.h" 9 | +#include "third_party/blink/public/platform/web_common.h" 10 | #include "third_party/blink/public/platform/web_float_point.h" 11 | #include "third_party/blink/public/platform/web_float_rect.h" 12 | #include "third_party/blink/public/platform/web_rect.h" 13 | @@ -33,7 +34,7 @@ namespace blink { 14 | // 'drawing' items) and operations to be performed when rendering this content 15 | // (stored in 'clip', 'transform', 'filter', etc...). For more details see: 16 | // http://dev.chromium.org/blink/slimming-paint. 17 | -class WebDisplayItemList { 18 | +class BLINK_EXPORT WebDisplayItemList { 19 | public: 20 | virtual ~WebDisplayItemList() = default; 21 | 22 | -------------------------------------------------------------------------------- /patches/common/chromium/fix-arm64-linking-error.patch: -------------------------------------------------------------------------------- 1 | diff --git a/skia/BUILD.gn b/skia/BUILD.gn 2 | index c0477a6fe82d..3a020f2e2006 100644 3 | --- a/skia/BUILD.gn 4 | +++ b/skia/BUILD.gn 5 | @@ -125,7 +125,7 @@ config("skia_library_config") { 6 | 7 | defines = [] 8 | 9 | - if (!is_ios && !use_system_freetype) { 10 | + if (!is_ios && (is_win || is_mac)) { 11 | defines += [ "SK_FREETYPE_MINIMUM_RUNTIME_VERSION=(((FREETYPE_MAJOR) * 0x01000000) | ((FREETYPE_MINOR) * 0x00010000) | ((FREETYPE_PATCH) * 0x00000100))" ] 12 | } 13 | 14 | -------------------------------------------------------------------------------- /patches/common/chromium/gin_enable_disable_v8_platform.patch: -------------------------------------------------------------------------------- 1 | diff --git a/gin/isolate_holder.cc b/gin/isolate_holder.cc 2 | index 56402d477ca3..8ab11bd18783 100644 3 | --- a/gin/isolate_holder.cc 4 | +++ b/gin/isolate_holder.cc 5 | @@ -116,9 +116,10 @@ IsolateHolder::~IsolateHolder() { 6 | void IsolateHolder::Initialize(ScriptMode mode, 7 | V8ExtrasMode v8_extras_mode, 8 | v8::ArrayBuffer::Allocator* allocator, 9 | - const intptr_t* reference_table) { 10 | + const intptr_t* reference_table, 11 | + bool create_v8_platform) { 12 | CHECK(allocator); 13 | - V8Initializer::Initialize(mode, v8_extras_mode); 14 | + V8Initializer::Initialize(mode, v8_extras_mode, create_v8_platform); 15 | g_array_buffer_allocator = allocator; 16 | g_reference_table = reference_table; 17 | } 18 | diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h 19 | index 2509aca609f9..94003c6031cf 100644 20 | --- a/gin/public/isolate_holder.h 21 | +++ b/gin/public/isolate_holder.h 22 | @@ -84,7 +84,8 @@ class GIN_EXPORT IsolateHolder { 23 | static void Initialize(ScriptMode mode, 24 | V8ExtrasMode v8_extras_mode, 25 | v8::ArrayBuffer::Allocator* allocator, 26 | - const intptr_t* reference_table = nullptr); 27 | + const intptr_t* reference_table = nullptr, 28 | + bool create_v8_platform = true); 29 | 30 | v8::Isolate* isolate() { return isolate_; } 31 | 32 | diff --git a/gin/v8_initializer.cc b/gin/v8_initializer.cc 33 | index 02d4b1cd6521..ec6d51d7e5d8 100644 34 | --- a/gin/v8_initializer.cc 35 | +++ b/gin/v8_initializer.cc 36 | @@ -236,12 +236,14 @@ LoadV8FileResult MapOpenedFile(const OpenedFileMap::mapped_type& file_region, 37 | 38 | // static 39 | void V8Initializer::Initialize(IsolateHolder::ScriptMode mode, 40 | - IsolateHolder::V8ExtrasMode v8_extras_mode) { 41 | + IsolateHolder::V8ExtrasMode v8_extras_mode, 42 | + bool create_v8_platform) { 43 | static bool v8_is_initialized = false; 44 | if (v8_is_initialized) 45 | return; 46 | 47 | - v8::V8::InitializePlatform(V8Platform::Get()); 48 | + if (create_v8_platform) 49 | + v8::V8::InitializePlatform(V8Platform::Get()); 50 | 51 | if (base::FeatureList::IsEnabled(features::kV8OptimizeJavascript)) { 52 | static const char optimize[] = "--opt"; 53 | diff --git a/gin/v8_initializer.h b/gin/v8_initializer.h 54 | index f0a7c5e0fb68..df4ab4f3e4b9 100644 55 | --- a/gin/v8_initializer.h 56 | +++ b/gin/v8_initializer.h 57 | @@ -21,7 +21,8 @@ class GIN_EXPORT V8Initializer { 58 | public: 59 | // This should be called by IsolateHolder::Initialize(). 60 | static void Initialize(IsolateHolder::ScriptMode mode, 61 | - IsolateHolder::V8ExtrasMode v8_extras_mode); 62 | + IsolateHolder::V8ExtrasMode v8_extras_mode, 63 | + bool create_v8_platform = true); 64 | 65 | // Get address and size information for currently loaded snapshot. 66 | // If no snapshot is loaded, the return values are null for addresses 67 | -------------------------------------------------------------------------------- /patches/common/chromium/gtk_visibility.patch: -------------------------------------------------------------------------------- 1 | diff --git a/build/config/linux/gtk/BUILD.gn b/build/config/linux/gtk/BUILD.gn 2 | index eb75461..2116f93 100644 3 | --- a/build/config/linux/gtk/BUILD.gn 4 | +++ b/build/config/linux/gtk/BUILD.gn 5 | @@ -17,6 +17,8 @@ assert(is_linux, "This file should only be referenced on Linux") 6 | group("gtk") { 7 | visibility = [ 8 | "//chrome/test:interactive_ui_tests", 9 | + "//electron:*", 10 | + "//electron/brightray:*", 11 | "//examples:peerconnection_client", 12 | "//gpu/gles2_conform_support:gles2_conform_test_windowless", 13 | "//remoting/host", 14 | -------------------------------------------------------------------------------- /patches/common/chromium/ignore_rc_check.patch: -------------------------------------------------------------------------------- 1 | diff --git a/build/toolchain/win/tool_wrapper.py b/build/toolchain/win/tool_wrapper.py 2 | index a76e926a8681..c43839a01211 100644 3 | --- a/build/toolchain/win/tool_wrapper.py 4 | +++ b/build/toolchain/win/tool_wrapper.py 5 | @@ -258,7 +258,11 @@ class WinTool(object): 6 | if rc_exe_exit_code == 0: 7 | import filecmp 8 | # Strip "/fo" prefix. 9 | - assert filecmp.cmp(rc_res_output[3:], rcpy_res_output[3:]) 10 | + # ------ 11 | + # Temporarily ignore compares 12 | + # Nightly builds use very large version numbers that fail this check 13 | + # FIXME(zacwalk): Enable the assert. 14 | + # assert filecmp.cmp(rc_res_output[3:], rcpy_res_output[3:]) 15 | return rc_exe_exit_code 16 | 17 | def ExecActionWrapper(self, arch, rspfile, *dirname): 18 | -------------------------------------------------------------------------------- /patches/common/chromium/latency_info.patch: -------------------------------------------------------------------------------- 1 | diff --git a/ui/latency/BUILD.gn b/ui/latency/BUILD.gn 2 | index 2aeebd991ae3..27cacb8748c4 100644 3 | --- a/ui/latency/BUILD.gn 4 | +++ b/ui/latency/BUILD.gn 5 | @@ -5,7 +5,7 @@ 6 | import("//build/config/jumbo.gni") 7 | import("//testing/test.gni") 8 | 9 | -jumbo_source_set("latency") { 10 | +component("latency") { 11 | sources = [ 12 | "fixed_point.cc", 13 | "fixed_point.h", 14 | @@ -18,6 +18,7 @@ jumbo_source_set("latency") { 15 | "latency_tracker.h", 16 | "stream_analyzer.cc", 17 | "stream_analyzer.h", 18 | + "ui_latency_export.h", 19 | "windowed_analyzer.cc", 20 | "windowed_analyzer.h", 21 | ] 22 | @@ -22,6 +23,8 @@ jumbo_source_set("latency") { 23 | public_deps = [ 24 | "//services/metrics/public/cpp:metrics_cpp", 25 | ] 26 | + 27 | + defines = [ "UI_LATENCY_IMPLEMENTATION" ] 28 | } 29 | 30 | jumbo_source_set("test_support") { 31 | diff --git a/ui/latency/latency_info.h b/ui/latency/latency_info.h 32 | index d9d390861562..7b1aa99e8a9c 100644 33 | --- a/ui/latency/latency_info.h 34 | +++ b/ui/latency/latency_info.h 35 | @@ -16,6 +16,7 @@ 36 | #include "base/time/time.h" 37 | #include "services/metrics/public/cpp/ukm_source_id.h" 38 | #include "ui/gfx/geometry/point_f.h" 39 | +#include "ui/latency/ui_latency_export.h" 40 | 41 | #if !defined(OS_IOS) 42 | #include "ipc/ipc_param_traits.h" // nogncheck 43 | @@ -114,7 +115,7 @@ enum SourceEventType { 44 | SOURCE_EVENT_TYPE_LAST = OTHER, 45 | }; 46 | 47 | -class LatencyInfo { 48 | +class UI_LATENCY_EXPORT LatencyInfo { 49 | public: 50 | struct LatencyComponent { 51 | // Nondecreasing number that can be used to determine what events happened 52 | diff --git a/ui/latency/latency_tracker.h b/ui/latency/latency_tracker.h 53 | index 24397fc4ba6d..ad943fa7ccf7 100644 54 | --- a/ui/latency/latency_tracker.h 55 | +++ b/ui/latency/latency_tracker.h 56 | @@ -8,12 +8,13 @@ 57 | #include "base/macros.h" 58 | #include "services/metrics/public/cpp/ukm_source_id.h" 59 | #include "ui/latency/latency_info.h" 60 | +#include "ui/latency/ui_latency_export.h" 61 | 62 | namespace ui { 63 | 64 | // Utility class for tracking the latency of events. Relies on LatencyInfo 65 | // components logged by content::RenderWidgetHostLatencyTracker. 66 | -class LatencyTracker { 67 | +class UI_LATENCY_EXPORT LatencyTracker { 68 | public: 69 | explicit LatencyTracker(bool metric_sampling, 70 | ukm::SourceId ukm_source_id = ukm::kInvalidSourceId); 71 | diff --git a/ui/latency/ui_latency_export.h b/ui/latency/ui_latency_export.h 72 | new file mode 100644 73 | index 0000000..f24ee91 74 | --- /dev/null 75 | +++ b/ui/latency/ui_latency_export.h 76 | @@ -0,0 +1,25 @@ 77 | +#ifndef UI_LATENCY_UI_LATENCY_EXPORT_H_ 78 | +#define UI_LATENCY_UI_LATENCY_EXPORT_H_ 79 | + 80 | +#if defined(COMPONENT_BUILD) 81 | +#if defined(WIN32) 82 | + 83 | +#if defined(UI_LATENCY_IMPLEMENTATION) 84 | +#define UI_LATENCY_EXPORT __declspec(dllexport) 85 | +#else 86 | +#define UI_LATENCY_EXPORT __declspec(dllimport) 87 | +#endif // defined(UI_LATENCY_IMPLEMENTATION) 88 | + 89 | +#else // defined(WIN32) 90 | +#if defined(UI_LATENCY_IMPLEMENTATION) 91 | +#define UI_LATENCY_EXPORT __attribute__((visibility("default"))) 92 | +#else 93 | +#define UI_LATENCY_EXPORT 94 | +#endif 95 | +#endif 96 | + 97 | +#else // defined(COMPONENT_BUILD) 98 | +#define UI_LATENCY_EXPORT 99 | +#endif 100 | + 101 | +#endif // UI_LATENCY_UI_LATENCY_EXPORT_H_ 102 | -------------------------------------------------------------------------------- /patches/common/chromium/leveldb_ssize_t.patch: -------------------------------------------------------------------------------- 1 | diff --git a/third_party/leveldatabase/port/port_chromium.h b/third_party/leveldatabase/port/port_chromium.h 2 | index a7c449eba19c..acbce7efd582 100644 3 | --- a/third_party/leveldatabase/port/port_chromium.h 4 | +++ b/third_party/leveldatabase/port/port_chromium.h 5 | @@ -26,7 +26,11 @@ 6 | #endif 7 | 8 | #if defined(OS_WIN) 9 | +# if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED) 10 | typedef SSIZE_T ssize_t; 11 | +# define _SSIZE_T_ 12 | +# define _SSIZE_T_DEFINED 13 | +# endif 14 | #endif 15 | 16 | namespace leveldb { 17 | -------------------------------------------------------------------------------- /patches/common/chromium/mas-audiodeviceduck.patch: -------------------------------------------------------------------------------- 1 | From d322e351554a4fa1fbaf529769416041031f07e9 Mon Sep 17 00:00:00 2001 2 | From: Jeremy Apthorp 3 | Date: Mon, 6 Aug 2018 13:02:53 -0700 4 | Subject: fix: [mas] don't call private api AudioDeviceDuck 5 | 6 | --- 7 | media/audio/mac/audio_low_latency_input_mac.cc | 4 ++++ 8 | 1 file changed, 4 insertions(+) 9 | 10 | diff --git a/media/audio/mac/audio_low_latency_input_mac.cc b/media/audio/mac/audio_low_latency_input_mac.cc 11 | index 173167b54dfb..1c0fda354d03 100644 12 | --- a/media/audio/mac/audio_low_latency_input_mac.cc 13 | +++ b/media/audio/mac/audio_low_latency_input_mac.cc 14 | @@ -28,12 +28,14 @@ 15 | 16 | namespace { 17 | extern "C" { 18 | +#ifndef MAS_BUILD 19 | // See: 20 | // https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/PAL/pal/spi/cf/CoreAudioSPI.h?rev=228264 21 | OSStatus AudioDeviceDuck(AudioDeviceID inDevice, 22 | Float32 inDuckedLevel, 23 | const AudioTimeStamp* __nullable inStartTime, 24 | Float32 inRampDuration) __attribute__((weak_import)); 25 | +#endif 26 | } 27 | 28 | } // namespace 29 | @@ -604,6 +606,7 @@ bool AUAudioInputStream::OpenVoiceProcessingAU() { 30 | return false; 31 | } 32 | 33 | +#ifndef MAS_BUILD 34 | if (AudioDeviceDuck != nullptr) { 35 | // Undo the ducking. 36 | // Obtain the AudioDeviceID of the default output AudioDevice. 37 | @@ -619,6 +622,7 @@ bool AUAudioInputStream::OpenVoiceProcessingAU() { 38 | AudioDeviceDuck(output_device, 1.0, nullptr, 0.5); 39 | } 40 | } 41 | +#endif 42 | 43 | return true; 44 | } 45 | -- 46 | 2.17.0 47 | 48 | -------------------------------------------------------------------------------- /patches/common/chromium/mas-cfisobjc.patch: -------------------------------------------------------------------------------- 1 | From 9fb1ac04b1a3e7ec53e27cf1f413469d04360d1e Mon Sep 17 00:00:00 2001 2 | From: Jeremy Apthorp 3 | Date: Mon, 6 Aug 2018 17:11:14 -0700 4 | Subject: fix: [mas] remove usage of _CFIsObjC 5 | 6 | --- 7 | base/mac/foundation_util.mm | 7 +------ 8 | 1 file changed, 1 insertion(+), 6 deletions(-) 9 | 10 | diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm 11 | index aec8c0f6398c..6a6dfc272d45 100644 12 | --- a/base/mac/foundation_util.mm 13 | +++ b/base/mac/foundation_util.mm 14 | @@ -25,7 +25,6 @@ 15 | extern "C" { 16 | CFTypeID SecACLGetTypeID(); 17 | CFTypeID SecTrustedApplicationGetTypeID(); 18 | -Boolean _CFIsObjC(CFTypeID typeID, CFTypeRef obj); 19 | } // extern "C" 20 | #endif 21 | 22 | @@ -323,8 +322,7 @@ NSFont* CFToNSCast(CTFontRef cf_val) { 23 | const_cast(reinterpret_cast(cf_val)); 24 | DCHECK(!cf_val || 25 | CTFontGetTypeID() == CFGetTypeID(cf_val) || 26 | - (_CFIsObjC(CTFontGetTypeID(), cf_val) && 27 | - [ns_val isKindOfClass:[NSFont class]])); 28 | + ([ns_val isKindOfClass:[NSFont class]])); 29 | return ns_val; 30 | } 31 | 32 | @@ -392,9 +390,6 @@ CFCast(const CFTypeRef& cf_val) { 33 | return (CTFontRef)(cf_val); 34 | } 35 | 36 | - if (!_CFIsObjC(CTFontGetTypeID(), cf_val)) 37 | - return NULL; 38 | - 39 | id ns_val = reinterpret_cast(const_cast(cf_val)); 40 | if ([ns_val isKindOfClass:[NSFont class]]) { 41 | return (CTFontRef)(cf_val); 42 | -- 43 | 2.17.0 44 | 45 | -------------------------------------------------------------------------------- /patches/common/chromium/mas-cgdisplayusesforcetogray.patch: -------------------------------------------------------------------------------- 1 | From 82d0ef64e22c69c0435608276149977d2811a3f7 Mon Sep 17 00:00:00 2001 2 | From: Jeremy Apthorp 3 | Date: Mon, 6 Aug 2018 10:58:46 -0700 4 | Subject: fix: [mas] remove usage of CGDisplayUsesForceToGray 5 | 6 | --- 7 | ui/display/mac/screen_mac.mm | 10 ++++++++++ 8 | 1 file changed, 10 insertions(+) 9 | 10 | diff --git a/ui/display/mac/screen_mac.mm b/ui/display/mac/screen_mac.mm 11 | index 4850c795480e..ec34b25a6fe8 100644 12 | --- a/ui/display/mac/screen_mac.mm 13 | +++ b/ui/display/mac/screen_mac.mm 14 | @@ -106,7 +106,17 @@ Display BuildDisplayForScreen(NSScreen* screen) { 15 | 16 | display.set_color_depth(NSBitsPerPixelFromDepth([screen depth])); 17 | display.set_depth_per_component(NSBitsPerSampleFromDepth([screen depth])); 18 | +#ifdef MAS_BUILD 19 | + // This is equivalent to the CGDisplayUsesForceToGray() API as at 2018-08-06, 20 | + // but avoids usage of the private API. 21 | + CFStringRef app = CFSTR("com.apple.CoreGraphics"); 22 | + CFStringRef key = CFSTR("DisplayUseForcedGray"); 23 | + Boolean key_valid = false; 24 | + display.set_is_monochrome( 25 | + CFPreferencesGetAppBooleanValue(key, app, &key_valid)); 26 | +#else 27 | display.set_is_monochrome(CGDisplayUsesForceToGray()); 28 | +#endif 29 | 30 | // CGDisplayRotation returns a double. Display::SetRotationAsDegree will 31 | // handle the unexpected situations were the angle is not a multiple of 90. 32 | -- 33 | 2.17.0 34 | 35 | -------------------------------------------------------------------------------- /patches/common/chromium/mas-lssetapplicationlaunchservicesserverconnectionstatus.patch: -------------------------------------------------------------------------------- 1 | From 3fcbe57ff316894349907bf1c85f71d7487f0932 Mon Sep 17 00:00:00 2001 2 | From: Jeremy Apthorp 3 | Date: Mon, 6 Aug 2018 13:40:24 -0700 4 | Subject: fix: [mas] don't call LaunchServices private api 5 | 6 | --- 7 | content/gpu/gpu_main.cc | 2 ++ 8 | 1 file changed, 2 insertions(+) 9 | 10 | diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc 11 | index 115f871094bc..aa47a1c1a51e 100644 12 | --- a/content/gpu/gpu_main.cc 13 | +++ b/content/gpu/gpu_main.cc 14 | @@ -276,8 +276,10 @@ int GpuMain(const MainFunctionParams& parameters) { 15 | std::unique_ptr pump(new base::MessagePumpNSRunLoop()); 16 | main_message_loop.reset(new base::MessageLoop(std::move(pump))); 17 | 18 | +#ifndef MAS_BUILD 19 | // Tell LaunchServices to continue without a connection to the daemon. 20 | _LSSetApplicationLaunchServicesServerConnectionStatus(0, nullptr); 21 | +#endif 22 | #else 23 | main_message_loop.reset( 24 | new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT)); 25 | -- 26 | 2.17.0 27 | 28 | -------------------------------------------------------------------------------- /patches/common/chromium/mas_blink_no_private_api.patch: -------------------------------------------------------------------------------- 1 | diff --git a/third_party/blink/renderer/core/paint/theme_painter_mac.mm b/third_party/blink/renderer/core/paint/theme_painter_mac.mm 2 | index 65e6437c22a6..3b726d196427 100644 3 | --- a/third_party/blink/renderer/core/paint/theme_painter_mac.mm 4 | +++ b/third_party/blink/renderer/core/paint/theme_painter_mac.mm 5 | @@ -43,6 +43,7 @@ 6 | 7 | // The methods in this file are specific to the Mac OS X platform. 8 | 9 | +#ifndef MAS_BUILD 10 | // Forward declare Mac SPIs. 11 | extern "C" { 12 | void _NSDrawCarbonThemeBezel(NSRect frame, BOOL enabled, BOOL flipped); 13 | @@ -52,6 +53,7 @@ void _NSDrawCarbonThemeListBox(NSRect frame, 14 | BOOL flipped, 15 | BOOL always_yes); 16 | } 17 | +#endif 18 | 19 | namespace blink { 20 | 21 | @@ -74,10 +76,12 @@ bool ThemePainterMac::PaintTextField(const Node* node, 22 | // behavior change while remaining a fragile solution. 23 | // https://bugs.chromium.org/p/chromium/issues/detail?id=658085#c3 24 | if (!use_ns_text_field_cell) { 25 | +#ifndef MAS_BUILD 26 | _NSDrawCarbonThemeBezel( 27 | CGRect(r), 28 | LayoutTheme::IsEnabled(node) && !LayoutTheme::IsReadOnlyControl(node), 29 | YES); 30 | +#endif 31 | return false; 32 | } 33 | 34 | @@ -163,10 +167,12 @@ bool ThemePainterMac::PaintTextArea(const Node* node, 35 | const PaintInfo& paint_info, 36 | const IntRect& r) { 37 | LocalCurrentGraphicsContext local_context(paint_info.context, r); 38 | +#ifndef MAS_BUILD 39 | _NSDrawCarbonThemeListBox( 40 | CGRect(r), 41 | LayoutTheme::IsEnabled(node) && !LayoutTheme::IsReadOnlyControl(node), 42 | YES, YES); 43 | +#endif 44 | return false; 45 | } 46 | 47 | diff --git a/third_party/blink/renderer/platform/mac/kill_ring_mac.mm b/third_party/blink/renderer/platform/mac/kill_ring_mac.mm 48 | index acf60f09fdb9..6376120a954f 100644 49 | --- a/third_party/blink/renderer/platform/mac/kill_ring_mac.mm 50 | +++ b/third_party/blink/renderer/platform/mac/kill_ring_mac.mm 51 | @@ -27,6 +27,7 @@ 52 | 53 | namespace blink { 54 | 55 | +#ifndef MAS_BUILD 56 | extern "C" { 57 | 58 | // Kill ring calls. Would be better to use NSKillRing.h, but that's not 59 | @@ -39,38 +40,53 @@ NSString* _NSYankFromKillRing(); 60 | void _NSNewKillRingSequence(); 61 | void _NSSetKillRingToYankedState(); 62 | } 63 | +#endif 64 | 65 | static void InitializeKillRingIfNeeded() { 66 | static bool initialized_kill_ring = false; 67 | if (!initialized_kill_ring) { 68 | initialized_kill_ring = true; 69 | +#ifndef MAS_BUILD 70 | _NSInitializeKillRing(); 71 | +#endif 72 | } 73 | } 74 | 75 | void KillRing::Append(const String& string) { 76 | InitializeKillRingIfNeeded(); 77 | +#ifndef MAS_BUILD 78 | _NSAppendToKillRing(string); 79 | +#endif 80 | } 81 | 82 | void KillRing::Prepend(const String& string) { 83 | InitializeKillRingIfNeeded(); 84 | +#ifndef MAS_BUILD 85 | _NSPrependToKillRing(string); 86 | +#endif 87 | } 88 | 89 | String KillRing::Yank() { 90 | InitializeKillRingIfNeeded(); 91 | +#ifndef MAS_BUILD 92 | return _NSYankFromKillRing(); 93 | +#else 94 | + return ""; 95 | +#endif 96 | } 97 | 98 | void KillRing::StartNewSequence() { 99 | InitializeKillRingIfNeeded(); 100 | +#ifndef MAS_BUILD 101 | _NSNewKillRingSequence(); 102 | +#endif 103 | } 104 | 105 | void KillRing::SetToYankedState() { 106 | InitializeKillRingIfNeeded(); 107 | +#ifndef MAS_BUILD 108 | _NSSetKillRingToYankedState(); 109 | +#endif 110 | } 111 | 112 | } // namespace blink 113 | -------------------------------------------------------------------------------- /patches/common/chromium/net_url_request_job.patch: -------------------------------------------------------------------------------- 1 | diff --git a/net/url_request/url_request_job.h b/net/url_request/url_request_job.h 2 | index 2341999..3011bf7 100644 3 | --- a/net/url_request/url_request_job.h 4 | +++ b/net/url_request/url_request_job.h 5 | @@ -269,6 +269,7 @@ class NET_EXPORT URLRequestJob : public base::PowerObserver { 6 | void OnCallToDelegate(); 7 | void OnCallToDelegateComplete(); 8 | 9 | + public: 10 | // Called to read raw (pre-filtered) data from this Job. Reads at most 11 | // |buf_size| bytes into |buf|. 12 | // Possible return values: 13 | -------------------------------------------------------------------------------- /patches/common/chromium/no_cache_storage_check.patch: -------------------------------------------------------------------------------- 1 | diff --git a/content/browser/cache_storage/cache_storage.cc b/content/browser/cache_storage/cache_storage.cc 2 | index ce6a21b..10a3b18 100644 3 | --- a/content/browser/cache_storage/cache_storage.cc 4 | +++ b/content/browser/cache_storage/cache_storage.cc 5 | @@ -129,7 +129,7 @@ class CacheStorage::CacheLoader { 6 | blob_context_(blob_context), 7 | cache_storage_(cache_storage), 8 | origin_(origin) { 9 | - DCHECK(!origin_.unique()); 10 | + // DCHECK(!origin_.unique()); 11 | } 12 | 13 | virtual ~CacheLoader() {} 14 | -------------------------------------------------------------------------------- /patches/common/chromium/no_stack_dumping.patch: -------------------------------------------------------------------------------- 1 | diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc 2 | index c283922..397ba80 100644 3 | --- a/content/app/content_main_runner.cc 4 | +++ b/content/app/content_main_runner.cc 5 | @@ -657,7 +657,7 @@ class ContentMainRunnerImpl : public ContentMainRunner { 6 | 7 | InitializeV8IfNeeded(command_line, process_type); 8 | 9 | -#if !defined(OFFICIAL_BUILD) 10 | +#if 0 11 | #if defined(OS_WIN) 12 | bool should_enable_stack_dump = !process_type.empty(); 13 | #else 14 | -------------------------------------------------------------------------------- /patches/common/chromium/out_of_process_instance.patch: -------------------------------------------------------------------------------- 1 | diff --git a/pdf/out_of_process_instance.cc b/pdf/out_of_process_instance.cc 2 | index 8b9c9f19a3dd..c4d801135053 100644 3 | --- a/pdf/out_of_process_instance.cc 4 | +++ b/pdf/out_of_process_instance.cc 5 | @@ -333,7 +333,9 @@ bool OutOfProcessInstance::Init(uint32_t argc, 6 | std::string document_url = document_url_var.AsString(); 7 | base::StringPiece document_url_piece(document_url); 8 | is_print_preview_ = IsPrintPreviewUrl(document_url_piece); 9 | - if (!document_url_piece.starts_with(kChromeExtension) && !is_print_preview_) 10 | + if (!document_url_piece.starts_with(kChromeExtension) && 11 | + !document_url_piece.starts_with("chrome://pdf-viewer") && 12 | + !is_print_preview_) 13 | return false; 14 | 15 | // Check if the plugin is full frame. This is passed in from JS. 16 | -------------------------------------------------------------------------------- /patches/common/chromium/protobuf_build_gn.patch: -------------------------------------------------------------------------------- 1 | diff --git a/BUILD.gn b/BUILD.gn 2 | index 067416ed38f4..9fa07961c5b8 100644 3 | --- a/third_party/protobuf/BUILD.gn 4 | +++ b/third_party/protobuf/BUILD.gn 5 | @@ -599,6 +599,11 @@ if (current_toolchain == host_toolchain) { 6 | 7 | configs -= [ "//build/config/compiler:chromium_code" ] 8 | configs += [ "//build/config/compiler:no_chromium_code" ] 9 | + if (is_win) { 10 | + # https://crbug.com/703251 11 | + configs -= [ "//build/config/win:default_incremental_linking" ] 12 | + configs += [ "//build/config/win:no_incremental_linking" ] 13 | + } 14 | 15 | cflags = protobuf_lite_cflags 16 | 17 | -------------------------------------------------------------------------------- /patches/common/chromium/render_widget_host_view_base.patch: -------------------------------------------------------------------------------- 1 | diff --git a/content/browser/renderer_host/render_widget_host_view_base.cc b/content/browser/renderer_host/render_widget_host_view_base.cc 2 | index 09a37c1a2c70..ff8c2db3fdae 100644 3 | --- a/content/browser/renderer_host/render_widget_host_view_base.cc 4 | +++ b/content/browser/renderer_host/render_widget_host_view_base.cc 5 | @@ -399,6 +399,15 @@ viz::FrameSinkId RenderWidgetHostViewBase::FrameSinkIdAtPoint( 6 | return frame_sink_id.is_valid() ? frame_sink_id : GetFrameSinkId(); 7 | } 8 | 9 | +RenderWidgetHostViewBase* RenderWidgetHostViewBase::CreateViewForWidget( 10 | + RenderWidgetHost* render_widget_host, 11 | + RenderWidgetHost* embedder_render_widget_host, 12 | + WebContentsView* web_contents_view) { 13 | + return web_contents_view->CreateViewForWidget( 14 | + render_widget_host, 15 | + !!embedder_render_widget_host); 16 | +} 17 | + 18 | void RenderWidgetHostViewBase::ProcessMouseEvent( 19 | const blink::WebMouseEvent& event, 20 | const ui::LatencyInfo& latency) { 21 | diff --git a/content/browser/renderer_host/render_widget_host_view_base.h b/content/browser/renderer_host/render_widget_host_view_base.h 22 | index 8e391207a8a7..d3637c82aba9 100644 23 | --- a/content/browser/renderer_host/render_widget_host_view_base.h 24 | +++ b/content/browser/renderer_host/render_widget_host_view_base.h 25 | @@ -21,8 +21,10 @@ 26 | #include "components/viz/common/surfaces/scoped_surface_id_allocator.h" 27 | #include "components/viz/common/surfaces/surface_id.h" 28 | #include "content/browser/renderer_host/event_with_latency_info.h" 29 | +#include "content/browser/web_contents/web_contents_view.h" 30 | #include "content/common/content_export.h" 31 | #include "content/public/browser/render_frame_metadata_provider.h" 32 | +#include "content/public/browser/render_widget_host.h" 33 | #include "content/public/browser/render_widget_host_view.h" 34 | #include "content/public/common/input_event_ack_state.h" 35 | #include "content/public/common/screen_info.h" 36 | @@ -79,10 +81,12 @@ class BrowserAccessibilityManager; 37 | class CursorManager; 38 | class RenderWidgetHostImpl; 39 | class RenderWidgetHostViewBaseObserver; 40 | +class RenderWidgetHostViewGuest; 41 | class SyntheticGestureTarget; 42 | class TextInputManager; 43 | class TouchSelectionControllerClientManager; 44 | class WebContentsAccessibility; 45 | +class WebContentsView; 46 | class WebCursor; 47 | struct TextInputState; 48 | 49 | @@ -124,6 +128,9 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, 50 | float GetDeviceScaleFactor() const final; 51 | TouchSelectionControllerClientManager* 52 | GetTouchSelectionControllerClientManager() override; 53 | + 54 | + virtual void InitAsGuest(RenderWidgetHostView* parent_host_view, 55 | + RenderWidgetHostViewGuest* guest_view) {} 56 | 57 | // This only needs to be overridden by RenderWidgetHostViewBase subclasses 58 | // that handle content embedded within other RenderWidgetHostViews. 59 | @@ -318,6 +325,11 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, 60 | virtual void ProcessGestureEvent(const blink::WebGestureEvent& event, 61 | const ui::LatencyInfo& latency); 62 | 63 | + virtual RenderWidgetHostViewBase* CreateViewForWidget( 64 | + RenderWidgetHost* render_widget_host, 65 | + RenderWidgetHost* embedder_render_widget_host, 66 | + WebContentsView* web_contents_view); 67 | + 68 | // Transform a point that is in the coordinate space of a Surface that is 69 | // embedded within the RenderWidgetHostViewBase's Surface to the 70 | // coordinate space of an embedding, or embedded, Surface. Typically this 71 | -------------------------------------------------------------------------------- /patches/common/chromium/resource_file_conflict.patch: -------------------------------------------------------------------------------- 1 | diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn 2 | index fbcf20c..d2173e2 100644 3 | --- a/chrome/BUILD.gn 4 | +++ b/chrome/BUILD.gn 5 | @@ -1656,6 +1656,11 @@ if (is_chrome_branded && !is_android) { 6 | } 7 | } 8 | 9 | +if (is_electron_gn_build) { 10 | + group("packed_resources") { 11 | + public_deps = [ "//electron:packed_resources" ] 12 | + } 13 | +} else { 14 | chrome_paks("packed_resources") { 15 | if (is_mac) { 16 | output_dir = "$root_gen_dir/repack" 17 | @@ -1677,6 +1682,7 @@ chrome_paks("packed_resources") { 18 | ] 19 | } 20 | } 21 | +} 22 | 23 | repack("browser_tests_pak") { 24 | sources = [ 25 | -------------------------------------------------------------------------------- /patches/common/chromium/scoped_clipboard_writer.patch: -------------------------------------------------------------------------------- 1 | diff --git a/ui/base/clipboard/scoped_clipboard_writer.cc b/ui/base/clipboard/scoped_clipboard_writer.cc 2 | index 6850cd460b1d..6d652cca59b4 100644 3 | --- a/ui/base/clipboard/scoped_clipboard_writer.cc 4 | +++ b/ui/base/clipboard/scoped_clipboard_writer.cc 5 | @@ -102,17 +102,16 @@ void ScopedClipboardWriter::WriteImage(const SkBitmap& bitmap) { 6 | objects_[Clipboard::CBF_SMBITMAP] = parameters; 7 | } 8 | 9 | -void ScopedClipboardWriter::WritePickledData( 10 | - const base::Pickle& pickle, 11 | - const Clipboard::FormatType& format) { 12 | +void ScopedClipboardWriter::WriteData(const char* data, 13 | + int size, 14 | + const Clipboard::FormatType& format) { 15 | std::string format_string = format.Serialize(); 16 | Clipboard::ObjectMapParam format_parameter(format_string.begin(), 17 | format_string.end()); 18 | Clipboard::ObjectMapParam data_parameter; 19 | 20 | - data_parameter.resize(pickle.size()); 21 | - memcpy(const_cast(&data_parameter.front()), 22 | - pickle.data(), pickle.size()); 23 | + data_parameter.resize(size); 24 | + memcpy(const_cast(&data_parameter.front()), data, size); 25 | 26 | Clipboard::ObjectMapParams parameters; 27 | parameters.push_back(format_parameter); 28 | @@ -121,6 +121,13 @@ void ScopedClipboardWriter::WritePickledData( 29 | objects_[Clipboard::CBF_DATA] = parameters; 30 | } 31 | 32 | +void ScopedClipboardWriter::WritePickledData( 33 | + const base::Pickle& pickle, 34 | + const Clipboard::FormatType& format) { 35 | + WriteData(reinterpret_cast(pickle.data()), pickle.size(), 36 | + format); 37 | +} 38 | + 39 | void ScopedClipboardWriter::Reset() { 40 | objects_.clear(); 41 | bitmap_.reset(); 42 | diff --git a/ui/base/clipboard/scoped_clipboard_writer.h b/ui/base/clipboard/scoped_clipboard_writer.h 43 | index a7e064561ca9..d5a1b76bc6a7 100644 44 | --- a/ui/base/clipboard/scoped_clipboard_writer.h 45 | +++ b/ui/base/clipboard/scoped_clipboard_writer.h 46 | @@ -61,6 +61,11 @@ class UI_BASE_EXPORT ScopedClipboardWriter { 47 | // Used by WebKit to determine whether WebKit wrote the clipboard last 48 | void WriteWebSmartPaste(); 49 | 50 | + // Adds arbitrary data to clipboard. 51 | + void WriteData(const char* data, 52 | + int size, 53 | + const Clipboard::FormatType& format); 54 | + 55 | // Adds arbitrary pickled data to clipboard. 56 | void WritePickledData(const base::Pickle& pickle, 57 | const Clipboard::FormatType& format); 58 | -------------------------------------------------------------------------------- /patches/common/chromium/scroll_bounce_flag.patch: -------------------------------------------------------------------------------- 1 | diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc 2 | index 81d3f80..a8c4a57 100644 3 | --- a/content/renderer/render_thread_impl.cc 4 | +++ b/content/renderer/render_thread_impl.cc 5 | @@ -1737,7 +1737,7 @@ bool RenderThreadImpl::IsGpuMemoryBufferCompositorResourcesEnabled() { 6 | } 7 | 8 | bool RenderThreadImpl::IsElasticOverscrollEnabled() { 9 | - return is_elastic_overscroll_enabled_; 10 | + return base::CommandLine::ForCurrentProcess()->HasSwitch("scroll-bounce"); 11 | } 12 | 13 | scoped_refptr 14 | -------------------------------------------------------------------------------- /patches/common/chromium/ssl_security_state_tab_helper.patch: -------------------------------------------------------------------------------- 1 | diff --git a/chrome/browser/ssl/security_state_tab_helper.cc b/chrome/browser/ssl/security_state_tab_helper.cc 2 | index a73442a5476c..6cd7ae78b814 100644 3 | --- a/chrome/browser/ssl/security_state_tab_helper.cc 4 | +++ b/chrome/browser/ssl/security_state_tab_helper.cc 5 | @@ -10,15 +10,21 @@ 6 | #include "base/metrics/histogram_macros.h" 7 | #include "base/time/time.h" 8 | #include "build/build_config.h" 9 | +#if 0 10 | #include "chrome/browser/browser_process.h" 11 | #include "chrome/browser/profiles/profile.h" 12 | #include "chrome/browser/safe_browsing/safe_browsing_service.h" 13 | #include "chrome/browser/safe_browsing/ui_manager.h" 14 | +#endif 15 | #include "components/prefs/pref_service.h" 16 | +#if 0 17 | #include "components/safe_browsing/features.h" 18 | +#endif 19 | #include "components/security_state/content/content_utils.h" 20 | #include "components/ssl_config/ssl_config_prefs.h" 21 | +#if 0 22 | #include "components/toolbar/toolbar_field_trial.h" 23 | +#endif 24 | #include "content/public/browser/browser_context.h" 25 | #include "content/public/browser/navigation_entry.h" 26 | #include "content/public/browser/navigation_handle.h" 27 | @@ -37,7 +43,7 @@ 28 | #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h" 29 | #endif // defined(OS_CHROMEOS) 30 | 31 | -#if defined(SAFE_BROWSING_DB_LOCAL) 32 | +#if 0 33 | #include "chrome/browser/safe_browsing/chrome_password_protection_service.h" 34 | #endif 35 | 36 | @@ -59,7 +65,9 @@ void RecordSecurityLevel(const security_state::SecurityInfo& security_info) { 37 | 38 | DEFINE_WEB_CONTENTS_USER_DATA_KEY(SecurityStateTabHelper); 39 | 40 | +#if 0 41 | using safe_browsing::SafeBrowsingUIManager; 42 | +#endif 43 | 44 | SecurityStateTabHelper::SecurityStateTabHelper( 45 | content::WebContents* web_contents) 46 | @@ -67,8 +75,11 @@ SecurityStateTabHelper::SecurityStateTabHelper( 47 | logged_http_warning_on_current_navigation_(false), 48 | is_incognito_(false) { 49 | content::BrowserContext* context = web_contents->GetBrowserContext(); 50 | - if (context->IsOffTheRecord() && 51 | - !Profile::FromBrowserContext(context)->IsGuestSession()) { 52 | + if (context->IsOffTheRecord() 53 | +#if 0 54 | + && !Profile::FromBrowserContext(context)->IsGuestSession() 55 | +#endif 56 | + ) { 57 | is_incognito_ = true; 58 | } 59 | } 60 | @@ -150,6 +161,7 @@ void SecurityStateTabHelper::DidFinishNavigation( 61 | UMA_HISTOGRAM_BOOLEAN("interstitial.ssl.visited_site_after_warning", true); 62 | } 63 | 64 | +#if 0 65 | // Security indicator UI study (https://crbug.com/803501): Show a message in 66 | // the console to reduce developer confusion about the experimental UI 67 | // treatments for HTTPS pages with EV certificates. 68 | @@ -177,6 +189,7 @@ void SecurityStateTabHelper::DidFinishNavigation( 69 | "Validation is still valid."); 70 | } 71 | } 72 | +#endif 73 | } 74 | 75 | void SecurityStateTabHelper::DidChangeVisibleSecurityState() { 76 | @@ -250,6 +263,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const { 77 | web_contents()->GetController().GetVisibleEntry(); 78 | if (!entry) 79 | return security_state::MALICIOUS_CONTENT_STATUS_NONE; 80 | +#if 0 81 | safe_browsing::SafeBrowsingService* sb_service = 82 | g_browser_process->safe_browsing_service(); 83 | if (!sb_service) 84 | @@ -301,6 +315,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const { 85 | break; 86 | } 87 | } 88 | +#endif 89 | return security_state::MALICIOUS_CONTENT_STATUS_NONE; 90 | } 91 | 92 | -------------------------------------------------------------------------------- /patches/common/chromium/statically_build_power_save_blocker.patch: -------------------------------------------------------------------------------- 1 | diff --git a/services/device/wake_lock/power_save_blocker/BUILD.gn b/services/device/wake_lock/power_save_blocker/BUILD.gn 2 | index e04629ca1a93..299e6efd75f9 100644 3 | --- a/services/device/wake_lock/power_save_blocker/BUILD.gn 4 | +++ b/services/device/wake_lock/power_save_blocker/BUILD.gn 5 | @@ -9,7 +9,7 @@ if (is_android) { 6 | import("//build/config/android/rules.gni") 7 | } 8 | 9 | -source_set("power_save_blocker") { 10 | +static_library("power_save_blocker") { 11 | visibility = [ 12 | # //remoting runs in a separate process which is outside of the context of 13 | # the ServiceManager-based world. Instead of embedding a Service Manager 14 | @@ -18,6 +18,7 @@ source_set("power_save_blocker") { 15 | "//remoting/host:*", 16 | "//remoting/host/win:*", 17 | "//services/device/wake_lock:*", 18 | + "//electron:*", 19 | ] 20 | 21 | sources = [ 22 | -------------------------------------------------------------------------------- /patches/common/chromium/stream_resource_handler.patch: -------------------------------------------------------------------------------- 1 | diff --git a/content/browser/loader/stream_resource_handler.h b/content/browser/loader/stream_resource_handler.h 2 | index 9f69994..ae8d1630 100644 3 | --- a/content/browser/loader/stream_resource_handler.h 4 | +++ b/content/browser/loader/stream_resource_handler.h 5 | @@ -11,6 +11,7 @@ 6 | #include "base/memory/ref_counted.h" 7 | #include "content/browser/loader/resource_handler.h" 8 | #include "content/browser/loader/stream_writer.h" 9 | +#include "content/common/content_export.h" 10 | 11 | namespace net { 12 | class URLRequest; 13 | @@ -22,7 +23,7 @@ class ResourceController; 14 | class StreamRegistry; 15 | 16 | // Redirect this resource to a stream. 17 | -class StreamResourceHandler : public ResourceHandler { 18 | +class CONTENT_EXPORT StreamResourceHandler : public ResourceHandler { 19 | public: 20 | // |origin| will be used to construct the URL for the Stream. See 21 | // WebCore::BlobURL and and WebCore::SecurityOrigin in Blink to understand 22 | -------------------------------------------------------------------------------- /patches/common/chromium/thread_capabilities.patch: -------------------------------------------------------------------------------- 1 | diff --git a/sandbox/linux/services/credentials.cc b/sandbox/linux/services/credentials.cc 2 | index 50a109e..3ee9159 100644 3 | --- a/sandbox/linux/services/credentials.cc 4 | +++ b/sandbox/linux/services/credentials.cc 5 | @@ -358,8 +358,10 @@ pid_t Credentials::ForkAndDropCapabilitiesInChild() { 6 | return pid; 7 | } 8 | 9 | +#if 0 10 | // Since we just forked, we are single threaded. 11 | PCHECK(DropAllCapabilitiesOnCurrentThread()); 12 | +#endif 13 | return 0; 14 | } 15 | 16 | -------------------------------------------------------------------------------- /patches/common/chromium/use_transparent_window.patch: -------------------------------------------------------------------------------- 1 | diff --git a/ui/gl/gpu_switching_manager.cc b/ui/gl/gpu_switching_manager.cc 2 | index be7156465809..cee3b1af3dc5 100644 3 | --- a/ui/gl/gpu_switching_manager.cc 4 | +++ b/ui/gl/gpu_switching_manager.cc 5 | @@ -4,6 +4,12 @@ 6 | 7 | #include "ui/gl/gpu_switching_manager.h" 8 | 9 | +namespace { 10 | + 11 | +bool g_use_transparent = false; 12 | + 13 | +} // namespace 14 | + 15 | namespace ui { 16 | 17 | // static 18 | @@ -11,6 +17,16 @@ GpuSwitchingManager* GpuSwitchingManager::GetInstance() { 19 | return base::Singleton::get(); 20 | } 21 | 22 | +// static 23 | +void GpuSwitchingManager::SetTransparent(bool transparent) { 24 | + g_use_transparent = transparent; 25 | +} 26 | + 27 | +// static 28 | +bool GpuSwitchingManager::UseTransparent() { 29 | + return g_use_transparent; 30 | +} 31 | + 32 | GpuSwitchingManager::GpuSwitchingManager() {} 33 | 34 | GpuSwitchingManager::~GpuSwitchingManager() {} 35 | diff --git a/ui/gl/gpu_switching_manager.h b/ui/gl/gpu_switching_manager.h 36 | index 4308bbed9398..a7cafcfccdff 100644 37 | --- a/ui/gl/gpu_switching_manager.h 38 | +++ b/ui/gl/gpu_switching_manager.h 39 | @@ -18,6 +18,9 @@ class GL_EXPORT GpuSwitchingManager { 40 | // Getter for the singleton. This will return NULL on failure. 41 | static GpuSwitchingManager* GetInstance(); 42 | 43 | + static void SetTransparent(bool transparent); 44 | + static bool UseTransparent(); 45 | + 46 | void AddObserver(GpuSwitchingObserver* observer); 47 | void RemoveObserver(GpuSwitchingObserver* observer); 48 | 49 | -------------------------------------------------------------------------------- /patches/common/chromium/v8_context_snapshot_generator.patch: -------------------------------------------------------------------------------- 1 | diff --git a/tools/v8_context_snapshot/BUILD.gn b/tools/v8_context_snapshot/BUILD.gn 2 | index d6691a527f25..000105b86f53 100644 3 | --- a/tools/v8_context_snapshot/BUILD.gn 4 | +++ b/tools/v8_context_snapshot/BUILD.gn 5 | @@ -105,6 +105,7 @@ if (use_v8_context_snapshot) { 6 | configs += [ 7 | "//v8:external_startup_data", 8 | ":disable_icf", 9 | + "//libchromiumcontent/chromiumcontent/config:build_time_executable" 10 | ] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /patches/common/chromium/webview_cross_drag.patch: -------------------------------------------------------------------------------- 1 | diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc 2 | index 1bfef2c..0ba2260 100644 3 | --- a/content/browser/web_contents/web_contents_view_aura.cc 4 | +++ b/content/browser/web_contents/web_contents_view_aura.cc 5 | @@ -675,6 +675,7 @@ gfx::NativeView WebContentsViewAura::GetRenderWidgetHostViewParent() const { 6 | 7 | bool WebContentsViewAura::IsValidDragTarget( 8 | RenderWidgetHostImpl* target_rwh) const { 9 | + return true; 10 | return target_rwh->GetProcess()->GetID() == drag_start_process_id_ || 11 | GetRenderViewHostID(web_contents_->GetRenderViewHost()) != 12 | drag_start_view_id_; 13 | diff --git a/content/browser/web_contents/web_drag_dest_mac.mm b/content/browser/web_contents/web_drag_dest_mac.mm 14 | index 37ed265..814a37d 100644 15 | --- a/content/browser/web_contents/web_drag_dest_mac.mm 16 | +++ b/content/browser/web_contents/web_drag_dest_mac.mm 17 | @@ -348,6 +348,7 @@ - (void)setDragStartTrackersForProcess:(int)processID { 18 | } 19 | 20 | - (bool)isValidDragTarget:(content::RenderWidgetHostImpl*)targetRWH { 21 | + return YES; 22 | return targetRWH->GetProcess()->GetID() == dragStartProcessID_ || 23 | GetRenderViewHostID(webContents_->GetRenderViewHost()) != 24 | dragStartViewID_; 25 | -------------------------------------------------------------------------------- /patches/common/chromium/webview_reattach.patch: -------------------------------------------------------------------------------- 1 | diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc 2 | index b2d1e63..bc2cf9a 100644 3 | --- a/content/browser/web_contents/web_contents_impl.cc 4 | +++ b/content/browser/web_contents/web_contents_impl.cc 5 | @@ -4562,6 +4562,11 @@ void WebContentsImpl::NotifyViewSwapped(RenderViewHost* old_host, 6 | for (auto& observer : observers_) 7 | observer.RenderViewHostChanged(old_host, new_host); 8 | 9 | + // If this is an inner WebContents that has swapped views, we need to reattach 10 | + // it to its outer WebContents. 11 | + if (node_.outer_web_contents()) 12 | + ReattachToOuterWebContentsFrame(); 13 | + 14 | // Ensure that the associated embedder gets cleared after a RenderViewHost 15 | // gets swapped, so we don't reuse the same embedder next time a 16 | // RenderViewHost is attached to this WebContents. 17 | -------------------------------------------------------------------------------- /patches/common/chromium/windows_cc_wrapper.patch: -------------------------------------------------------------------------------- 1 | diff --git a/build/toolchain/win/BUILD.gn b/build/toolchain/win/BUILD.gn 2 | index a526d47e7786..946df3cd513c 100644 3 | --- a/build/toolchain/win/BUILD.gn 4 | +++ b/build/toolchain/win/BUILD.gn 5 | @@ -6,6 +6,7 @@ import("//build/config/clang/clang.gni") 6 | import("//build/config/compiler/compiler.gni") 7 | import("//build/config/sanitizers/sanitizers.gni") 8 | import("//build/config/win/visual_studio_version.gni") 9 | +import("//build/toolchain/cc_wrapper.gni") 10 | import("//build/toolchain/clang_static_analyzer.gni") 11 | import("//build/toolchain/goma.gni") 12 | import("//build/toolchain/toolchain.gni") 13 | @@ -28,8 +29,14 @@ if (use_goma) { 14 | } else { 15 | goma_prefix = "$goma_dir/gomacc " 16 | } 17 | + clang_prefix = goma_prefix 18 | } else { 19 | goma_prefix = "" 20 | + if (cc_wrapper != "") { 21 | + clang_prefix = cc_wrapper + " " 22 | + } else { 23 | + clang_prefix = "" 24 | + } 25 | } 26 | 27 | if (disable_goma) { 28 | @@ -389,7 +396,7 @@ if (target_os == "win" && 29 | msvc_toolchain("win_clang_" + target_cpu) { 30 | environment = "environment." + target_cpu 31 | prefix = rebase_path("$clang_base_path/bin", root_build_dir) 32 | - cl = "${goma_prefix}$prefix/${clang_cl}" 33 | + cl = "${clang_prefix}$prefix/${clang_cl}" 34 | sys_include_flags = "${target_cpu_toolchain_data.include_flags_imsvc}" 35 | 36 | toolchain_args = { 37 | @@ -431,7 +438,7 @@ template("win_x64_toolchains") { 38 | msvc_toolchain("win_clang_" + target_name) { 39 | environment = "environment.x64" 40 | prefix = rebase_path("$clang_base_path/bin", root_build_dir) 41 | - cl = "${goma_prefix}$prefix/${clang_cl}" 42 | + cl = "${clang_prefix}$prefix/${clang_cl}" 43 | sys_include_flags = "${x64_toolchain_data.include_flags_imsvc}" 44 | 45 | toolchain_args = { 46 | -------------------------------------------------------------------------------- /patches/common/chromium/worker_context_will_destroy.patch: -------------------------------------------------------------------------------- 1 | diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h 2 | index 0e554ba8467a..8e56489a5152 100644 3 | --- a/content/public/renderer/content_renderer_client.h 4 | +++ b/content/public/renderer/content_renderer_client.h 5 | @@ -351,6 +351,11 @@ class CONTENT_EXPORT ContentRendererClient { 6 | virtual void DidInitializeWorkerContextOnWorkerThread( 7 | v8::Local context) {} 8 | 9 | + // Notifies that a worker context will be destroyed. This function is called 10 | + // from the worker thread. 11 | + virtual void WillDestroyWorkerContextOnWorkerThread( 12 | + v8::Local context) {} 13 | + 14 | // Overwrites the given URL to use an HTML5 embed if possible. 15 | // An empty URL is returned if the URL is not overriden. 16 | virtual GURL OverrideFlashEmbedWithHTML(const GURL& url); 17 | diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc 18 | index 0affacaa0294..eca456faa640 100644 19 | --- a/content/renderer/renderer_blink_platform_impl.cc 20 | +++ b/content/renderer/renderer_blink_platform_impl.cc 21 | @@ -1402,6 +1404,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() { 22 | WorkerThreadRegistry::Instance()->WillStopCurrentWorkerThread(); 23 | } 24 | 25 | +void RendererBlinkPlatformImpl::WorkerContextWillDestroy( 26 | + const v8::Local& worker) { 27 | + GetContentClient()->renderer()->WillDestroyWorkerContextOnWorkerThread( 28 | + worker); 29 | +} 30 | + 31 | void RendererBlinkPlatformImpl::WorkerContextCreated( 32 | const v8::Local& worker) { 33 | GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( 34 | diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h 35 | index e8a4578009d1..e9ba4e7f391f 100644 36 | --- a/content/renderer/renderer_blink_platform_impl.h 37 | +++ b/content/renderer/renderer_blink_platform_impl.h 38 | @@ -219,6 +219,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { 39 | void DidStartWorkerThread() override; 40 | void WillStopWorkerThread() override; 41 | void WorkerContextCreated(const v8::Local& worker) override; 42 | + void WorkerContextWillDestroy(const v8::Local& worker) override; 43 | 44 | // Set the PlatformEventObserverBase in |platform_event_observers_| associated 45 | // with |type| to |observer|. If there was already an observer associated to 46 | diff --git a/third_party/blink/renderer/core/workers/worker_thread.cc b/third_party/blink/renderer/core/workers/worker_thread.cc 47 | index a522ba4dbdf7..6991078b36f5 100644 48 | --- a/third_party/blink/renderer/core/workers/worker_thread.cc 49 | +++ b/third_party/blink/renderer/core/workers/worker_thread.cc 50 | @@ -481,6 +481,12 @@ void WorkerThread::PrepareForShutdownOnWorkerThread() { 51 | SetExitCode(ExitCode::kGracefullyTerminated); 52 | } 53 | 54 | + { 55 | + v8::HandleScope handle_scope(GetIsolate()); 56 | + Platform::Current()->WorkerContextWillDestroy( 57 | + GlobalScope()->ScriptController()->GetContext()); 58 | + } 59 | + 60 | inspector_task_runner_->Dispose(); 61 | GetWorkerReportingProxy().WillDestroyWorkerGlobalScope(); 62 | probe::AllAsyncTasksCanceled(GlobalScope()); 63 | diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h 64 | index 98ecb84..0779d4a 100644 65 | --- a/third_party/blink/public/platform/platform.h 66 | +++ b/third_party/blink/public/platform/platform.h 67 | @@ -596,6 +596,7 @@ class BLINK_PLATFORM_EXPORT Platform { 68 | virtual void DidStartWorkerThread() {} 69 | virtual void WillStopWorkerThread() {} 70 | virtual void WorkerContextCreated(const v8::Local& worker) {} 71 | + virtual void WorkerContextWillDestroy(const v8::Local& worker) {} 72 | virtual bool AllowScriptExtensionForServiceWorker(const WebURL& script_url) { 73 | return false; 74 | } 75 | -------------------------------------------------------------------------------- /patches/common/crashpad/.patches.yaml: -------------------------------------------------------------------------------- 1 | repo: src 2 | patches: 3 | - 4 | author: Jeremy Apthorp 5 | file: http_status.patch 6 | description: | 7 | Accept all HTTP codes in [200, 300) as successful, instead of just 200. 8 | For example HockeyApp responds with 202. 9 | -------------------------------------------------------------------------------- /patches/common/crashpad/http_status.patch: -------------------------------------------------------------------------------- 1 | From 800aa10d300af0f3fe162ae586b6b1ebe0566ab4 Mon Sep 17 00:00:00 2001 2 | From: Catalin Fratila 3 | Date: Fri, 19 May 2017 09:28:53 +0200 4 | Subject: [PATCH] Handle everything not in [200, 300) as error. For example 5 | HockeyApp responds with 202. 6 | 7 | (cherry picked from commit f7c320766756a8aaa45ccbcff2945053d9f7e109) 8 | (cherry picked from commit 1875fddc7e671b14d8b54068301d9648d12e9dc2) 9 | (cherry picked from commit 670fb453b0c3d6ae0a0d5923f68df02464337617) 10 | --- 11 | third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc | 2 +- 12 | third_party/crashpad/crashpad/util/net/http_transport_mac.mm | 2 +- 13 | third_party/crashpad/crashpad/util/net/http_transport_win.cc | 2 +- 14 | 3 files changed, 3 insertions(+), 3 deletions(-) 15 | 16 | diff --git a/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc b/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc 17 | index c16a593..0e262b0 100644 18 | --- a/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc 19 | +++ b/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc 20 | @@ -338,7 +338,7 @@ bool HTTPTransportLibcurl::ExecuteSynchronously(std::string* response_body) { 21 | return false; 22 | } 23 | 24 | - if (status != 200) { 25 | + if (status < 200 || status >= 300) { 26 | LOG(ERROR) << base::StringPrintf("HTTP status %ld", status); 27 | return false; 28 | } 29 | diff --git a/third_party/crashpad/crashpad/util/net/http_transport_mac.mm b/third_party/crashpad/crashpad/util/net/http_transport_mac.mm 30 | index 8d5f78c..a6434c2 100644 31 | --- a/third_party/crashpad/crashpad/util/net/http_transport_mac.mm 32 | +++ b/third_party/crashpad/crashpad/util/net/http_transport_mac.mm 33 | @@ -293,7 +293,7 @@ static void Unschedule(CFReadStreamRef stream, 34 | return false; 35 | } 36 | NSInteger http_status = [http_response statusCode]; 37 | - if (http_status != 200) { 38 | + if (http_status < 200 || http_status >= 300) { 39 | LOG(ERROR) << base::StringPrintf("HTTP status %ld", 40 | implicit_cast(http_status)); 41 | return false; 42 | diff --git a/third_party/crashpad/crashpad/util/net/http_transport_win.cc b/third_party/crashpad/crashpad/util/net/http_transport_win.cc 43 | index 18d343c..40c3061 100644 44 | --- a/third_party/crashpad/crashpad/util/net/http_transport_win.cc 45 | +++ b/third_party/crashpad/crashpad/util/net/http_transport_win.cc 46 | @@ -375,7 +375,7 @@ bool HTTPTransportWin::ExecuteSynchronously(std::string* response_body) { 47 | return false; 48 | } 49 | 50 | - if (status_code != 200) { 51 | + if (status_code < 200 || status_code >= 300) { 52 | LOG(ERROR) << base::StringPrintf("HTTP status %lu", status_code); 53 | return false; 54 | } 55 | -------------------------------------------------------------------------------- /patches/common/ffmpeg/.patches.yaml: -------------------------------------------------------------------------------- 1 | repo: src/third_party/ffmpeg 2 | patches: 3 | - 4 | author: Ales Pergl 5 | file: build_gn.patch 6 | description: | 7 | Chromium's Mac toolchain sets the "install_name" linker parameter only 8 | when "is_component_build" is true, but we want to set even if it's false, 9 | because we are making a dylib which will be distributed inside a bundle. 10 | - 11 | author: Aleksei Kuzmin 12 | file: fix_build_on_linux_x86.patch 13 | description: | 14 | Builds on Linux x86 fail with a clang error. See https://crbug.com/796379. 15 | Once it's fixed the patch can be removed. 16 | -------------------------------------------------------------------------------- /patches/common/ffmpeg/build_gn.patch: -------------------------------------------------------------------------------- 1 | diff --git a/BUILD.gn b/BUILD.gn 2 | index 5439b39693..6783292c3b 100755 3 | --- a/BUILD.gn 4 | +++ b/BUILD.gn 5 | @@ -393,6 +393,10 @@ if (is_component_ffmpeg) { 6 | # So we can append below and assume they're defined. 7 | ldflags = [] 8 | 9 | + if (!is_component_build && is_mac) { 10 | + ldflags += [ "-Wl,-install_name,@rpath/libffmpeg.dylib" ] 11 | + } 12 | + 13 | if (is_fuchsia || (is_posix && !is_mac)) { 14 | # Fixes warnings PIC relocation when building as component. 15 | ldflags += [ 16 | -------------------------------------------------------------------------------- /patches/common/ffmpeg/fix_build_on_linux_x86.patch: -------------------------------------------------------------------------------- 1 | diff --git a/BUILD.gn b/BUILD.gn 2 | index ff09111634..fa7712a3a3 100755 3 | --- a/BUILD.gn 4 | +++ b/BUILD.gn 5 | @@ -247,7 +247,7 @@ target(link_target_type, "ffmpeg_internal") { 6 | # On POSIX x86, sanitizers will fail to compiler the H264 CABAC code due to 7 | # insufficient registers unless we disable EBP usage. crbug.com/786760 8 | if (target_cpu == "x86") { 9 | - if (using_sanitizer) { 10 | + if (using_sanitizer || is_electron_build) { 11 | defines += [ "HAVE_EBP_AVAILABLE=0" ] 12 | } else { 13 | defines += [ "HAVE_EBP_AVAILABLE=1" ] 14 | -------------------------------------------------------------------------------- /patches/common/icu/.patches.yaml: -------------------------------------------------------------------------------- 1 | repo: src/third_party/icu 2 | patches: 3 | - 4 | author: Ales Pergl 5 | file: build_gn.patch 6 | description: null 7 | - 8 | author: Cheng Zhao 9 | file: no_inline_default_constructor.patch 10 | description: null 11 | -------------------------------------------------------------------------------- /patches/common/icu/build_gn.patch: -------------------------------------------------------------------------------- 1 | diff --git a/BUILD.gn b/BUILD.gn 2 | index 76914cd7..a44d7896 100644 3 | --- a/BUILD.gn 4 | +++ b/BUILD.gn 5 | @@ -34,7 +34,7 @@ config("icu_config") { 6 | "U_ENABLE_DYLOAD=0", 7 | ] 8 | 9 | - if (!is_component_build) { 10 | + if (!is_component_build && !(is_electron_build && !is_electron_gn_build)) { 11 | defines += [ "U_STATIC_IMPLEMENTATION" ] 12 | } 13 | 14 | @@ -537,6 +537,24 @@ component("icui18n") { 15 | ":icuuc", 16 | ] 17 | 18 | + # In Electron all of ICU is in one binary, hence we must build with 19 | + # U_COMBINED_IMPLEMENTATION defined. 20 | + # Also, for the "static_library" configuration, keep icui18n as 21 | + # a shared library so that other Chromium targets build cleanly. 22 | + if (is_electron_build && !is_electron_gn_build) { 23 | + defines += [ "U_COMBINED_IMPLEMENTATION" ] 24 | + 25 | + if (!is_component_build) { 26 | + static_component_type = "shared_library" 27 | + 28 | + # Because GN already applied the wrong defaults (see the 29 | + # set_defaults("component") statement in BUILDCONFIG.gn) we must reset 30 | + # the configs and assign those for shared libraries. 31 | + configs = [] 32 | + configs = default_shared_library_configs 33 | + } 34 | + } 35 | + 36 | # ICU uses RTTI, replace the default "no rtti" config. 37 | configs -= [ 38 | "//build/config/compiler:no_rtti", # ICU uses RTTI. 39 | @@ -945,6 +963,24 @@ component("icuuc") { 40 | ":icudata", 41 | ] 42 | 43 | + # In Electron all of ICU is in one binary, hence we must build with 44 | + # U_COMBINED_IMPLEMENTATION defined. 45 | + # Also, for the "static_library" configuration, keep icuuc as 46 | + # a shared library so that other Chromium targets build cleanly. 47 | + if (is_electron_build && !is_electron_gn_build) { 48 | + defines += [ "U_COMBINED_IMPLEMENTATION" ] 49 | + 50 | + if (!is_component_build) { 51 | + static_component_type = "shared_library" 52 | + 53 | + # Because GN already applied the wrong defaults (see the 54 | + # set_defaults("component") statement in BUILDCONFIG.gn) we must reset 55 | + # the configs and assign those for shared libraries. 56 | + configs = [] 57 | + configs = default_shared_library_configs 58 | + } 59 | + } 60 | + 61 | configs -= [ 62 | "//build/config/compiler:no_rtti", # ICU uses RTTI. 63 | "//build/config/compiler:chromium_code", 64 | -------------------------------------------------------------------------------- /patches/common/icu/no_inline_default_constructor.patch: -------------------------------------------------------------------------------- 1 | diff --git a/source/common/unicode/unistr.h b/source/common/unicode/unistr.h 2 | index e0ab0b9e..fe4c673b 100644 3 | --- a/source/common/unicode/unistr.h 4 | +++ b/source/common/unicode/unistr.h 5 | @@ -2957,7 +2957,7 @@ public: 6 | /** Construct an empty UnicodeString. 7 | * @stable ICU 2.0 8 | */ 9 | - inline UnicodeString(); 10 | + UnicodeString(); 11 | 12 | /** 13 | * Construct a UnicodeString with capacity to hold capacity char16_ts 14 | @@ -3915,15 +3915,6 @@ UnicodeString::getArrayStart() const { 15 | fUnion.fStackFields.fBuffer : fUnion.fFields.fArray; 16 | } 17 | 18 | -//======================================== 19 | -// Default constructor 20 | -//======================================== 21 | - 22 | -inline 23 | -UnicodeString::UnicodeString() { 24 | - fUnion.fStackFields.fLengthAndFlags=kShortString; 25 | -} 26 | - 27 | inline UnicodeString::UnicodeString(const std::nullptr_t /*text*/) { 28 | fUnion.fStackFields.fLengthAndFlags=kShortString; 29 | } 30 | diff --git a/source/common/unistr.cpp b/source/common/unistr.cpp 31 | index 1bfb71aa..5495ee91 100644 32 | --- a/source/common/unistr.cpp 33 | +++ b/source/common/unistr.cpp 34 | @@ -146,7 +146,9 @@ UnicodeString::releaseArray() { 35 | // Constructors 36 | //======================================== 37 | 38 | -// The default constructor is inline in unistr.h. 39 | +UnicodeString::UnicodeString() { 40 | + fUnion.fStackFields.fLengthAndFlags=kShortString; 41 | +} 42 | 43 | UnicodeString::UnicodeString(int32_t capacity, UChar32 c, int32_t count) { 44 | fUnion.fFields.fLengthAndFlags = 0; 45 | -------------------------------------------------------------------------------- /patches/common/skia/.patches.yaml: -------------------------------------------------------------------------------- 1 | repo: src/third_party/skia 2 | patches: 3 | - 4 | author: Ales Pergl 5 | file: dcheck.patch 6 | description: null 7 | -------------------------------------------------------------------------------- /patches/common/skia/dcheck.patch: -------------------------------------------------------------------------------- 1 | diff --git a/include/core/SkPostConfig.h b/include/core/SkPostConfig.h 2 | index c34397cde6..5a55535eeb 100644 3 | --- a/include/core/SkPostConfig.h 4 | +++ b/include/core/SkPostConfig.h 5 | @@ -18,7 +18,7 @@ 6 | #ifdef NDEBUG 7 | #define SK_RELEASE 8 | #else 9 | - #define SK_DEBUG 10 | + #define SK_RELEASE 11 | #endif 12 | #endif 13 | 14 | -------------------------------------------------------------------------------- /patches/common/v8/.patches.yaml: -------------------------------------------------------------------------------- 1 | repo: src/v8 2 | patches: 3 | - 4 | author: Shelley Vohr 5 | file: add_realloc.patch 6 | description: | 7 | Blink overrides ArrayBuffer's allocator with its own one, while Node simply 8 | uses malloc and free, so we need to use v8's allocator in Node. As part of the 9 | 10.6.0 upgrade, we needed to make SerializerDelegate accept an allocator 10 | argument in its constructor, and override ReallocateBufferMemory and 11 | FreeBufferMemory to use the allocator. We cannot simply allocate and then memcpy 12 | when we override ReallocateBufferMemory, so we therefore need to implement 13 | Realloc on the v8 side. 14 | - 15 | author: Ales Pergl 16 | file: build_gn.patch 17 | description: null 18 | - 19 | author: Cheng Zhao 20 | file: array_buffer.patch 21 | description: null 22 | - 23 | author: Cheng Zhao 24 | file: ostreams.patch 25 | description: null 26 | - 27 | author: Aleksei Kuzmin 28 | file: export_platform.patch 29 | description: | 30 | v8::Platform::SystemClockTimeMillis must be exported so that node::NodePlatform can call it 31 | - 32 | author: Ales Pergl 33 | file: dcheck.patch 34 | description: null 35 | - 36 | author: Nitish Sakhawalkar 37 | file: disable-warning-win.patch 38 | description: 39 | Disable unit test windows build warning 40 | - 41 | author: Aleksei Kuzmin 42 | file: backport_39d546a.patch 43 | description: Node 10.0.0 needs it. 44 | - 45 | author: Aleksei Kuzmin 46 | file: backport_ff0a97933.patch 47 | description: Node 10.2.0 needs it. 48 | - 49 | author: Aleksei Kuzmin 50 | file: backport_9fb02b526.patch 51 | description: Node 10.2.0 needs it. 52 | - 53 | author: Aleksei Kuzmin 54 | file: backport_23652c5f.patch 55 | description: Node 10.2.0 needs it. 56 | - 57 | author: Shelley Vohr 58 | file: backport_91ddb65d.patch 59 | description: Node 10.6.0 needs it. 60 | - 61 | author: Shelley Vohr 62 | file: cherry-pick_6989b3f6d7.patch 63 | description: Node 10.6.0 needs it. 64 | - 65 | author: Shelley Vohr 66 | file: cherry-pick_a440efb27f.patch 67 | description: Node 10.6.0 needs it. 68 | - 69 | author: Shelley Vohr 70 | file: cherry-pick_5dd3395.patch 71 | description: Node 10.6.0 needs it. 72 | - 73 | author: Shelley Vohr 74 | file: backport_aa6ce3e.patch 75 | description: Node 10.6.0 needs it. 76 | - 77 | author: Shelley Vohr 78 | file: cherry-pick_b20faff.patch 79 | description: Node 10.6.0 needs it. 80 | - 81 | author: Shelley Vohr 82 | file: cherry-pick_acc336c.patch 83 | description: Node 10.6.0 needs it. 84 | - 85 | author: Shelley Vohr 86 | file: cherry-pick_70c4340.patch 87 | description: Node 10.6.0 needs it. 88 | -------------------------------------------------------------------------------- /patches/common/v8/add_realloc.patch: -------------------------------------------------------------------------------- 1 | diff --git a/include/v8.h b/include/v8.h 2 | index 573e80176d..5eefe26fe9 100644 3 | --- a/include/v8.h 4 | +++ b/include/v8.h 5 | @@ -4318,6 +4318,13 @@ class V8_EXPORT ArrayBuffer : public Object { 6 | */ 7 | virtual void* AllocateUninitialized(size_t length) = 0; 8 | 9 | + /** 10 | + * Free the memory block of size |length|, pointed to by |data|. 11 | + * That memory must be previously allocated by |Allocate| and not yet freed 12 | + * with a call to |Free| or |Realloc| 13 | + */ 14 | + virtual void* Realloc(void* data, size_t length); 15 | + 16 | /** 17 | * Free the memory block of size |length|, pointed to by |data|. 18 | * That memory is guaranteed to be previously allocated by |Allocate|. 19 | diff --git a/src/api.cc b/src/api.cc 20 | index 8b177d041d..e06ca2a207 100644 21 | --- a/src/api.cc 22 | +++ b/src/api.cc 23 | @@ -460,6 +460,10 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) { 24 | i::V8::SetSnapshotBlob(snapshot_blob); 25 | } 26 | 27 | +void* v8::ArrayBuffer::Allocator::Realloc(void* data, size_t length) { 28 | + UNIMPLEMENTED(); 29 | +} 30 | + 31 | namespace { 32 | 33 | class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { 34 | -------------------------------------------------------------------------------- /patches/common/v8/array_buffer.patch: -------------------------------------------------------------------------------- 1 | diff --git a/include/v8.h b/include/v8.h 2 | index 573e80176d..80bfd1d22a 100644 3 | --- a/include/v8.h 4 | +++ b/include/v8.h 5 | @@ -7337,6 +7337,9 @@ class V8_EXPORT Isolate { 6 | */ 7 | void SetIdle(bool is_idle); 8 | 9 | + /** Returns the ArrayBuffer::Allocator used in this isolate. */ 10 | + ArrayBuffer::Allocator* GetArrayBufferAllocator(); 11 | + 12 | /** Returns true if this isolate has a current context. */ 13 | bool InContext(); 14 | 15 | diff --git a/src/api.cc b/src/api.cc 16 | index 8b177d041d..f58a350f0f 100644 17 | --- a/src/api.cc 18 | +++ b/src/api.cc 19 | @@ -8139,6 +8139,13 @@ void Isolate::SetIdle(bool is_idle) { 20 | isolate->SetIdle(is_idle); 21 | } 22 | 23 | + 24 | +ArrayBuffer::Allocator* Isolate::GetArrayBufferAllocator() { 25 | + i::Isolate* isolate = reinterpret_cast(this); 26 | + return isolate->array_buffer_allocator(); 27 | +} 28 | + 29 | + 30 | bool Isolate::InContext() { 31 | i::Isolate* isolate = reinterpret_cast(this); 32 | return isolate->context() != nullptr; 33 | -------------------------------------------------------------------------------- /patches/common/v8/backport_39d546a.patch: -------------------------------------------------------------------------------- 1 | 39d546a24022b62b00aedf7b556ac6c9e2306aab 2 | diff --git a/AUTHORS b/AUTHORS 3 | index 3251716f2a..4b5163961d 100644 4 | --- a/AUTHORS 5 | +++ b/AUTHORS 6 | @@ -70,6 +70,7 @@ Felix Geisendörfer 7 | Filipe David Manana 8 | Franziska Hinkelmann 9 | Geoffrey Garside 10 | +Gus Caplan 11 | Gwang Yoon Hwang 12 | Henrique Ferreiro 13 | Hirofumi Mako 14 | diff --git a/include/v8.h b/include/v8.h 15 | index 573e80176d..aeeebba304 100644 16 | --- a/include/v8.h 17 | +++ b/include/v8.h 18 | @@ -2378,6 +2378,11 @@ class V8_EXPORT Value : public Data { 19 | 20 | bool IsWebAssemblyCompiledModule() const; 21 | 22 | + /** 23 | + * Returns true if the value is a Module Namespace Object. 24 | + */ 25 | + bool IsModuleNamespaceObject() const; 26 | + 27 | V8_WARN_UNUSED_RESULT MaybeLocal ToBigInt( 28 | Local context) const; 29 | V8_WARN_UNUSED_RESULT MaybeLocal ToBoolean( 30 | diff --git a/src/api.cc b/src/api.cc 31 | index 8b177d041d..6dd669ee11 100644 32 | --- a/src/api.cc 33 | +++ b/src/api.cc 34 | @@ -3583,6 +3583,10 @@ bool Value::IsSetIterator() const { 35 | 36 | bool Value::IsPromise() const { return Utils::OpenHandle(this)->IsJSPromise(); } 37 | 38 | +bool Value::IsModuleNamespaceObject() const { 39 | + return Utils::OpenHandle(this)->IsJSModuleNamespace(); 40 | +} 41 | + 42 | MaybeLocal Value::ToString(Local context) const { 43 | auto obj = Utils::OpenHandle(this); 44 | if (obj->IsString()) return ToApiHandle(obj); 45 | diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc 46 | index 54afc61f4c..b7483a7c5e 100644 47 | --- a/test/cctest/test-api.cc 48 | +++ b/test/cctest/test-api.cc 49 | @@ -27239,6 +27239,35 @@ TEST(ImportMeta) { 50 | CHECK(result->StrictEquals(Local::Cast(v8::Utils::ToLocal(meta)))); 51 | } 52 | 53 | +TEST(GetModuleNamespace) { 54 | + LocalContext context; 55 | + v8::Isolate* isolate = context->GetIsolate(); 56 | + v8::HandleScope scope(isolate); 57 | + 58 | + Local url = v8_str("www.google.com"); 59 | + Local source_text = v8_str("export default 5; export const a = 10;"); 60 | + v8::ScriptOrigin origin(url, Local(), Local(), 61 | + Local(), Local(), 62 | + Local(), Local(), 63 | + Local(), True(isolate)); 64 | + v8::ScriptCompiler::Source source(source_text, origin); 65 | + Local module = 66 | + v8::ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); 67 | + module->InstantiateModule(context.local(), UnexpectedModuleResolveCallback) 68 | + .ToChecked(); 69 | + module->Evaluate(context.local()).ToLocalChecked(); 70 | + 71 | + Local ns_val = module->GetModuleNamespace(); 72 | + CHECK(ns_val->IsModuleNamespaceObject()); 73 | + Local ns = ns_val.As(); 74 | + CHECK(ns->Get(context.local(), v8_str("default")) 75 | + .ToLocalChecked() 76 | + ->StrictEquals(v8::Number::New(isolate, 5))); 77 | + CHECK(ns->Get(context.local(), v8_str("a")) 78 | + .ToLocalChecked() 79 | + ->StrictEquals(v8::Number::New(isolate, 10))); 80 | +} 81 | + 82 | TEST(GlobalTemplateWithDoubleProperty) { 83 | v8::Isolate* isolate = CcTest::isolate(); 84 | v8::HandleScope handle_scope(isolate); 85 | -------------------------------------------------------------------------------- /patches/common/v8/backport_ff0a97933.patch: -------------------------------------------------------------------------------- 1 | diff --git a/include/v8.h b/include/v8.h 2 | index 573e80176d..bb77987f14 100644 3 | --- a/include/v8.h 4 | +++ b/include/v8.h 5 | @@ -3544,6 +3549,17 @@ class V8_EXPORT Object : public Value { 6 | */ 7 | Isolate* GetIsolate(); 8 | 9 | + /** 10 | + * If this object is a Set, Map, WeakSet or WeakMap, this returns a 11 | + * representation of the elements of this object as an array. 12 | + * If this object is a SetIterator or MapIterator, this returns all 13 | + * elements of the underlying collection, starting at the iterator's current 14 | + * position. 15 | + * For other types, this will return an empty MaybeLocal (without 16 | + * scheduling an exception). 17 | + */ 18 | + MaybeLocal PreviewEntries(bool* is_key_value); 19 | + 20 | static Local New(Isolate* isolate); 21 | 22 | V8_INLINE static Object* Cast(Value* obj); 23 | diff --git a/src/api.cc b/src/api.cc 24 | index e65f114edb..4302b6c604 100644 25 | --- a/src/api.cc 26 | +++ b/src/api.cc 27 | @@ -9543,21 +9543,20 @@ int debug::EstimatedValueSize(Isolate* v8_isolate, v8::Local value) { 28 | return i::Handle::cast(object)->Size(); 29 | } 30 | 31 | -v8::MaybeLocal debug::EntriesPreview(Isolate* v8_isolate, 32 | - v8::Local value, 33 | - bool* is_key_value) { 34 | - i::Isolate* isolate = reinterpret_cast(v8_isolate); 35 | - ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); 36 | - if (value->IsMap()) { 37 | +v8::MaybeLocal v8::Object::PreviewEntries(bool* is_key_value) { 38 | + if (IsMap()) { 39 | *is_key_value = true; 40 | - return value.As()->AsArray(); 41 | + return Map::Cast(this)->AsArray(); 42 | } 43 | - if (value->IsSet()) { 44 | + if (IsSet()) { 45 | *is_key_value = false; 46 | - return value.As()->AsArray(); 47 | + return Set::Cast(this)->AsArray(); 48 | } 49 | 50 | - i::Handle object = Utils::OpenHandle(*value); 51 | + i::Handle object = Utils::OpenHandle(this); 52 | + i::Isolate* isolate = object->GetIsolate(); 53 | + Isolate* v8_isolate = reinterpret_cast(isolate); 54 | + ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); 55 | if (object->IsJSWeakCollection()) { 56 | *is_key_value = object->IsJSWeakMap(); 57 | return Utils::ToLocal(i::JSWeakCollection::GetEntries( 58 | diff --git a/src/debug/debug-interface.h b/src/debug/debug-interface.h 59 | index 01124bf7fc..2210b4e87f 100644 60 | --- a/src/debug/debug-interface.h 61 | +++ b/src/debug/debug-interface.h 62 | @@ -212,10 +212,6 @@ void ResetBlackboxedStateCache(Isolate* isolate, 63 | 64 | int EstimatedValueSize(Isolate* isolate, v8::Local value); 65 | 66 | -v8::MaybeLocal EntriesPreview(Isolate* isolate, 67 | - v8::Local value, 68 | - bool* is_key_value); 69 | - 70 | enum Builtin { 71 | kObjectKeys, 72 | kObjectGetPrototypeOf, 73 | diff --git a/src/inspector/v8-debugger.cc b/src/inspector/v8-debugger.cc 74 | index 5dee98853b..28212a1993 100644 75 | --- a/src/inspector/v8-debugger.cc 76 | +++ b/src/inspector/v8-debugger.cc 77 | @@ -29,8 +29,10 @@ v8::MaybeLocal collectionsEntries(v8::Local context, 78 | v8::Isolate* isolate = context->GetIsolate(); 79 | v8::Local entries; 80 | bool isKeyValue = false; 81 | - if (!v8::debug::EntriesPreview(isolate, value, &isKeyValue).ToLocal(&entries)) 82 | + if (!value->IsObject() || 83 | + !value.As()->PreviewEntries(&isKeyValue).ToLocal(&entries)) { 84 | return v8::MaybeLocal(); 85 | + } 86 | 87 | v8::Local wrappedEntries = v8::Array::New(isolate); 88 | CHECK(!isKeyValue || wrappedEntries->Length() % 2 == 0); 89 | -------------------------------------------------------------------------------- /patches/common/v8/cherry-pick_5dd3395.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/log.cc b/src/log.cc 2 | index 903cc8e2e6..ce917b0be1 100644 3 | --- a/src/log.cc 4 | +++ b/src/log.cc 5 | @@ -327,6 +327,7 @@ void PerfBasicLogger::LogRecordedBuffer(AbstractCode* code, SharedFunctionInfo*, 6 | const char* name, int length) { 7 | if (FLAG_perf_basic_prof_only_functions && 8 | (code->kind() != AbstractCode::INTERPRETED_FUNCTION && 9 | + code->kind() != AbstractCode::BUILTIN && 10 | code->kind() != AbstractCode::OPTIMIZED_FUNCTION)) { 11 | return; 12 | } 13 | -------------------------------------------------------------------------------- /patches/common/v8/cherry-pick_70c4340.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/api.cc b/src/api.cc 2 | index b46d376837..a97b38d00a 100644 3 | --- a/src/api.cc 4 | +++ b/src/api.cc 5 | @@ -10217,6 +10217,10 @@ const char* CodeEvent::GetCodeEventTypeName(CodeEventType code_event_type) { 6 | CODE_EVENTS_LIST(V) 7 | #undef V 8 | } 9 | + // The execution should never pass here 10 | + UNREACHABLE(); 11 | + // NOTE(mmarchini): Workaround to fix a compiler failure on GCC 4.9 12 | + return "Unknown"; 13 | } 14 | 15 | CodeEventHandler::CodeEventHandler(Isolate* isolate) { 16 | diff --git a/src/log.cc b/src/log.cc 17 | index d1673715e5..f70acbd54d 100644 18 | --- a/src/log.cc 19 | +++ b/src/log.cc 20 | @@ -59,6 +59,10 @@ static v8::CodeEventType GetCodeEventTypeForTag( 21 | TAGS_LIST(V) 22 | #undef V 23 | } 24 | + // The execution should never pass here 25 | + UNREACHABLE(); 26 | + // NOTE(mmarchini): Workaround to fix a compiler failure on GCC 4.9 27 | + return v8::CodeEventType::kUnknownType; 28 | } 29 | #define CALL_CODE_EVENT_HANDLER(Call) \ 30 | if (listener_) { \ 31 | -------------------------------------------------------------------------------- /patches/common/v8/dcheck.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/api.cc b/src/api.cc 2 | index 8531cd5c05..47254c9f5c 100644 3 | --- a/src/api.cc 4 | +++ b/src/api.cc 5 | @@ -8598,7 +8604,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { 6 | 7 | 8 | void Isolate::RunMicrotasks() { 9 | - DCHECK_NE(MicrotasksPolicy::kScoped, GetMicrotasksPolicy()); 10 | + // DCHECK_NE(MicrotasksPolicy::kScoped, GetMicrotasksPolicy()); 11 | reinterpret_cast(this)->RunMicrotasks(); 12 | } 13 | 14 | diff --git a/src/heap/heap.cc b/src/heap/heap.cc 15 | index 62a5856f34..c59dfad2c8 100644 16 | --- a/src/heap/heap.cc 17 | +++ b/src/heap/heap.cc 18 | @@ -5963,9 +5963,9 @@ void Heap::TearDown() { 19 | void Heap::AddGCPrologueCallback(v8::Isolate::GCCallbackWithData callback, 20 | GCType gc_type, void* data) { 21 | DCHECK_NOT_NULL(callback); 22 | - DCHECK(gc_prologue_callbacks_.end() == 23 | - std::find(gc_prologue_callbacks_.begin(), gc_prologue_callbacks_.end(), 24 | - GCCallbackTuple(callback, gc_type, data))); 25 | +// DCHECK(gc_prologue_callbacks_.end() == 26 | +// std::find(gc_prologue_callbacks_.begin(), gc_prologue_callbacks_.end(), 27 | +// GCCallbackTuple(callback, gc_type, data))); 28 | gc_prologue_callbacks_.emplace_back(callback, gc_type, data); 29 | } 30 | 31 | -------------------------------------------------------------------------------- /patches/common/v8/disable-warning-win.patch: -------------------------------------------------------------------------------- 1 | diff --git a/test/unittests/base/bits-unittest.cc b/test/unittests/base/bits-unittest.cc 2 | index 45fb921797..8c9f249609 100644 3 | --- a/test/unittests/base/bits-unittest.cc 4 | +++ b/test/unittests/base/bits-unittest.cc 5 | @@ -13,7 +13,9 @@ 6 | #else 7 | #define DISABLE_IN_RELEASE(Name) DISABLED_##Name 8 | #endif 9 | - 10 | +#ifdef _WIN32 11 | +#pragma warning(disable:4724 4723) // Disable potential divide by 0 warnings 12 | +#endif 13 | namespace v8 { 14 | namespace base { 15 | namespace bits { 16 | -------------------------------------------------------------------------------- /patches/common/v8/export_platform.patch: -------------------------------------------------------------------------------- 1 | diff --git a/include/v8-platform.h b/include/v8-platform.h 2 | index ddc200abab..046de4e257 100644 3 | --- a/include/v8-platform.h 4 | +++ b/include/v8-platform.h 5 | @@ -11,6 +11,7 @@ 6 | #include 7 | #include 8 | 9 | +#include "v8.h" 10 | #include "v8config.h" // NOLINT(build/include) 11 | 12 | namespace v8 { 13 | @@ -465,7 +466,7 @@ class Platform { 14 | * since epoch. Useful for implementing |CurrentClockTimeMillis| if 15 | * nothing special needed. 16 | */ 17 | - static double SystemClockTimeMillis(); 18 | + V8_EXPORT static double SystemClockTimeMillis(); 19 | }; 20 | 21 | } // namespace v8 22 | -------------------------------------------------------------------------------- /patches/common/v8/ostreams.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/ostreams.h b/src/ostreams.h 2 | index e72c8ee..9f25bca 100644 3 | --- a/src/ostreams.h 4 | +++ b/src/ostreams.h 5 | @@ -34,7 +34,7 @@ class OFStreamBase : public std::streambuf { 6 | 7 | 8 | // An output stream writing to a file. 9 | -class V8_EXPORT_PRIVATE OFStream : public std::ostream { 10 | +class V8_EXPORT_PRIVATE OFStream : public NON_EXPORTED_BASE(std::ostream) { 11 | public: 12 | explicit OFStream(FILE* f); 13 | virtual ~OFStream(); 14 | -------------------------------------------------------------------------------- /patches/common/webrtc/.patches.yaml: -------------------------------------------------------------------------------- 1 | repo: src/third_party/webrtc 2 | patches: 3 | - 4 | author: null 5 | file: webrtc-desktop_capturer_mac.patch 6 | description: null 7 | - 8 | author: null 9 | file: webrtc-rwlock_null.patch 10 | description: null 11 | - 12 | author: Nitish Sakhawalkar 13 | file: disable-warning-win.patch 14 | description: 15 | Disable windows warning 16 | - 17 | author: Aleksei Kuzmin 18 | file: allow_chromiumcontent_to_depend_on_webrtc_common.patch 19 | description: | 20 | ERROR at //chromiumcontent/BUILD.gn:152:3: Dependency not allowed. 21 | static_library("webrtc_common") { 22 | ^-------------------------------- 23 | The item //chromiumcontent:webrtc_common 24 | can not depend on //third_party/webrtc:webrtc_common 25 | because it is not in //third_party/webrtc:webrtc_common's visibility list: [ 26 | //third_party/webrtc/* 27 | //third_party/webrtc_overrides/* 28 | ] 29 | -------------------------------------------------------------------------------- /patches/common/webrtc/allow_chromiumcontent_to_depend_on_webrtc_common.patch: -------------------------------------------------------------------------------- 1 | diff --git a/webrtc.gni b/webrtc.gni 2 | index f32e490f7..6bc8d1205 100644 3 | --- a/webrtc.gni 4 | +++ b/webrtc.gni 5 | @@ -274,6 +274,10 @@ if (build_with_chromium) { 6 | webrtc_default_visibility += [ webrtc_root + "/../webrtc_overrides/*" ] 7 | } 8 | 9 | +if (is_electron_build) { 10 | + webrtc_default_visibility += [ "//libchromiumcontent/chromiumcontent:webrtc_common" ] 11 | +} 12 | + 13 | template("rtc_test") { 14 | test(target_name) { 15 | forward_variables_from(invoker, 16 | -------------------------------------------------------------------------------- /patches/common/webrtc/disable-warning-win.patch: -------------------------------------------------------------------------------- 1 | diff --git a/rtc_base/thread.cc b/rtc_base/thread.cc 2 | index 1bc0c0cd8..51208e4f0 100644 3 | --- a/rtc_base/thread.cc 4 | +++ b/rtc_base/thread.cc 5 | @@ -23,7 +23,10 @@ 6 | #include "rtc_base/stringutils.h" 7 | #include "rtc_base/timeutils.h" 8 | #include "rtc_base/trace_event.h" 9 | - 10 | +#ifdef _WIN32 11 | +//Warning on windows because ThreadManager destructor never returns 12 | +#pragma warning(disable:4722) 13 | +#endif 14 | namespace rtc { 15 | 16 | ThreadManager* ThreadManager::Instance() { 17 | -------------------------------------------------------------------------------- /patches/common/webrtc/webrtc-rwlock_null.patch: -------------------------------------------------------------------------------- 1 | diff --git a/rtc_base/synchronization/rw_lock_wrapper.cc b/rtc_base/synchronization/rw_lock_wrapper.cc 2 | index c8cd17edb8..50c6e25ad9 100644 3 | --- a/rtc_base/synchronization/rw_lock_wrapper.cc 4 | +++ b/rtc_base/synchronization/rw_lock_wrapper.cc 5 | @@ -11,6 +11,9 @@ 6 | #include "rtc_base/synchronization/rw_lock_wrapper.h" 7 | 8 | #include 9 | +#include 10 | + 11 | +#include "system_wrappers/include/sleep.h" 12 | 13 | #if defined(_WIN32) 14 | #include "rtc_base/synchronization/rw_lock_win.h" 15 | @@ -21,11 +23,19 @@ 16 | namespace webrtc { 17 | 18 | RWLockWrapper* RWLockWrapper::CreateRWLock() { 19 | + RWLockWrapper* rw_lock_ptr; 20 | #ifdef _WIN32 21 | - return RWLockWin::Create(); 22 | + rw_lock_ptr = RWLockWin::Create(); 23 | #else 24 | - return RWLockPosix::Create(); 25 | + rw_lock_ptr = RWLockPosix::Create(); 26 | #endif 27 | + if (rw_lock_ptr != NULL) { 28 | + return rw_lock_ptr; 29 | + } else { 30 | + int msec_wait = 10 + (rand() % 90); 31 | + SleepMs(msec_wait); 32 | + return CreateRWLock(); 33 | + } 34 | } 35 | 36 | } // namespace webrtc 37 | -------------------------------------------------------------------------------- /patches/mips64el/chromium/.patches.yaml: -------------------------------------------------------------------------------- 1 | repo: src 2 | patches: 3 | - 4 | author: null 5 | file: Add-support-for-using-seccomp_bpf-on-mips64el.patch 6 | description: null 7 | - 8 | author: null 9 | file: Set-kernal-page-size-to-16K-on-loongson-MIPS-archtec.patch 10 | description: null 11 | - 12 | author: null 13 | file: Add-mips64el-redhat-linux-to-gcc_toolchain-for-mips6.patch 14 | description: null 15 | - 16 | author: null 17 | file: Fix-mips-cross-toolchain-build-src-crypto-ec-p256-64.patch 18 | description: null 19 | - 20 | author: null 21 | file: Fix-error-about-relocation-truncated-to-fit-R_MIPS_C.patch 22 | description: null 23 | - 24 | author: Cheng Zhao 25 | file: backport-sqlite-8a87f7e.patch 26 | description: null 27 | - 28 | author: Cheng Zhao 29 | file: backport-sqlite-9851f2e.patch 30 | description: null 31 | - 32 | author: Cheng Zhao 33 | file: backport-sqlite-3d8ec48.patch 34 | description: null 35 | - 36 | author: Cheng Zhao 37 | file: support-old-nss.patch 38 | description: null 39 | -------------------------------------------------------------------------------- /patches/mips64el/chromium/Add-mips64el-redhat-linux-to-gcc_toolchain-for-mips6.patch: -------------------------------------------------------------------------------- 1 | From c225042994cebe5717013bde26bbad757fefaa17 Mon Sep 17 00:00:00 2001 2 | From: Wang Qing 3 | Date: Thu, 28 Sep 2017 14:24:17 +0800 4 | Subject: [PATCH] Add mips64el-redhat-linux- to gcc_toolchain for mips64el 5 | cross compile on x64. 6 | 7 | --- 8 | build/toolchain/linux/BUILD.gn | 10 +++++----- 9 | 1 file changed, 5 insertions(+), 5 deletions(-) 10 | 11 | diff --git a/build/toolchain/linux/BUILD.gn b/build/toolchain/linux/BUILD.gn 12 | index bd37707..2fbc4d6e 100644 13 | --- a/build/toolchain/linux/BUILD.gn 14 | +++ b/build/toolchain/linux/BUILD.gn 15 | @@ -172,12 +172,12 @@ gcc_toolchain("mipsel") { 16 | } 17 | 18 | gcc_toolchain("mips64el") { 19 | - cc = "gcc" 20 | - cxx = "g++" 21 | - ar = "ar" 22 | + cc = "mips64el-loongson-linux-gcc" 23 | + cxx = "mips64el-loongson-linux-g++" 24 | + ar = "mips64el-loongson-linux-ar" 25 | ld = cxx 26 | - readelf = "readelf" 27 | - nm = "nm" 28 | + readelf = "mips64el-loongson-linux-readelf" 29 | + nm = "mips64el-loongson-linux-nm" 30 | 31 | toolchain_args = { 32 | cc_wrapper = "" 33 | -- 34 | 2.1.0 35 | 36 | -------------------------------------------------------------------------------- /patches/mips64el/chromium/Fix-error-about-relocation-truncated-to-fit-R_MIPS_C.patch: -------------------------------------------------------------------------------- 1 | From 0c64df90e4ca25644ac5aa3f35ab4884f697165e Mon Sep 17 00:00:00 2001 2 | From: Wang Qing 3 | Date: Mon, 9 Oct 2017 16:53:22 +0800 4 | Subject: [PATCH] Fix error about "relocation truncated to fit: R_MIPS_CALL16" 5 | when cross-compiling shared_library with is_debug on x64. 6 | 7 | --- 8 | content/common/BUILD.gn | 5 +++++ 9 | ppapi/proxy/BUILD.gn | 5 +++++ 10 | 2 files changed, 10 insertions(+) 11 | 12 | diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn 13 | index fd5c0dc..e91e8348 100644 14 | --- a/content/common/BUILD.gn 15 | +++ b/content/common/BUILD.gn 16 | @@ -15,6 +15,11 @@ if (is_mac) { 17 | import("//build/config/mac/mac_sdk.gni") 18 | } 19 | 20 | +if (is_debug && current_cpu == "mips64el") { 21 | + cflags_cc = [ "-mxgot" ] 22 | + cflags_cc += [ "-mlong-calls" ] 23 | +} 24 | + 25 | # For feature flags internal to content. See content/public/common:features 26 | # for feature flags that clients of contents need to know about. 27 | buildflag_header("features") { 28 | diff --git a/ppapi/proxy/BUILD.gn b/ppapi/proxy/BUILD.gn 29 | index b572778..a2630f20 100644 30 | --- a/ppapi/proxy/BUILD.gn 31 | +++ b/ppapi/proxy/BUILD.gn 32 | @@ -8,6 +8,11 @@ config("proxy_implementation") { 33 | defines = [ "PPAPI_PROXY_IMPLEMENTATION" ] 34 | } 35 | 36 | +if (is_debug && current_cpu == "mips64el") { 37 | + cflags_cc = [ "-mxgot" ] 38 | + cflags_cc += [ "-mlong-calls" ] 39 | +} 40 | + 41 | component("proxy") { 42 | output_name = "ppapi_proxy" 43 | 44 | -- 45 | 2.7.4 46 | 47 | -------------------------------------------------------------------------------- /patches/mips64el/chromium/Fix-mips-cross-toolchain-build-src-crypto-ec-p256-64.patch: -------------------------------------------------------------------------------- 1 | From 317dff3f396f5e0fc7010a76d7ccbcb708e515a3 Mon Sep 17 00:00:00 2001 2 | From: Wang Qing 3 | Date: Sat, 30 Sep 2017 09:30:05 +0800 4 | Subject: [PATCH] Fix mips cross-toolchain build src/crypto/ec/p256-64.c with 5 | -O2. 6 | 7 | --- 8 | third_party/boringssl/BUILD.gn | 6 ++++++ 9 | 1 file changed, 6 insertions(+) 10 | 11 | diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn 12 | index abe39b2..a7bd880 100644 13 | --- a/third_party/boringssl/BUILD.gn 14 | +++ b/third_party/boringssl/BUILD.gn 15 | @@ -32,6 +32,12 @@ config("internal_config") { 16 | ] 17 | if (is_posix) { 18 | cflags_c = [ "-std=c99" ] 19 | + # TODO(wangqing): Fix mips cross-toolchain build src/crypto/ec/p256-64.c 20 | + # with -O2. 21 | + if (current_cpu == "mips64el" && current_cpu != host_cpu) { 22 | + cflags_c += [ "-O1" ] 23 | + } 24 | + 25 | defines += [ "_XOPEN_SOURCE=700" ] 26 | } 27 | } 28 | -- 29 | 2.7.4 30 | 31 | -------------------------------------------------------------------------------- /patches/mips64el/chromium/Set-kernal-page-size-to-16K-on-loongson-MIPS-archtec.patch: -------------------------------------------------------------------------------- 1 | From 81bbd23ad0649bfd381eaeecbd58c2c43ba08122 Mon Sep 17 00:00:00 2001 2 | From: Wang Qing 3 | Date: Thu, 14 Sep 2017 20:51:10 +0800 4 | Subject: [PATCH] Set kernal page size to 16K on loongson(MIPS) archtecture. 5 | 6 | This patch is specail used for mips64. 7 | --- 8 | base/allocator/partition_allocator/page_allocator.h | 7 +++++++ 9 | base/allocator/partition_allocator/partition_alloc.h | 5 +++++ 10 | 2 files changed, 12 insertions(+) 11 | 12 | diff --git a/base/allocator/partition_allocator/page_allocator.h b/base/allocator/partition_allocator/page_allocator.h 13 | index f57beb7..0ef1705 100644 14 | --- a/base/allocator/partition_allocator/page_allocator.h 15 | +++ b/base/allocator/partition_allocator/page_allocator.h 16 | @@ -17,6 +17,8 @@ namespace base { 17 | 18 | #if defined(OS_WIN) 19 | static const size_t kPageAllocationGranularityShift = 16; // 64KB 20 | +#elif __mips__ 21 | +static const size_t kPageAllocationGranularityShift = 14; // 64KB 22 | #else 23 | static const size_t kPageAllocationGranularityShift = 12; // 4KB 24 | #endif 25 | @@ -29,7 +31,12 @@ static const size_t kPageAllocationGranularityBaseMask = 26 | 27 | // All Blink-supported systems have 4096 sized system pages and can handle 28 | // permissions and commit / decommit at this granularity. 29 | +// But, on mips have 16384 sized system pages. 30 | +#ifdef __mips__ 31 | +static const size_t kSystemPageSize = 16384; 32 | +#else 33 | static const size_t kSystemPageSize = 4096; 34 | +#endif 35 | static const size_t kSystemPageOffsetMask = kSystemPageSize - 1; 36 | static const size_t kSystemPageBaseMask = ~kSystemPageOffsetMask; 37 | 38 | diff --git a/base/allocator/partition_allocator/partition_alloc.h b/base/allocator/partition_allocator/partition_alloc.h 39 | index c720a50..67c3598 100644 40 | --- a/base/allocator/partition_allocator/partition_alloc.h 41 | +++ b/base/allocator/partition_allocator/partition_alloc.h 42 | @@ -94,7 +94,12 @@ static const size_t kBucketShift = (kAllocationGranularity == 8) ? 3 : 2; 43 | // system page of the span. For our current max slot span size of 64k and other 44 | // constant values, we pack _all_ PartitionAllocGeneric() sizes perfectly up 45 | // against the end of a system page. 46 | +// On mips have 16KB pagesize, So kPartitionPageSize is 64KB. 47 | +#ifdef __mips__ 48 | +static const size_t kPartitionPageShift = 16; // 64KB 49 | +#else 50 | static const size_t kPartitionPageShift = 14; // 16KB 51 | +#endif 52 | static const size_t kPartitionPageSize = 1 << kPartitionPageShift; 53 | static const size_t kPartitionPageOffsetMask = kPartitionPageSize - 1; 54 | static const size_t kPartitionPageBaseMask = ~kPartitionPageOffsetMask; 55 | -- 56 | 2.1.0 57 | 58 | -------------------------------------------------------------------------------- /patches/mips64el/chromium/support-old-nss.patch: -------------------------------------------------------------------------------- 1 | diff --git a/crypto/nss_util.cc b/crypto/nss_util.cc 2 | index a0e7f61fab0c..fac728a729fb 100644 3 | --- a/crypto/nss_util.cc 4 | +++ b/crypto/nss_util.cc 5 | @@ -623,13 +623,16 @@ class NSSInitSingleton { 6 | 7 | EnsureNSPRInit(); 8 | 9 | - // We *must* have NSS >= 3.26 at compile time. 10 | - static_assert((NSS_VMAJOR == 3 && NSS_VMINOR >= 26) || (NSS_VMAJOR > 3), 11 | - "nss version check failed"); 12 | + // We *must* have NSS >= 3.14.3. 13 | + static_assert( 14 | + (NSS_VMAJOR == 3 && NSS_VMINOR == 14 && NSS_VPATCH >= 3) || 15 | + (NSS_VMAJOR == 3 && NSS_VMINOR > 14) || 16 | + (NSS_VMAJOR > 3), 17 | + "nss version check failed"); 18 | // Also check the run-time NSS version. 19 | // NSS_VersionCheck is a >= check, not strict equality. 20 | - if (!NSS_VersionCheck("3.26")) { 21 | - LOG(FATAL) << "NSS_VersionCheck(\"3.26\") failed. NSS >= 3.26 is " 22 | + if (!NSS_VersionCheck("3.14.3")) { 23 | + LOG(FATAL) << "NSS_VersionCheck(\"3.14.3\") failed. NSS >= 3.14.3 is " 24 | "required. Please upgrade to the latest NSS, and if you " 25 | "still get this error, contact your distribution " 26 | "maintainer."; 27 | diff --git a/crypto/scoped_test_nss_db.cc b/crypto/scoped_test_nss_db.cc 28 | index 03470c130371..b334109e0342 100644 29 | --- a/crypto/scoped_test_nss_db.cc 30 | +++ b/crypto/scoped_test_nss_db.cc 31 | @@ -44,6 +44,15 @@ ScopedTestNSSDB::~ScopedTestNSSDB() { 32 | CERT_DestroyCertList(cert_list); 33 | } 34 | 35 | + // Don't close when NSS is < 3.15.1, because it would require an additional 36 | + // sleep for 1 second after closing the database, due to 37 | + // http://bugzil.la/875601. 38 | + if (!NSS_VersionCheck("3.15.1")) { 39 | + LOG(ERROR) << "NSS version is < 3.15.1, test DB will not be closed."; 40 | + temp_dir_.Take(); 41 | + return; 42 | + } 43 | + 44 | // NSS is allowed to do IO on the current thread since dispatching 45 | // to a dedicated thread would still have the affect of blocking 46 | // the current thread, due to NSS's internal locking requirements 47 | -------------------------------------------------------------------------------- /patches/mips64el/ffmpeg/.patches.yaml: -------------------------------------------------------------------------------- 1 | repo: src/third_party/ffmpeg 2 | patches: 3 | - 4 | author: Cheng Zhao 5 | file: Fix-build_ffmpeg-with-cross-prefix-mips64el-redhat-l.patch 6 | description: null 7 | -------------------------------------------------------------------------------- /patches/mips64el/ffmpeg/Fix-build_ffmpeg-with-cross-prefix-mips64el-redhat-l.patch: -------------------------------------------------------------------------------- 1 | From dcd2071f20aa79f2eb1959cd5f040a0e4a0c058b Mon Sep 17 00:00:00 2001 2 | From: Wang Qing 3 | Date: Sat, 30 Sep 2017 10:21:25 +0800 4 | Subject: [PATCH] Fix build_ffmpeg with cross-prefix mips64el-redhat-linux-. 5 | 6 | --- 7 | chromium/scripts/build_ffmpeg.py | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/chromium/scripts/build_ffmpeg.py b/chromium/scripts/build_ffmpeg.py 11 | index 0dbd9eb..79b5af2 100755 12 | --- a/chromium/scripts/build_ffmpeg.py 13 | +++ b/chromium/scripts/build_ffmpeg.py 14 | @@ -516,7 +516,7 @@ def main(argv): 15 | else: 16 | configure_flags['Common'].extend([ 17 | '--enable-cross-compile', 18 | - '--cross-prefix=mips64el-linux-gnuabi64-', 19 | + '--cross-prefix=mips64el-loongson-linux-', 20 | '--target-os=linux', 21 | '--arch=mips', 22 | '--extra-cflags=-mips64r2', 23 | -- 24 | 2.7.4 25 | 26 | -------------------------------------------------------------------------------- /patches/mips64el/v8/.patches.yaml: -------------------------------------------------------------------------------- 1 | repo: src/v8 2 | patches: 3 | - 4 | author: Cheng Zhao 5 | file: Fix-v8-loongson-page-size.patch 6 | description: null 7 | -------------------------------------------------------------------------------- /patches/mips64el/v8/Fix-v8-loongson-page-size.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/base/platform/platform-posix.cc b/src/base/platform/platform-posix.cc 2 | index 31da953..14c6c55 100644 3 | --- a/src/base/platform/platform-posix.cc 4 | +++ b/src/base/platform/platform-posix.cc 5 | @@ -97,7 +97,11 @@ int OS::ActivationFrameAlignment() { 6 | 7 | 8 | intptr_t OS::CommitPageSize() { 9 | +#if V8_TARGET_ARCH_MIPS64 10 | + static intptr_t page_size = 16384; 11 | +#else 12 | static intptr_t page_size = getpagesize(); 13 | +#endif 14 | return page_size; 15 | } 16 | 17 | @@ -241,7 +245,7 @@ void* OS::GetRandomMmapAddr() { 18 | 19 | 20 | size_t OS::AllocateAlignment() { 21 | - return static_cast(sysconf(_SC_PAGESIZE)); 22 | + return 16384; 23 | } 24 | 25 | 26 | diff --git a/src/base/sys-info.cc b/src/base/sys-info.cc 27 | index 1b6d393..2a93061 100644 28 | --- a/src/base/sys-info.cc 29 | +++ b/src/base/sys-info.cc 30 | @@ -90,7 +90,7 @@ int64_t SysInfo::AmountOfPhysicalMemory() { 31 | return static_cast(result) * 1024L; 32 | #elif V8_OS_POSIX 33 | long pages = sysconf(_SC_PHYS_PAGES); // NOLINT(runtime/int) 34 | - long page_size = sysconf(_SC_PAGESIZE); // NOLINT(runtime/int) 35 | + long page_size = 16384; // NOLINT(runtime/int) 36 | if (pages == -1 || page_size == -1) { 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /resources/about_credits.tmpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Credits 6 | 60 | 61 | 62 | Credits 63 | Print 64 |
65 | {{entries}} 66 |
67 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /resources/about_credits_entry.tmpl: -------------------------------------------------------------------------------- 1 |
2 | {{name}} 3 | show license 4 | homepage 5 |
6 |
{{license}}
7 |
8 |
9 | -------------------------------------------------------------------------------- /script/README.md: -------------------------------------------------------------------------------- 1 | ## get-patch 2 | 3 | Use it to save commits from upstream repositories as patch files. 4 | 5 | ### Examples 6 | 7 | 1. Write commit contents in the patch format to stdout. 8 | ``` 9 | $ ./script/get-patch --repo src --commit 8e8216e5 10 | ``` 11 | 12 | 2. Create a patch file with a default name if a specified directory. 13 | ``` 14 | $ ./script/get-patch --repo src --commit 8e8216e5 --output-dir patches 15 | ``` 16 | 17 | 3. Create a patch file with a custom name in the current directory. 18 | ``` 19 | $ ./script/get-patch --repo src --commit 8e8216e5 --filename my.patch 20 | ``` 21 | 22 | 4. Create a patch file with a custom name in a specified directory. 23 | ``` 24 | $ ./script/get-patch --repo src --commit 8e8216e5 --output-dir patches --filename my.patch 25 | ``` 26 | 27 | 5. Create patch files with default names in a specified directory. 28 | ``` 29 | $ ./script/get-patch --repo src --output-dir patches --commit 8e8216e5 164c37e3 30 | ``` 31 | 32 | 6. Create patch files with custom names in a specified directory. 33 | Note that number of filenames must match the number of commits. 34 | ``` 35 | $ ./script/get-patch --repo src --output-dir patches --commit 8e8216e5 164c37e3 --filename first.patch second.patch 36 | ``` 37 | -------------------------------------------------------------------------------- /script/apply-patches: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import argparse 4 | import os 5 | import subprocess 6 | import sys 7 | 8 | import lib.git as git 9 | from lib.patches import PatchesConfig 10 | 11 | 12 | SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) 13 | PATCHES_DIR = os.path.join(SOURCE_ROOT, 'patches') 14 | PATCHES_COMMON_DIR = os.path.join(PATCHES_DIR, 'common') 15 | PATCHES_MIPS64EL_DIR = os.path.join(PATCHES_DIR, 'mips64el') 16 | SRC = 'src' 17 | SRC_DIR = os.path.join(SOURCE_ROOT, SRC) 18 | 19 | 20 | def main(): 21 | args = parse_args() 22 | 23 | project_root = os.path.abspath(args.project_root) 24 | 25 | for folder in args.folders: 26 | error = apply_patches_for_dir(folder, project_root, args.commit) 27 | if error: 28 | sys.stderr.write(error + '\n') 29 | sys.stderr.flush() 30 | return 1 31 | 32 | return 0 33 | 34 | 35 | def apply_patches_for_dir(directory, project_root, commit): 36 | for root, dirs, files in os.walk(directory): 37 | config = PatchesConfig.from_directory(root, project_root=project_root) 38 | patches_list = config.get_patches_list() 39 | if patches_list is None: 40 | continue 41 | 42 | (success, failed_patches) = patches_list.apply(commit=commit) 43 | if not success: 44 | patch_path = failed_patches[0].get_file_path() 45 | return '{0} failed to apply'.format(os.path.basename(patch_path)) 46 | 47 | 48 | def parse_args(): 49 | parser = argparse.ArgumentParser(description='Apply all required patches.') 50 | 51 | parser.add_argument('--commit', default=False, action='store_true', 52 | help='Commit a patch after it has been applied') 53 | parser.add_argument('--project-root', required=False, default=git.get_repo_root(os.path.abspath(__file__)), 54 | help='Parent folder to resolve repos relative paths against') 55 | parser.add_argument('-t', '--target_arch', 56 | help='Target architecture') 57 | 58 | parser.add_argument('-f', '--folder', dest='folders', help='Apply patches from this folder', nargs='*', default=[]) 59 | 60 | args = parser.parse_args() 61 | if not args.folders: 62 | args.folders.append(PATCHES_COMMON_DIR) 63 | if args.target_arch == 'mips64el': 64 | args.folders.append(PATCHES_MIPS64EL_DIR) 65 | return args 66 | 67 | 68 | if __name__ == '__main__': 69 | sys.exit(main()) 70 | -------------------------------------------------------------------------------- /script/bootstrap: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import shutil 5 | import subprocess 6 | import sys 7 | 8 | import lib.util as util 9 | 10 | 11 | SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) 12 | 13 | 14 | def main(): 15 | os.chdir(SOURCE_ROOT) 16 | result = (subprocess.call(['git', 'submodule', 'sync']) or 17 | subprocess.call(['git', 'submodule', 'update', 18 | '--init', '--recursive'])) 19 | if result: 20 | return result 21 | 22 | # Setup boto. 23 | with util.scoped_cwd(os.path.join('vendor', 'boto')): 24 | subprocess.call([sys.executable, 'setup.py', 'build']) 25 | # On windows python assumes all script names end with .py, if we don't 26 | # do so some modules like multiprocessing would break. 27 | shutil.copy(os.path.join('bin', 's3put'), os.path.join('bin', 's3put.py')) 28 | 29 | 30 | if __name__ == '__main__': 31 | sys.exit(main()) 32 | -------------------------------------------------------------------------------- /script/build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import argparse 4 | import os 5 | import subprocess 6 | import sys 7 | import platform 8 | 9 | from lib.config import MIPS64EL_GCC, set_mips64el_env, get_output_dir, \ 10 | SOURCE_ROOT, VENDOR_DIR, DEPOT_TOOLS_DIR, \ 11 | COMPONENTS 12 | 13 | from lib.ninja import run as run_ninja 14 | 15 | 16 | def main(): 17 | args = parse_args() 18 | target_arch = args.target_arch 19 | 20 | env = os.environ.copy() 21 | env['PATH'] = os.pathsep.join([DEPOT_TOOLS_DIR, env['PATH']]) 22 | if sys.platform in ['win32', 'cygwin']: 23 | env['DEPOT_TOOLS_WIN_TOOLCHAIN'] = '0' 24 | elif target_arch == 'arm64': 25 | binutils_dir = os.path.join(VENDOR_DIR, 'binutils-aarch64') 26 | env['LD_LIBRARY_PATH'] = binutils_dir + '/usr/x86_64-linux-gnu/aarch64-linux-gnu/lib' 27 | env['PATH'] = os.pathsep.join([binutils_dir + '/usr/bin', env['PATH']]) 28 | elif target_arch == 'mips64el': 29 | set_mips64el_env(env) 30 | 31 | os.chdir(SOURCE_ROOT) 32 | 33 | # Build everything by default. 34 | components_to_build = list(COMPONENTS) 35 | 36 | if args.debug: 37 | components_to_build = ['shared_library', 'ffmpeg'] 38 | elif args.release: 39 | components_to_build = ['static_library', 'ffmpeg'] 40 | elif args.component is not None: 41 | components_to_build = args.component 42 | elif "arm" not in target_arch: 43 | components_to_build.remove('native_mksnapshot') 44 | 45 | for component in components_to_build: 46 | out_dir = get_output_dir(SOURCE_ROOT, target_arch, component) 47 | target = 'libchromiumcontent/chromiumcontent:chromiumcontent' 48 | if component == 'tests': 49 | target = 'libchromiumcontent/chromiumcontent:chromiumcontent_tests' 50 | if component == 'native_mksnapshot': 51 | target = 'v8:mksnapshot' 52 | run_ninja(os.path.relpath(out_dir), target=target, env=env) 53 | 54 | if component == 'static_library': 55 | subenv = env.copy() 56 | subenv['CHROMIUMCONTENT_2ND_PASS'] = '1' 57 | target = 'libchromiumcontent/chromiumcontent:libs' 58 | run_ninja(os.path.relpath(out_dir), target=target, env=subenv) 59 | 60 | 61 | def parse_args(): 62 | parser = argparse.ArgumentParser(description='Build libchromiumcontent') 63 | 64 | parser.add_argument('-t', '--target_arch', default='x64', 65 | choices=['arm', 'arm64', 'ia32', 'mips64el', 'x64']) 66 | 67 | what_to_build_group = parser.add_mutually_exclusive_group() 68 | what_to_build_group.add_argument('-c', '--component', nargs='+', default=None, 69 | choices=COMPONENTS) 70 | what_to_build_group.add_argument('-D', '--debug', action='store_true', 71 | help='Build debug configuration') 72 | what_to_build_group.add_argument('-R', '--release', action='store_true', 73 | help='Build release configuration') 74 | 75 | return parser.parse_args() 76 | 77 | 78 | if __name__ == '__main__': 79 | sys.exit(main()) 80 | -------------------------------------------------------------------------------- /script/cibuild-libchromiumcontent-linux: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | set -o pipefail 5 | 6 | rm -rf dist 7 | rm -rf libchromiumcontent.tar.bz2 8 | rm -rf libchromiumcontent.zip 9 | rm -rf libchromiumcontent-static.tar.bz2 10 | rm -rf libchromiumcontent-static.zip 11 | 12 | docker build \ 13 | --force-rm \ 14 | --tag libchromiumcontent-linux \ 15 | . 16 | 17 | docker run \ 18 | --rm \ 19 | --env TARGET_ARCH="$TARGET_ARCH" \ 20 | --user "$UID" \ 21 | --volume "$PWD":/workspace/libchromiumcontent \ 22 | --volume /var/lib/jenkins/config:/config \ 23 | --workdir /workspace/libchromiumcontent \ 24 | libchromiumcontent-linux script/cibuild 25 | -------------------------------------------------------------------------------- /script/cibuild-libchromiumcontent-linux-arm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export TARGET_ARCH=arm 4 | 5 | script/cibuild-libchromiumcontent-linux 6 | -------------------------------------------------------------------------------- /script/cibuild-libchromiumcontent-linux-arm64: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export TARGET_ARCH=arm64 4 | 5 | script/cibuild-libchromiumcontent-linux 6 | -------------------------------------------------------------------------------- /script/cibuild-libchromiumcontent-linux-ia32: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export TARGET_ARCH=ia32 4 | 5 | script/cibuild-libchromiumcontent-linux 6 | -------------------------------------------------------------------------------- /script/cibuild-libchromiumcontent-linux-mips64el: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export TARGET_ARCH=mips64el 4 | 5 | script/cibuild-libchromiumcontent-linux 6 | -------------------------------------------------------------------------------- /script/cibuild-libchromiumcontent-linux-x64: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export TARGET_ARCH=x64 4 | 5 | script/cibuild-libchromiumcontent-linux 6 | -------------------------------------------------------------------------------- /script/cibuild.ps1: -------------------------------------------------------------------------------- 1 | param([switch]$skipUpload, [switch]$useSccache, [switch]$buildTests) 2 | function Run-Command([scriptblock]$Command, [switch]$Fatal, [switch]$Quiet) { 3 | $output = "" 4 | try { 5 | if ($Quiet) { 6 | $output = & $Command 2>&1 7 | } else { 8 | & $Command 9 | } 10 | } catch { 11 | throw 12 | } 13 | 14 | if (!$Fatal) { 15 | return 16 | } 17 | 18 | $exitCode = 0 19 | if ($LastExitCode -ne 0) { 20 | $exitCode = $LastExitCode 21 | } elseif (!$?) { 22 | $exitCode = 1 23 | } else { 24 | return 25 | } 26 | 27 | $error = "Error executing command ``$Command``." 28 | if ($output) { 29 | $error += " Output:" + [System.Environment]::NewLine + $output 30 | } 31 | Write-Output $error 32 | exit $exitCode 33 | } 34 | 35 | Write-Output "" 36 | $CommandLine = "python .\script\cibuild" 37 | if ($skipUpload) { 38 | $CommandLine += " --skip_upload" 39 | } 40 | 41 | if ($useSccache) { 42 | $CommandLine += " --use_sccache" 43 | } 44 | 45 | if ($buildTests) { 46 | $CommandLine += " --build_tests" 47 | } 48 | $CICommand = [ScriptBlock]::Create($CommandLine) 49 | Run-Command -Fatal $CICommand 50 | -------------------------------------------------------------------------------- /script/disabled-tests.yaml: -------------------------------------------------------------------------------- 1 | # This file lists all of the disabled tests 2 | # It is used by the run_tests script to determine the tests to be excluded 3 | # Here's an example of the file contents format: 4 | # 5 | # test_name: 6 | # - exclude_test_filter 7 | # 8 | # The `test_name` is the test target that's built (same as the test executable name) 9 | # The `exclude_test_filter` is the gtest filter pattern that should be applied for 10 | # exclusion. All tests matching this pattern will be excluded. 11 | 12 | 13 | base_unittests: 14 | - WeakPtrDeathTest* 15 | content_browsertests: 16 | - RenderFrameHostImplBrowserTest.BeforeUnloadDialogRequiresGesture 17 | gpu_unittests: 18 | - GPUTestConfigTest.LoadCurrentConfig 19 | content_unittests: 20 | - DOMStorageMapParamTest.EnforcesQuota 21 | -------------------------------------------------------------------------------- /script/get-patch: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """Retrieves commit contents in a patch format. 4 | 5 | Check README.md for usage examples or run it with `-h` argument to get an interface reference. 6 | """ 7 | 8 | import argparse 9 | import os 10 | import sys 11 | 12 | from lib.git import get_patch as git_get_patch 13 | 14 | 15 | def parse_args(): 16 | parser = argparse.ArgumentParser( 17 | description='Get a commit contents in a patch format.') 18 | 19 | parser.add_argument('-c', '--commit', nargs='+', required=True, 20 | help='Commit hash(es).') 21 | parser.add_argument('-f', '--filename', nargs='*', required=False, 22 | help='Filename(s) for a patch file(s). Defaults to something like {0}.' 23 | .format(get_default_patch_file_name( 24 | '4b825dc642cb6eb9a060e54bf8d69288fbee4904'))) 25 | parser.add_argument('-o', '--output-dir', required=False, 26 | help='Folder to save the patch in. Defaults to a current folder.') 27 | parser.add_argument('-r', '--repo', required=True, 28 | help='Path to a repository root folder.') 29 | 30 | args = parser.parse_args() 31 | 32 | # Additional rules 33 | if args.filename is not None and (len(args.commit) != len(args.filename)): 34 | parser.error("Number of filenames ({0}) must be equal to number of commits ({1})." 35 | .format(len(args.filename), len(args.commit))) 36 | 37 | return args 38 | 39 | 40 | def get_default_patch_file_name(commit_hash): 41 | template = 'backport_{commit_hash}.patch' 42 | 43 | number_of_hash_characters_to_preserve = 8 44 | commit_hash_string = commit_hash[:number_of_hash_characters_to_preserve+1] 45 | 46 | patch_file_name = template.format( 47 | commit_hash=commit_hash_string) 48 | 49 | return patch_file_name 50 | 51 | 52 | def get_output_path(output_dir, output_filename, commit_hash): 53 | if (output_dir is None) and (output_filename is None): 54 | return None 55 | 56 | # Use current dir as a default. 57 | if output_dir is None: 58 | output_dir = '.' 59 | 60 | # Use the default filename if it's not provided. 61 | if output_filename is None: 62 | output_filename = get_default_patch_file_name(commit_hash) 63 | 64 | output_path = os.path.join(output_dir, output_filename) 65 | return output_path 66 | 67 | 68 | def save_to_file(data, file_path): 69 | with open(file_path, 'w') as f: 70 | f.write(data) 71 | 72 | 73 | def process_patch(repo, commit_hash, output_path=None): 74 | patch_contents = git_get_patch(repo, commit_hash) 75 | 76 | if output_path is None: 77 | sys.stdout.write(patch_contents) 78 | else: 79 | save_to_file(data=patch_contents, file_path=output_path) 80 | 81 | 82 | def main(): 83 | args = parse_args() 84 | 85 | commits = args.commit 86 | filenames = args.filename 87 | 88 | # (alexeykuzmin): Ugly hack alert. 89 | if filenames is None: 90 | filenames = [None] * len(commits) 91 | 92 | for (commit, filename) in zip(commits, filenames): 93 | output_path = get_output_path(args.output_dir, filename, 94 | commit_hash=commit) 95 | process_patch(args.repo, commit, output_path) 96 | 97 | return 0 98 | 99 | 100 | if __name__ == '__main__': 101 | sys.exit(main()) 102 | -------------------------------------------------------------------------------- /script/lib/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/electron/libchromiumcontent/768f52340da3a67a68fb138683909b8b292f470c/script/lib/__init__.py -------------------------------------------------------------------------------- /script/lib/config.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import platform 5 | import sys 6 | 7 | SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) 8 | SRC_DIR = os.path.join(SOURCE_ROOT, 'src') 9 | TOOLS_DIR = os.path.join(SOURCE_ROOT, 'tools') 10 | VENDOR_DIR = os.path.join(SOURCE_ROOT, 'vendor') 11 | DEPOT_TOOLS_DIR = os.path.join(VENDOR_DIR, 'depot_tools') 12 | 13 | COMPONENTS = ['static_library', 'shared_library', 'ffmpeg', 'tests', 'native_mksnapshot'] 14 | 15 | # URL to the mips64el sysroot image. 16 | MIPS64EL_SYSROOT = 'https://github.com/electron/debian-sysroot-image-creator/releases/download/v0.5.0/debian_jessie_mips64-sysroot.tar.bz2' 17 | # URL to the mips64el toolchain. 18 | MIPS64EL_GCC = 'cross-gcc-4.9.3-n64-loongson-rc5.4' 19 | MIPS64EL_GCC_URL = 'https://github.com/electron/debian-sysroot-image-creator/releases/download/v0.5.0/' + MIPS64EL_GCC + '.tar.gz' 20 | 21 | # Whether the host system is an arm64 machine 22 | IS_ARM64_HOST = platform.machine() == 'aarch64' 23 | # Whether the host system is an arm64 machine 24 | IS_ARMV7_HOST = platform.machine() == 'armv7l' 25 | 26 | PLATFORM_KEY = { 27 | 'cygwin': 'win', 28 | 'darwin': 'osx', 29 | 'linux2': 'linux', 30 | 'win32': 'win', 31 | }[sys.platform] 32 | 33 | def set_mips64el_env(env): 34 | gcc_dir = os.path.join(VENDOR_DIR, MIPS64EL_GCC) 35 | ldlib_dirs = [ 36 | gcc_dir + '/usr/x86_64-unknown-linux-gnu/mips64el-loongson-linux/lib', 37 | gcc_dir + '/usr/lib64', 38 | gcc_dir + '/usr/mips64el-loongson-linux/lib64', 39 | gcc_dir + '/usr/mips64el-loongson-linux/sysroot/lib64', 40 | gcc_dir + '/usr/mips64el-loongson-linux/sysroot/usr/lib64', 41 | ] 42 | env['LD_LIBRARY_PATH'] = os.pathsep.join(ldlib_dirs) 43 | env['PATH'] = os.pathsep.join([gcc_dir + '/usr/bin', env['PATH']]) 44 | 45 | 46 | def get_output_dir(source_root, target_arch, component): 47 | return os.path.join(source_root, 'src', 'out-' + target_arch, component) 48 | -------------------------------------------------------------------------------- /script/lib/filesystem.py: -------------------------------------------------------------------------------- 1 | """Filesystem related helper functions. 2 | """ 3 | 4 | import contextlib 5 | import errno 6 | import os 7 | import shutil 8 | import sys 9 | import tarfile 10 | import tempfile 11 | import urllib2 12 | 13 | 14 | def mkdir_p(path): 15 | try: 16 | os.makedirs(path) 17 | except OSError as e: 18 | if e.errno != errno.EEXIST: 19 | raise 20 | 21 | 22 | def rm_f(path): 23 | try: 24 | os.remove(path) 25 | except OSError as e: 26 | if e.errno != errno.ENOENT: 27 | raise 28 | 29 | 30 | def rm_rf(path): 31 | try: 32 | shutil.rmtree(path) 33 | except OSError as e: 34 | if e.errno != errno.ENOENT: 35 | raise 36 | 37 | 38 | def safe_unlink(path): 39 | try: 40 | os.unlink(path) 41 | except OSError as e: 42 | if e.errno != errno.ENOENT: 43 | raise 44 | 45 | def byte_to_mb(n): 46 | return str(n / 1024 / 1024) + 'MB' 47 | 48 | def download_and_extract(destination, url, verbose): 49 | print url 50 | with tempfile.TemporaryFile() as t: 51 | with contextlib.closing(urllib2.urlopen(url)) as u: 52 | total = int(u.headers['content-length']) 53 | done = 0 54 | last_length = 0 55 | while True: 56 | chunk = u.read(1024*1024) 57 | done += len(chunk) 58 | if not len(chunk): 59 | break 60 | if verbose: 61 | percent = '{0:.2f}%'.format(round(float(done) / float(total), 4) * 100) 62 | ratio = '(' + byte_to_mb(done) + '/' + byte_to_mb(total) + ')' 63 | line = '-> ' + percent + ' ' + ratio 64 | sys.stderr.write(line.ljust(last_length) + '\r') 65 | last_length = len(line) 66 | sys.stderr.flush() 67 | t.write(chunk) 68 | if verbose: 69 | sys.stderr.write('\nExtracting...\n') 70 | sys.stderr.flush() 71 | with tarfile.open(fileobj=t, mode='r:bz2') as z: 72 | z.extractall(destination) 73 | -------------------------------------------------------------------------------- /script/lib/git.py: -------------------------------------------------------------------------------- 1 | """Git helper functions. 2 | 3 | Everything in here should be project agnostic, shouldn't rely on project's structure, 4 | and make any assumptions about the passed arguments or calls outcomes. 5 | """ 6 | 7 | import os 8 | import subprocess 9 | 10 | from util import scoped_cwd 11 | 12 | 13 | def is_repo_root(path): 14 | path_exists = os.path.exists(path) 15 | if not path_exists: 16 | return False 17 | 18 | git_folder_path = os.path.join(path, '.git') 19 | git_folder_exists = os.path.exists(git_folder_path) 20 | 21 | return git_folder_exists 22 | 23 | 24 | def get_repo_root(path): 25 | """Finds a closest ancestor folder which is a repo root.""" 26 | norm_path = os.path.normpath(path) 27 | norm_path_exists = os.path.exists(norm_path) 28 | if not norm_path_exists: 29 | return None 30 | 31 | if is_repo_root(norm_path): 32 | return norm_path 33 | 34 | parent_path = os.path.dirname(norm_path) 35 | 36 | # Check if we're in the root folder already. 37 | if parent_path == norm_path: 38 | return None 39 | 40 | return get_repo_root(parent_path) 41 | 42 | 43 | def apply(repo, patch_path, directory=None, index=False, reverse=False): 44 | args = ['git', 'apply', 45 | '--ignore-space-change', 46 | '--ignore-whitespace', 47 | '--whitespace', 'fix' 48 | ] 49 | if directory: 50 | args += ['--directory', directory] 51 | if index: 52 | args += ['--index'] 53 | if reverse: 54 | args += ['--reverse'] 55 | args += ['--', patch_path] 56 | 57 | with scoped_cwd(repo): 58 | return_code = subprocess.call(args) 59 | applied_successfully = (return_code == 0) 60 | return applied_successfully 61 | 62 | 63 | def get_patch(repo, commit_hash): 64 | args = ['git', 'diff-tree', 65 | '-p', 66 | commit_hash, 67 | '--' # Explicitly tell Git that `commit_hash` is a revision, not a path. 68 | ] 69 | 70 | with scoped_cwd(repo): 71 | return subprocess.check_output(args) 72 | 73 | 74 | def get_head_commit(repo): 75 | args = ['git', 'rev-parse', 'HEAD'] 76 | 77 | with scoped_cwd(repo): 78 | return subprocess.check_output(args).strip() 79 | 80 | 81 | def reset(repo): 82 | args = ['git', 'reset'] 83 | 84 | with scoped_cwd(repo): 85 | subprocess.check_call(args) 86 | 87 | 88 | def commit(repo, author, message): 89 | """ Commit whatever in the index is now.""" 90 | 91 | # Let's setup committer info so git won't complain about it being missing. 92 | # TODO: Is there a better way to set committer's name and email? 93 | env = os.environ.copy() 94 | env['GIT_COMMITTER_NAME'] = 'Anonymous Committer' 95 | env['GIT_COMMITTER_EMAIL'] = 'anonymous@electronjs.org' 96 | 97 | args = ['git', 'commit', 98 | '--author', author, 99 | '--message', message 100 | ] 101 | 102 | with scoped_cwd(repo): 103 | return_code = subprocess.call(args, env=env) 104 | committed_successfully = (return_code == 0) 105 | return committed_successfully 106 | -------------------------------------------------------------------------------- /script/lib/gn.py: -------------------------------------------------------------------------------- 1 | import os 2 | import subprocess 3 | import sys 4 | 5 | 6 | def __get_executable_path(depot_tools_dir): 7 | gn_path = os.path.join(depot_tools_dir, 'gn') 8 | if sys.platform in ['win32', 'cygwin']: 9 | gn_path += '.bat' 10 | 11 | return gn_path 12 | 13 | 14 | def create_args(out_dir, raw_config, **kwargs): 15 | named_arguments = ['{0} = "{1}"\n'.format(k, v) for k, v in kwargs.iteritems()] 16 | 17 | if not os.path.isdir(out_dir): 18 | os.makedirs(out_dir) 19 | 20 | with open(os.path.join(out_dir, 'args.gn'), 'w') as f: 21 | lines_to_write = named_arguments + ['#' * 80 + '\n'] 22 | f.writelines(lines_to_write) 23 | f.write(raw_config) 24 | 25 | 26 | def generate(out_dir, chromium_root_dir, depot_tools_dir, env, verbose): 27 | executable = __get_executable_path(depot_tools_dir) 28 | out_dir_relative_path = os.path.relpath(out_dir, chromium_root_dir) 29 | gn_args = [executable, 'gen', out_dir_relative_path] 30 | if verbose: 31 | gn_args.append('-v') 32 | subprocess.check_call(gn_args, cwd=chromium_root_dir, env=env) 33 | -------------------------------------------------------------------------------- /script/lib/ninja.py: -------------------------------------------------------------------------------- 1 | import os 2 | import subprocess 3 | import sys 4 | 5 | from lib.config import DEPOT_TOOLS_DIR 6 | 7 | 8 | def __get_binary_path(): 9 | path = os.path.join(DEPOT_TOOLS_DIR, 'ninja') 10 | 11 | if sys.platform == 'win32': 12 | path = '{0}.exe'.format(path) 13 | 14 | return path 15 | 16 | 17 | def run(directory, target=None, env=None): 18 | ninja_binary = __get_binary_path() 19 | 20 | args = [ninja_binary, 21 | '-C', directory 22 | ] 23 | if target is not None: 24 | args.append(target) 25 | 26 | subprocess.check_call(args, env=env) 27 | -------------------------------------------------------------------------------- /script/lib/sccache.py: -------------------------------------------------------------------------------- 1 | import os 2 | import subprocess 3 | import sys 4 | 5 | from config import TOOLS_DIR 6 | 7 | 8 | VERSION = 'aad2120' 9 | SUPPORTED_PLATFORMS = { 10 | 'cygwin': 'windows', 11 | 'darwin': 'mac', 12 | 'linux2': 'linux', 13 | 'win32': 'windows', 14 | } 15 | 16 | 17 | def is_platform_supported(platform): 18 | return platform in SUPPORTED_PLATFORMS 19 | 20 | 21 | def get_binary_path(): 22 | platform = sys.platform 23 | if not is_platform_supported(platform): 24 | return None 25 | 26 | platform_dir = SUPPORTED_PLATFORMS[platform] 27 | 28 | path = os.path.join(TOOLS_DIR, 'sccache', VERSION, platform_dir, 'sccache') 29 | if platform_dir == 'windows': 30 | path += '.exe' 31 | 32 | return path 33 | 34 | 35 | def run(*args): 36 | binary_path = get_binary_path() 37 | if binary_path is None: 38 | raise Exception('No sccache binary found for the current platform.') 39 | 40 | call_args = [binary_path] + list(args) 41 | return subprocess.call(call_args) 42 | -------------------------------------------------------------------------------- /script/lib/util.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import print_function 4 | 5 | import contextlib 6 | import itertools 7 | import os 8 | import subprocess 9 | import sys 10 | 11 | 12 | def validate_pair(ob): 13 | if not (len(ob) == 2): 14 | print("Unexpected result:", ob, file=sys.stderr) 15 | return False 16 | else: 17 | return True 18 | 19 | 20 | def consume(iter): 21 | try: 22 | while True: next(iter) 23 | except StopIteration: 24 | pass 25 | 26 | 27 | def get_environment_from_batch_command(env_cmd, initial=None): 28 | """ 29 | Take a command (either a single command or list of arguments) 30 | and return the environment created after running that command. 31 | Note that if the command must be a batch file or .cmd file, or the 32 | changes to the environment will not be captured. 33 | 34 | If initial is supplied, it is used as the initial environment passed 35 | to the child process. 36 | """ 37 | if not isinstance(env_cmd, (list, tuple)): 38 | env_cmd = [env_cmd] 39 | # Construct the command that will alter the environment. 40 | env_cmd = subprocess.list2cmdline(env_cmd) 41 | # Create a tag so we can tell in the output when the proc is done. 42 | tag = 'END OF BATCH COMMAND' 43 | # Construct a cmd.exe command to do accomplish this. 44 | cmd = 'cmd.exe /s /c "{env_cmd} && echo "{tag}" && set"'.format(**vars()) 45 | # Launch the process. 46 | proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, env=initial) 47 | # Parse the output sent to stdout. 48 | lines = proc.stdout 49 | # Consume whatever output occurs until the tag is reached. 50 | consume(itertools.takewhile(lambda l: tag not in l, lines)) 51 | # Define a way to handle each KEY=VALUE line. 52 | handle_line = lambda l: l.rstrip().split('=',1) 53 | # Parse key/values into pairs. 54 | pairs = map(handle_line, lines) 55 | # Make sure the pairs are valid. 56 | valid_pairs = filter(validate_pair, pairs) 57 | # Construct a dictionary of the pairs. 58 | result = dict(valid_pairs) 59 | # Let the process finish. 60 | proc.communicate() 61 | return result 62 | 63 | 64 | def get_vs_env(vs_version, arch): 65 | """ 66 | Returns the env object for VS building environment. 67 | 68 | The vs_version can be strings like "12.0" (e.g. VS2013), the arch has to 69 | be one of "x86", "amd64", "arm", "x86_amd64", "x86_arm", "amd64_x86", 70 | "amd64_arm", e.g. the args passed to vcvarsall.bat. 71 | """ 72 | vsvarsall = "" 73 | if (vs_version == "2017"): 74 | vsvarsall = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build" 75 | else: 76 | vsvarsall = "C:\\Program Files (x86)\\Microsoft Visual Studio {0}\\VC\\vcvarsall.bat".format(vs_version) 77 | return get_environment_from_batch_command([vsvarsall, arch]) 78 | 79 | 80 | @contextlib.contextmanager 81 | def scoped_cwd(path): 82 | cwd = os.getcwd() 83 | os.chdir(path) 84 | try: 85 | yield 86 | finally: 87 | os.chdir(cwd) 88 | -------------------------------------------------------------------------------- /script/patch.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """ 3 | Usage: patch -h 4 | 5 | Use this script to selectively apply and reverse patches. 6 | It is mostly useful to fix patches during upgrades to a new Chromium version. 7 | """ 8 | 9 | import argparse 10 | import os 11 | import subprocess 12 | import sys 13 | 14 | import lib.git as git 15 | from lib.patches import Patch, PatchesList, PatchesConfig 16 | 17 | 18 | def main(): 19 | args = parse_args() 20 | 21 | directory = args.directory 22 | force = args.force 23 | patches = args.patch 24 | project_root = args.project_root 25 | repo = args.repo 26 | reverse = args.reverse 27 | 28 | if directory: 29 | (success, failed_patches) = apply_patches_from_directory(directory, project_root, force, reverse) 30 | else: 31 | (success, failed_patches) = apply_patches(repo, patches, force, reverse) 32 | 33 | if success: 34 | print 'Done: All patches applied.' 35 | else: 36 | failed_patches_paths = [p.get_file_path() for p in failed_patches] 37 | print 'Error: {0} patch(es) failed:\n{1}'.format(len(failed_patches), '\n'.join(failed_patches_paths)) 38 | 39 | return 0 if success else 1 40 | 41 | 42 | def apply_patches(repo_path, patches_paths, force=False, reverse=False): 43 | absolute_repo_path = os.path.abspath(repo_path) 44 | patches = [Patch(os.path.abspath(patch_path), absolute_repo_path) for patch_path in patches_paths] 45 | patches_list = PatchesList(repo_path=absolute_repo_path, patches=patches) 46 | stop_on_error = not force 47 | return patches_list.apply(reverse=reverse, stop_on_error=stop_on_error) 48 | 49 | 50 | def apply_patches_from_directory(directory, project_root, force=False, reverse=False): 51 | config = PatchesConfig.from_directory(directory, project_root=project_root) 52 | patches_list = config.get_patches_list() 53 | 54 | # Notify user if we didn't find any patch files. 55 | if patches_list is None or len(patches_list) == 0: 56 | print 'Warning: No patches found in the "{0}" folder.'.format(directory) 57 | return (True, []) 58 | 59 | # Then try to apply patches. 60 | stop_on_error = not force 61 | return patches_list.apply(reverse=reverse, stop_on_error=stop_on_error) 62 | 63 | 64 | def parse_args(): 65 | parser = argparse.ArgumentParser(description='Apply patches to a git repo') 66 | parser.add_argument('-f', '--force', default=False, action='store_true', 67 | help='Do not stop on the first failed patch.') 68 | parser.add_argument('--project-root', required=False, default=git.get_repo_root(os.path.abspath(__file__)), 69 | help='Parent folder to resolve repos relative paths against') 70 | parser.add_argument('-R', '--reverse', default=False, action='store_true', help='Apply patches in reverse.') 71 | parser.add_argument('-r', '--repo', help='Path to a repository root folder.') 72 | 73 | paths_group = parser.add_mutually_exclusive_group(required=True) 74 | paths_group.add_argument('-d', '--directory', 75 | help='Path to a directory with patches. If present, -p/--patch is ignored.') 76 | paths_group.add_argument('-p', '--patch', nargs='*', help='Path(s) to a patch file(s).') 77 | 78 | args = parser.parse_args() 79 | 80 | # Additional rules. 81 | if args.patch is not None and args.repo is None: 82 | parser.error("Repository path (-r/--repo) is required when you supply patches list.") 83 | 84 | return args 85 | 86 | 87 | if __name__ == '__main__': 88 | sys.exit(main()) 89 | -------------------------------------------------------------------------------- /script/run-gn: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import argparse 4 | import json 5 | import os 6 | import sys 7 | 8 | import lib.gn as gn 9 | 10 | from lib.config import get_output_dir, COMPONENTS, \ 11 | SOURCE_ROOT, SRC_DIR, DEPOT_TOOLS_DIR 12 | 13 | 14 | # TODO(alexeykuzmin): There are no reasons to keep args files 15 | # in the "chromiumcontent" folder. 16 | CHROMIUMCONTENT_SOURCE_DIR = os.path.join(SOURCE_ROOT, 'chromiumcontent') 17 | 18 | 19 | def parse_args(): 20 | parser = argparse.ArgumentParser(description='Generate Ninja') 21 | 22 | parser.add_argument('-a', '--args', type=json.loads, default=None, 23 | help='List of GN args in JSON format. E.g. \'{"key": "value"}\'') 24 | parser.add_argument('-c', '--components', nargs='+', default=COMPONENTS, choices=COMPONENTS, 25 | help='Component(s) to generate build files for.') 26 | parser.add_argument('-t', '--target_arch', default='x64', help='E.g. "x64".') 27 | parser.add_argument('-v', '--verbose', action='store_true', help='Prints verbose output') 28 | 29 | return parser.parse_args() 30 | 31 | 32 | def main(): 33 | args = parse_args() 34 | 35 | # List of common default GN config args. Please keep in alphabetical order. 36 | # Any value can be overridden by the '--args' script argument. 37 | gn_args = { 38 | 'target_cpu': get_target_cpu(args.target_arch), 39 | 'target_os': get_target_os() 40 | } 41 | # Add new and override default args from a command line argument. 42 | if args.args: 43 | gn_args.update(args.args) 44 | 45 | for component in args.components: 46 | if component != 'native_mksnapshot' or 'arm' in args.target_arch: 47 | generate_build_files(component, args.target_arch, args.verbose, **gn_args) 48 | 49 | 50 | def generate_build_files(component, target_arch, verbose, **gnargs): 51 | print 'Generating build files for "{0}" configuration...'.format(component) 52 | 53 | build_dir = get_output_dir(SOURCE_ROOT, target_arch, component) 54 | create_gn_config(component, build_dir, **gnargs) 55 | 56 | env = os.environ.copy() 57 | if sys.platform in ['win32', 'cygwin']: 58 | env['DEPOT_TOOLS_WIN_TOOLCHAIN'] = '0' 59 | 60 | gn.generate(build_dir, chromium_root_dir=SRC_DIR, depot_tools_dir=DEPOT_TOOLS_DIR, env=env, verbose=verbose) 61 | 62 | 63 | def create_gn_config(component, build_dir, **gnargs): 64 | args_file_path = os.path.join(CHROMIUMCONTENT_SOURCE_DIR, 'args', component + '.gn') 65 | with open(args_file_path) as f: 66 | gn.create_args(build_dir, f.read(), **gnargs) 67 | 68 | 69 | def get_target_os(): 70 | target_os = { 71 | "cygwin": "win", 72 | "darwin": "mac", 73 | "linux2": "linux", 74 | "win32": "win", 75 | }.get(sys.platform) 76 | 77 | return target_os 78 | 79 | 80 | def get_target_cpu(target_arch): 81 | target_cpu = target_arch 82 | if target_arch == 'ia32': 83 | target_cpu = 'x86' 84 | 85 | return target_cpu 86 | 87 | 88 | if __name__ == '__main__': 89 | sys.exit(main()) 90 | -------------------------------------------------------------------------------- /script/run_tests: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import argparse 4 | import os 5 | import platform 6 | import re 7 | import sys 8 | import subprocess 9 | 10 | from lib.config import get_output_dir, VENDOR_DIR 11 | 12 | PYYAML_LIB_DIR = os.path.join(VENDOR_DIR, 'pyyaml', 'lib') 13 | sys.path.append(PYYAML_LIB_DIR) 14 | import yaml 15 | 16 | SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) 17 | if sys.platform in ['win32', 'cygwin']: 18 | BINARY_TEST_REGEX = re.compile(r'_(unit|browser)?tests(\.exe)?$', re.IGNORECASE) 19 | else: 20 | BINARY_TEST_REGEX = re.compile(r'_(unit|browser)?tests$') 21 | 22 | def GetTestsToRun(args): 23 | build_dir = get_output_dir(SOURCE_ROOT, args.target_arch, 'tests') 24 | tests = [] 25 | if args.only is None: 26 | for file_name in os.listdir(build_dir): 27 | if args.exclude and file_name in args.exclude: 28 | continue 29 | if re.search(BINARY_TEST_REGEX, file_name): 30 | tests.append(os.path.join(build_dir, file_name)) 31 | else: 32 | for test_name in args.only: 33 | if args.exclude and test_name in args.exclude: 34 | continue 35 | test_file = os.path.join(build_dir, test_name) 36 | if os.path.isfile(test_file): 37 | tests.append(test_file) 38 | else: 39 | print 'Invalid test target name: ' + test_name 40 | return tests 41 | 42 | def RunTests(binary_tests, generate_report): 43 | if binary_tests: 44 | disabled_tests_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'disabled-tests.yaml') 45 | disabled_tests = {} 46 | if os.path.isfile(disabled_tests_path): 47 | disabled_tests = yaml.load(file(disabled_tests_path, 'r')) 48 | else: 49 | print 'No disabled-tests.yaml file found. Not excluding any tests.' 50 | results = [] 51 | for test in binary_tests: 52 | test_args = [test] 53 | test_name = os.path.basename(test) 54 | if disabled_tests and test_name in disabled_tests and disabled_tests[test_name]: 55 | exclusion_filter = '-' + ':'.join(disabled_tests[test_name]) 56 | test_args.append('--gtest_filter=%s' % exclusion_filter) 57 | # Add reporting path if enabled 58 | if generate_report: 59 | test_args.append("--gtest_output=xml:" + get_output_file_path(test_name)) 60 | results.append((os.path.basename(test), 61 | subprocess.call(test_args) == 0)) 62 | failed = [test 63 | for (test, success) in results 64 | if not success] 65 | print '%d tests run.' % len(results) 66 | if failed: 67 | print 'The following %d tests failed:' % len(failed) 68 | for test in failed: 69 | print test 70 | return 1 71 | else: 72 | print 'All tests passed!' 73 | else: 74 | print 'Nothing to test - no tests found!' 75 | return 0 76 | 77 | def get_output_file_path(test_name): 78 | return os.path.join(SOURCE_ROOT, 'test_reports', test_name + os.path.extsep + 'xml') 79 | 80 | def main(): 81 | parser = argparse.ArgumentParser(description='Run Chromium tests') 82 | parser.add_argument('-t', '--target_arch', default='x64', help='x64 or ia32') 83 | parser.add_argument('--only', nargs='+', help='Names of the test targets to run. For example: base_unittests url_unittests') 84 | parser.add_argument('--exclude', nargs='+', help='Names of the test targets to exclude. For example: base_unittests url_unittests') 85 | parser.add_argument('--generate_report', action='store_true', help='Generate xml reports for test runs. Mainly for CI.') 86 | args = parser.parse_args() 87 | tests = GetTestsToRun(args) 88 | return RunTests(tests, args.generate_report) 89 | 90 | if __name__ == '__main__': 91 | sys.exit(main()) 92 | -------------------------------------------------------------------------------- /script/sccache: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import argparse 4 | import os 5 | import sys 6 | 7 | import lib.sccache as sccache 8 | 9 | 10 | def parse_args(): 11 | parser = argparse.ArgumentParser(description='Run sccache`') 12 | 13 | parser.add_argument('--azure_container', help='Name of azure container to use') 14 | parser.add_argument('--azure_connection', help='Name of azure connection to use') 15 | 16 | local_args, sccache_args = parser.parse_known_args() 17 | return local_args, sccache_args 18 | 19 | 20 | def main(): 21 | local_args, sccache_args = parse_args() 22 | 23 | if local_args.azure_container: 24 | os.environ['SCCACHE_AZURE_BLOB_CONTAINER'] = local_args.azure_container 25 | 26 | if local_args.azure_connection: 27 | os.environ['SCCACHE_AZURE_CONNECTION_STRING'] = local_args.azure_connection 28 | 29 | return sccache.run(*sccache_args) 30 | 31 | 32 | if __name__ == '__main__': 33 | sys.exit(main()) 34 | -------------------------------------------------------------------------------- /script/upload: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import argparse 4 | import glob 5 | import os 6 | import platform 7 | import subprocess 8 | import sys 9 | 10 | import lib.git as git 11 | 12 | from lib.config import PLATFORM_KEY 13 | 14 | SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) 15 | BOTO_DIR = os.path.join(SOURCE_ROOT, 'vendor', 'boto') 16 | 17 | def main(): 18 | args = parse_args() 19 | 20 | try: 21 | upload(args) 22 | except AssertionError as e: 23 | return e.message 24 | 25 | 26 | def parse_args(): 27 | parser = argparse.ArgumentParser(description='Upload distribution') 28 | parser.add_argument('-t', '--target_arch', default='x64', help='x64 or ia32') 29 | parser.add_argument('--upload_packaged_src', action='store_true', 30 | help='Upload packaged source to s3') 31 | parser.add_argument('--chromium_version', 32 | help='Chromium version for uploading packaged source to s3') 33 | return parser.parse_args() 34 | 35 | 36 | def upload(args): 37 | os.chdir(SOURCE_ROOT) 38 | bucket, access_key, secret_key = s3_config() 39 | commit = git.get_head_commit(SOURCE_ROOT) 40 | 41 | if os.environ.has_key('MAS_BUILD'): 42 | platform = 'mas' 43 | else: 44 | platform = PLATFORM_KEY 45 | 46 | if args.upload_packaged_src: 47 | upload_files = ['src.tar.bz2'] 48 | s3put(bucket, access_key, secret_key, SOURCE_ROOT, 49 | 'libchromiumcontent/{0}/src/{1}'.format(PLATFORM_KEY, args.chromium_version), 50 | upload_files) 51 | else: 52 | upload_files = glob.glob('libchromiumcontent*.tar.bz2') + glob.glob('native-mksnapshot.tar.bz2') 53 | s3put(bucket, access_key, secret_key, SOURCE_ROOT, 54 | 'libchromiumcontent/{0}/{1}/{2}'.format(platform, args.target_arch, commit), 55 | upload_files) 56 | 57 | 58 | def s3_config(): 59 | config = (os.environ.get('LIBCHROMIUMCONTENT_S3_BUCKET', ''), 60 | os.environ.get('LIBCHROMIUMCONTENT_S3_ACCESS_KEY', ''), 61 | os.environ.get('LIBCHROMIUMCONTENT_S3_SECRET_KEY', '')) 62 | message = ('Error: Please set the $LIBCHROMIUMCONTENT_S3_BUCKET, ' 63 | '$LIBCHROMIUMCONTENT_S3_ACCESS_KEY, and ' 64 | '$LIBCHROMIUMCONTENT_S3_SECRET_KEY environment variables') 65 | assert all(len(c) for c in config), message 66 | return config 67 | 68 | 69 | def boto_path_dirs(): 70 | return [ 71 | os.path.join(BOTO_DIR, 'build', 'lib'), 72 | os.path.join(BOTO_DIR, 'build', 'lib.linux-x86_64-2.7') 73 | ] 74 | 75 | 76 | def run_boto_script(access_key, secret_key, script_name, *args): 77 | env = os.environ.copy() 78 | env['AWS_ACCESS_KEY_ID'] = access_key 79 | env['AWS_SECRET_ACCESS_KEY'] = secret_key 80 | env['PYTHONPATH'] = os.path.pathsep.join( 81 | [env.get('PYTHONPATH', '')] + boto_path_dirs()) 82 | 83 | boto = os.path.join(BOTO_DIR, 'bin', script_name) 84 | subprocess.check_call([sys.executable, boto] + list(args), env=env) 85 | 86 | 87 | def s3put(bucket, access_key, secret_key, prefix, key_prefix, files): 88 | args = [ 89 | '--bucket', bucket, 90 | '--prefix', prefix, 91 | '--key_prefix', key_prefix, 92 | '--multipart', 93 | '--grant', 'public-read' 94 | ] + files 95 | 96 | run_boto_script(access_key, secret_key, 's3put', *args) 97 | 98 | 99 | if __name__ == '__main__': 100 | sys.exit(main()) 101 | -------------------------------------------------------------------------------- /tools/copy.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import shutil 3 | 4 | 5 | def parse_args(): 6 | parser = argparse.ArgumentParser(description='Copy file') 7 | parser.add_argument('source') 8 | parser.add_argument('destination') 9 | return parser.parse_args() 10 | 11 | 12 | def main(): 13 | args = parse_args() 14 | shutil.copy2(args.source, args.destination) 15 | 16 | 17 | if __name__ == '__main__': 18 | main() 19 | -------------------------------------------------------------------------------- /tools/generate_filenames_gypi.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import glob 4 | import os 5 | import re 6 | import sys 7 | 8 | 9 | TARGET_PLATFORM = { 10 | 'cygwin': 'win32', 11 | 'darwin': 'darwin', 12 | 'linux2': 'linux', 13 | 'win32': 'win32', 14 | }[sys.platform] 15 | 16 | SHARED_LIBRARY_SUFFIX = { 17 | 'darwin': 'dylib', 18 | 'linux': 'so', 19 | 'win32': 'dll', 20 | }[TARGET_PLATFORM] 21 | STATIC_LIBRARY_SUFFIX = { 22 | 'darwin': 'a', 23 | 'linux': 'a', 24 | 'win32': 'lib', 25 | }[TARGET_PLATFORM] 26 | 27 | EXCLUDE_SHARED_LIBRARIES = { 28 | 'darwin': [ 29 | 'libpepper_flash.dylib', 30 | 'libwidevinecdm.dylib', 31 | ], 32 | 'linux': [ 33 | 'libpepper_flash.so', 34 | 'libwidevinecdm.so', 35 | 'libwidevinecdmadapter.so', 36 | ], 37 | 'win32': [ 38 | 'd3dcompiler_47.dll', 39 | 'libEGL.dll', 40 | 'libGLESv2.dll', 41 | 'pepper_flash.dll', 42 | 'widevinecdm.dll', 43 | 'widevinecdmadapter.dll', 44 | ], 45 | }[TARGET_PLATFORM] 46 | EXCLUDE_STATIC_LIBRARIES = { 47 | 'darwin': [ 48 | 'libffmpeg_yasm.a', 49 | 'libpepper_flash.a', 50 | 'libppapi_cpp.a', 51 | 'libv8_nosnapshot.a', 52 | ], 53 | 'linux': [ 54 | 'libffmpeg_yasm.a', 55 | 'libpepper_flash.a', 56 | 'libppapi_cpp.a', 57 | 'libprotobuf_full_do_not_use.a', 58 | 'libgenperf_libs.a', 59 | 'libv8_nosnapshot.a', 60 | 'libtranslator_static.a', 61 | ], 62 | 'win32': [ 63 | 'ffmpeg.dll.lib', 64 | 'ffmpeg_yasm.lib', 65 | 'libEGL.dll.lib', 66 | 'libGLESv2.dll.lib', 67 | 'pepper_flash.lib', 68 | 'ppapi_cpp.lib', 69 | 'widevinecdm.dll.lib', 70 | 'widevinecdmadapter.dll.lib', 71 | ], 72 | }[TARGET_PLATFORM] 73 | 74 | GYPI_TEMPLATE = """\ 75 | { 76 | 'variables': { 77 | 'libchromiumcontent_src_dir': %(src)s, 78 | 'libchromiumcontent_shared_libraries_dir': %(shared_libraries_dir)s, 79 | 'libchromiumcontent_static_libraries_dir': %(static_libraries_dir)s, 80 | 'libchromiumcontent_shared_libraries': %(shared_libraries)s, 81 | 'libchromiumcontent_shared_v8_libraries': %(shared_v8_libraries)s, 82 | 'libchromiumcontent_static_libraries': %(static_libraries)s, 83 | 'libchromiumcontent_static_v8_libraries': %(static_v8_libraries)s, 84 | }, 85 | } 86 | """ 87 | 88 | 89 | def main(target_file, code_dir, shared_dir, static_dir): 90 | (shared_libraries, shared_v8_libraries) = find_libraries( 91 | shared_dir, SHARED_LIBRARY_SUFFIX, EXCLUDE_SHARED_LIBRARIES) 92 | (static_libraries, static_v8_libraries) = find_libraries( 93 | static_dir, STATIC_LIBRARY_SUFFIX, EXCLUDE_STATIC_LIBRARIES) 94 | content = GYPI_TEMPLATE % { 95 | 'src': repr(os.path.abspath(code_dir)), 96 | 'shared_libraries_dir': repr(os.path.abspath(shared_dir)), 97 | 'static_libraries_dir': repr(os.path.abspath(static_dir)), 98 | 'shared_libraries': shared_libraries, 99 | 'shared_v8_libraries': shared_v8_libraries, 100 | 'static_libraries': static_libraries, 101 | 'static_v8_libraries': static_v8_libraries, 102 | } 103 | with open(target_file, 'wb+') as f: 104 | f.write(content) 105 | 106 | 107 | def find_libraries(dirpath, library_suffix, list_of_excludes): 108 | libraries = glob.glob(os.path.join(dirpath, '*.' + library_suffix)) 109 | if (library_suffix == 'so'): 110 | # Handle "libname.so.123" 111 | libraries += find_files_by_regex(dirpath, re.compile('.*\.so\.[0-9]+')) 112 | 113 | libraries = [lib 114 | for lib in libraries 115 | if os.path.basename(lib) not in list_of_excludes 116 | ] 117 | 118 | v8_libraries = [lib 119 | for lib in libraries 120 | if is_v8_library(lib) 121 | ] 122 | other_libraries = [lib 123 | for lib in libraries 124 | if lib not in v8_libraries 125 | ] 126 | 127 | return ( 128 | [os.path.abspath(l) for l in other_libraries], 129 | [os.path.abspath(l) for l in v8_libraries] 130 | ) 131 | 132 | 133 | def find_files_by_regex(dirpath, regex): 134 | files_found = [] 135 | 136 | for root, dirs, files in os.walk(dirpath): 137 | for file in files: 138 | if regex.match(file): 139 | files_found.append(os.path.join(root, file)) 140 | 141 | return files_found 142 | 143 | 144 | def is_v8_library(p): 145 | return (os.path.basename(p).startswith(('v8', 'libv8')) or 146 | os.path.basename(p).startswith(('icu', 'libicu'))) 147 | 148 | 149 | if __name__ == '__main__': 150 | sys.exit(main(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])) 151 | -------------------------------------------------------------------------------- /tools/linux/ar-combine.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | usage() { 4 | echo "Usage:" 1>&2 5 | echo " $0 -o output.a input1.a [input2.a [...]]" 6 | exit 7 | } 8 | 9 | if [ "$1" != "-o" ]; then usage; fi 10 | shift 11 | DEST="$1" 12 | shift 13 | if [ $# = 0 ]; then usage; fi 14 | 15 | SCRATCH="ar-combine.$$" 16 | mkdir "$SCRATCH" 17 | 18 | for LIB in "$@"; do 19 | if [ "`head -c7 "$LIB"`" = "!" ]; then 20 | ar t "$LIB" | while read OBJ; do 21 | cp "$OBJ" "$SCRATCH" 22 | done 23 | else 24 | LIB="`readlink -e "$LIB"`" 25 | (cd "$SCRATCH" ; ar x "$LIB") 26 | fi 27 | done 28 | 29 | ar rcs "$DEST" "$SCRATCH"/* > /dev/null 2>&1 30 | rm -r "$SCRATCH" 31 | -------------------------------------------------------------------------------- /tools/sccache/README.md: -------------------------------------------------------------------------------- 1 | ## sccache 2 | 3 | Shared Compilation Cache 4 | https://github.com/mozilla/sccache 5 | 6 | ### Building a portable binary version on Mac 7 | 8 | The goal is to build a binary that would not require `openssl` to be installed in the system. The project's docs provide [build instructions](https://github.com/mozilla/sccache#building-portable-binaries) for that but they're quite laconic. 9 | 10 | 1. Install `rust` version `[1.22.0, 1.25.0)`, `1.22.1` works well. See [mozilla/sccache#233](https://github.com/mozilla/sccache/issues/233) for the explanation of the versions range. 11 | Old versions might not be available via [Homebrew](https://brew.sh) but `brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/2b57a70c4bb1ac9bec3e6de1beda98f5dafcdf7c/Formula/rust.rb` should work (it will install `rust@1.22.1`). 12 | 2. Clone the repo: 13 | `git clone https://github.com/mozilla/sccache.git` 14 | 3. `cd sccache` 15 | 4. Checkout version aad212037ce6340839686da8a1bdf5455b143b1c: 16 | `git fetch --tags && git checkout aad212037ce6340839686da8a1bdf5455b143b1c` 17 | 5. `export OPENSSL_STATIC=yes` 18 | 6. Build the project in a release mode: 19 | `cargo build --release`. 20 | 7. Resulting `sccache` binary will appear in the `./target/release/`. 21 | -------------------------------------------------------------------------------- /tools/sccache/aad2120/linux/sccache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/electron/libchromiumcontent/768f52340da3a67a68fb138683909b8b292f470c/tools/sccache/aad2120/linux/sccache -------------------------------------------------------------------------------- /tools/sccache/aad2120/mac/sccache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/electron/libchromiumcontent/768f52340da3a67a68fb138683909b8b292f470c/tools/sccache/aad2120/mac/sccache -------------------------------------------------------------------------------- /tools/sccache/aad2120/windows/sccache.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/electron/libchromiumcontent/768f52340da3a67a68fb138683909b8b292f470c/tools/sccache/aad2120/windows/sccache.exe --------------------------------------------------------------------------------