diff --git a/patches/common/chromium/.patches.yaml b/patches/common/chromium/.patches.yaml index 30be3e3aadd..24829e78973 100644 --- a/patches/common/chromium/.patches.yaml +++ b/patches/common/chromium/.patches.yaml @@ -314,12 +314,6 @@ patches: file: scroll_bounce_flag.patch description: | Patch to make scrollBounce option work. -- - author: Birunthan Mohanathas - file: backport_d65792a.patch - description: | - https://chromium-review.googlesource.com/c/chromium/src/+/1105698 - Fixes https://github.com/electron/electron/issues/13256 - author: Cheng Zhao file: webview_reattach.patch @@ -447,18 +441,10 @@ patches: description: backport of crashpad f540abb506 - author: Jeremy Apthorp - file: backport_cd7154e0bb5.patch - description: Support macosx 10.14 SDK -- - author: Shelley Vohr - file: fix_xcode_ten.patch + file: expose-net-observer-api.patch description: | - Backports 27f9cbd8, a commit which does the following - - * Removes IDEBundleInjection.framework from egtests. - * Corrects the DTXcode generation function to handle leading '10'. - * Fixes a main_application_delegate SDK change - * Fixes a non-null SDK change in a net unittest. - This is needed for Electron to compile with XCode 10.0. + Expose URLRequestContextGetter::{Add,Remove}Observer. + This patch should be removed once we switch to using the net service (cc @robo) - author: deepak1556 file: desktop_media_list.patch @@ -467,22 +453,6 @@ patches: desktop capture api. * Backports https://chromium-review.googlesource.com/c/chromium/src/+/1199806 that fixes crash with screen capturer, can be removed in 71.0.3539.0 -- - author: Jeremy Apthorp - file: expose-net-observer-api.patch - description: | - Expose URLRequestContextGetter::{Add,Remove}Observer. - This patch should be removed once we switch to using the net service (cc @robo) -- - author: Aleksei Kuzmin - file: backport_7167a9eac.patch - description: | - "viz: Remove the global ServerSharedBitmapManager." - https://chromium-review.googlesource.com/802574 - Landed in 69.0.3447.0. - See https://github.com/electron/electron/issues/14327 - (Android specific changes and changes in some test files - have been removed from the diff.) - author: deepak1556 file: proxy_config_monitor.patch diff --git a/patches/common/chromium/accelerator.patch b/patches/common/chromium/accelerator.patch index 90834215096..20b0d45cc3d 100644 --- a/patches/common/chromium/accelerator.patch +++ b/patches/common/chromium/accelerator.patch @@ -1,5 +1,11 @@ +From 61cd6b5bc2068a3740313d7f4680ef3fcaaacb1a Mon Sep 17 00:00:00 2001 +From: Cheng Zhao +Date: Thu, 4 Oct 2018 14:57:02 -0700 +Subject: accelerator.patch + + diff --git a/ui/base/accelerators/accelerator.cc b/ui/base/accelerators/accelerator.cc -index a6756c20f22c..53529588af27 100644 +index 7e55ef366ac8..c3fb98b426cd 100644 --- a/ui/base/accelerators/accelerator.cc +++ b/ui/base/accelerators/accelerator.cc @@ -11,6 +11,7 @@ @@ -20,7 +26,7 @@ index a6756c20f22c..53529588af27 100644 namespace ui { -@@ -145,7 +144,15 @@ base::string16 Accelerator::GetShortcutText() const { +@@ -139,7 +138,15 @@ base::string16 Accelerator::GetShortcutText() const { shortcut = KeyCodeToName(key_code_); #endif @@ -36,7 +42,7 @@ index a6756c20f22c..53529588af27 100644 #if defined(OS_WIN) // Our fallback is to try translate the key code to a regular character // unless it is one of digits (VK_0 to VK_9). Some keyboard -@@ -154,17 +161,20 @@ base::string16 Accelerator::GetShortcutText() const { +@@ -148,17 +155,20 @@ base::string16 Accelerator::GetShortcutText() const { // accent' for '0'). For display in the menu (e.g. Ctrl-0 for the // default zoom level), we leave VK_[0-9] alone without translation. wchar_t key; @@ -67,15 +73,7 @@ index a6756c20f22c..53529588af27 100644 #endif } -@@ -221,15 +231,15 @@ base::string16 Accelerator::GetShortcutText() const { - - base::string16 Accelerator::ApplyLongFormModifiers( - base::string16 shortcut) const { - if (IsShiftDown()) - shortcut = l10n_util::GetStringFUTF16(IDS_APP_SHIFT_MODIFIER, shortcut); - - // Note that we use 'else-if' in order to avoid using Ctrl+Alt as a shortcut. - // See http://blogs.msdn.com/oldnewthing/archive/2004/03/29/101121.aspx for +@@ -223,7 +233,7 @@ base::string16 Accelerator::ApplyLongFormModifiers( // more information. if (IsCtrlDown()) shortcut = l10n_util::GetStringFUTF16(IDS_APP_CONTROL_MODIFIER, shortcut); @@ -84,7 +82,7 @@ index a6756c20f22c..53529588af27 100644 shortcut = l10n_util::GetStringFUTF16(IDS_APP_ALT_MODIFIER, shortcut); if (IsCmdDown()) { -@@ -249,14 +256,12 @@ base::string16 Accelerator::ApplyShortFormModifiers( +@@ -243,14 +253,12 @@ base::string16 Accelerator::ApplyShortFormModifiers( base::string16 shortcut) const { const base::char16 kCommandSymbol[] = {0x2318, 0}; const base::char16 kCtrlSymbol[] = {0x2303, 0}; @@ -99,3 +97,6 @@ index a6756c20f22c..53529588af27 100644 parts.push_back(base::string16(IsCmdDown() ? kCommandSymbol : kNoSymbol)); parts.push_back(shortcut); return base::StrCat(parts); +-- +2.17.0 + diff --git a/patches/common/chromium/add_atomic_lib_to_dependencies_even_for_sysroot_builds.patch b/patches/common/chromium/add_atomic_lib_to_dependencies_even_for_sysroot_builds.patch index 5d54f789ebc..09b6f92d392 100644 --- a/patches/common/chromium/add_atomic_lib_to_dependencies_even_for_sysroot_builds.patch +++ b/patches/common/chromium/add_atomic_lib_to_dependencies_even_for_sysroot_builds.patch @@ -1,13 +1,22 @@ +From e686584a3758c1954f31e107746b40c6a63ad776 Mon Sep 17 00:00:00 2001 +From: Aleksei Kuzmin +Date: Thu, 20 Sep 2018 17:47:36 -0700 +Subject: add_atomic_lib_to_dependencies_even_for_sysroot_builds.patch + + diff --git a/base/BUILD.gn b/base/BUILD.gn -index 943412faefd7..c505df950b2b 100644 +index 7fb93868d6e0..53c5744953da 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn -@@ -1217,7 +1217,7 @@ jumbo_component("base") { +@@ -1248,7 +1248,7 @@ jumbo_component("base") { # Needed for if using newer C++ library than sysroot, except if # building inside the cros_sdk environment - use host_toolchain as a # more robust check for this. - if (!use_sysroot && (is_android || (is_linux && !is_chromecast)) && + if ((is_android || (is_linux && !is_chromecast)) && host_toolchain != "//build/toolchain/cros:host") { - libs = [ "atomic" ] + libs += [ "atomic" ] } +-- +2.17.0 + diff --git a/patches/common/chromium/add_realloc.patch b/patches/common/chromium/add_realloc.patch index 310106e7a70..8195b89f572 100644 --- a/patches/common/chromium/add_realloc.patch +++ b/patches/common/chromium/add_realloc.patch @@ -1,3 +1,16 @@ +From 0e2864c50cb039dd2f8d9b9cc88ae26f5bd62581 Mon Sep 17 00:00:00 2001 +From: Shelley Vohr +Date: Thu, 20 Sep 2018 17:44:26 -0700 +Subject: add_realloc.patch + +Blink overrides ArrayBuffer's allocator with its own one, while Node simply +uses malloc and free, so we need to use v8's allocator in Node. As part of the +10.6.0 upgrade, we needed to make SerializerDelegate accept an allocator +argument in its constructor, and override ReallocateBufferMemory and +FreeBufferMemory to use the allocator. We cannot simply allocate and then memcpy +when we override ReallocateBufferMemory, so we therefore need to implement +Realloc on the v8 side and correspondingly in gin. + diff --git a/gin/array_buffer.cc b/gin/array_buffer.cc index f84934bfd712..fc23fef68b6f 100644 --- a/gin/array_buffer.cc @@ -26,10 +39,10 @@ index 2aef366ac819..3c7d66c81032 100644 GIN_EXPORT static ArrayBufferAllocator* SharedInstance(); diff --git a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc -index c8c822632a69..d12976b3cd01 100644 +index 83a6639306a9..8511e7d594ce 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc -@@ -619,6 +619,10 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { +@@ -665,6 +665,10 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { size, WTF::ArrayBufferContents::kDontInitialize); } @@ -68,3 +81,6 @@ index 809229caa872..6248ad32d6b0 100644 static void FreeMemory(void*); static DataHandle CreateDataHandle(size_t, InitializationPolicy); static void Initialize( +-- +2.17.0 + diff --git a/patches/common/chromium/allow_nested_error_trackers.patch b/patches/common/chromium/allow_nested_error_trackers.patch index 17bae92aa8a..bdcef9c69cd 100644 --- a/patches/common/chromium/allow_nested_error_trackers.patch +++ b/patches/common/chromium/allow_nested_error_trackers.patch @@ -1,3 +1,24 @@ +From 602c08e90102a25894a4d48d236258cae6b982c6 Mon Sep 17 00:00:00 2001 +From: Charles Kerr +Date: Thu, 20 Sep 2018 17:50:17 -0700 +Subject: allow_nested_error_trackers.patch + +Only one X11ErrorTracker should exist at a time, but upstream has a bug +where two can exist if running in headless mode -- + ui::(anonymous namespace)::SupportsEWMH() [inner tracker is created] + ui::WmSupportsHint() + ui::IsX11WindowFullScreen() + ui::ScreensaverWindowFinder::IsScreensaverWindow() + ui::ScreensaverWindowFinder::ShouldStopIterating() + ui::EnumerateTopLevelWindows() + ui::ScreensaverWindowFinder::ScreensaverWindowExists() [outer tracker created] + ui::CheckIdleStateIsLocked() + ui::CalculateIdleState() +Removal of either tracker could have side-effects in some code paths, +so this is probably better handled upstream. This patch tries to do the +least harm in the interim by removing the check that prevents more than +one tracker from existing at a time. + diff --git a/ui/gfx/x/x11_error_tracker.cc b/ui/gfx/x/x11_error_tracker.cc index af031de356c5..2a5c18dc473a 100644 --- a/ui/gfx/x/x11_error_tracker.cc @@ -11,3 +32,6 @@ index af031de356c5..2a5c18dc473a 100644 g_handler = this; XSync(GetXDisplay(), False); old_handler_ = XSetErrorHandler(X11ErrorHandler); +-- +2.17.0 + diff --git a/patches/common/chromium/allow_new_privs.patch b/patches/common/chromium/allow_new_privs.patch index 9c12944779a..d72a79085b0 100644 --- a/patches/common/chromium/allow_new_privs.patch +++ b/patches/common/chromium/allow_new_privs.patch @@ -1,8 +1,14 @@ +From 3a68808c9e49e9a249ee9056015e30543747cd00 Mon Sep 17 00:00:00 2001 +From: Ales Pergl +Date: Thu, 20 Sep 2018 17:44:49 -0700 +Subject: allow_new_privs.patch + + diff --git a/base/process/launch.h b/base/process/launch.h -index b4530b755a23..d6f02d9ab2e3 100644 +index 7a2def2ef436..50afeaf5553a 100644 --- a/base/process/launch.h +++ b/base/process/launch.h -@@ -176,7 +176,7 @@ struct BASE_EXPORT LaunchOptions { +@@ -180,7 +180,7 @@ struct BASE_EXPORT LaunchOptions { // By default, child processes will have the PR_SET_NO_NEW_PRIVS bit set. If // true, then this bit will not be set in the new child process. @@ -11,3 +17,6 @@ index b4530b755a23..d6f02d9ab2e3 100644 // Sets parent process death signal to SIGKILL. bool kill_on_parent_death = false; +-- +2.17.0 + diff --git a/patches/common/chromium/allow_webview_file_url.patch b/patches/common/chromium/allow_webview_file_url.patch index 32b17a0ba63..2b3266ed456 100644 --- a/patches/common/chromium/allow_webview_file_url.patch +++ b/patches/common/chromium/allow_webview_file_url.patch @@ -1,8 +1,15 @@ +From 0556b9d98cbc0b786e0a47681bea1593b65660a7 Mon Sep 17 00:00:00 2001 +From: Cheng Zhao +Date: Thu, 20 Sep 2018 17:49:42 -0700 +Subject: allow_webview_file_url.patch + +Allow webview to load non-web URLs. + diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc -index 1c1fb59e02c8..86b87e294336 100644 +index 061ad189c46d..d64ba4f20d49 100644 --- a/content/browser/loader/resource_dispatcher_host_impl.cc +++ b/content/browser/loader/resource_dispatcher_host_impl.cc -@@ -1597,6 +1597,8 @@ void ResourceDispatcherHostImpl::BeginNavigationRequest( +@@ -1488,6 +1488,8 @@ void ResourceDispatcherHostImpl::BeginNavigationRequest( !policy->IsWebSafeScheme(info.common_params.url.scheme()) && !is_external_protocol; @@ -11,3 +18,6 @@ index 1c1fb59e02c8..86b87e294336 100644 if (is_shutdown_ || non_web_url_in_guest) { url_loader_client->OnComplete( network::URLLoaderCompletionStatus(net::ERR_ABORTED)); +-- +2.17.0 + diff --git a/patches/common/chromium/app_indicator_icon_menu.patch b/patches/common/chromium/app_indicator_icon_menu.patch index af3e00a50c6..27b7590ac02 100644 --- a/patches/common/chromium/app_indicator_icon_menu.patch +++ b/patches/common/chromium/app_indicator_icon_menu.patch @@ -1,3 +1,9 @@ +From acf81b764b448b2979792e5d3d97f248030b49bc Mon Sep 17 00:00:00 2001 +From: Anonymous +Date: Thu, 20 Sep 2018 17:44:52 -0700 +Subject: app_indicator_icon_menu.patch + + diff --git a/chrome/browser/ui/libgtkui/app_indicator_icon_menu.cc b/chrome/browser/ui/libgtkui/app_indicator_icon_menu.cc index 40399a35f8d2..1d3a0da948dc 100644 --- a/chrome/browser/ui/libgtkui/app_indicator_icon_menu.cc @@ -11,3 +17,6 @@ index 40399a35f8d2..1d3a0da948dc 100644 ExecuteCommand(model, id); } +-- +2.17.0 + diff --git a/patches/common/chromium/backport_7167a9eac.patch b/patches/common/chromium/backport_7167a9eac.patch deleted file mode 100644 index ffd1ad87ad0..00000000000 --- a/patches/common/chromium/backport_7167a9eac.patch +++ /dev/null @@ -1,1298 +0,0 @@ -diff --git a/components/viz/DEPS b/components/viz/DEPS -index eba179ee3b2f..ce3033f070c1 100644 ---- a/components/viz/DEPS -+++ b/components/viz/DEPS -@@ -6,3 +6,9 @@ include_rules = [ - "+ui/base", - "+ui/gfx", - ] -+ -+specific_include_rules = { -+ ".*_(unittest|perftest|fuzzer)\.cc": [ -+ "+components/viz", -+ ], -+} -diff --git a/components/viz/client/DEPS b/components/viz/client/DEPS -index db90fed94b97..626d4d8b5f11 100644 ---- a/components/viz/client/DEPS -+++ b/components/viz/client/DEPS -@@ -14,6 +14,5 @@ include_rules = [ - specific_include_rules = { - ".*unittest\.cc": [ - "+cc/test", -- "+components/viz/test", - ], - } -diff --git a/components/viz/common/DEPS b/components/viz/common/DEPS -index 7ccd5e03c1eb..8c356af9c666 100644 ---- a/components/viz/common/DEPS -+++ b/components/viz/common/DEPS -@@ -24,7 +24,6 @@ specific_include_rules = { - ], - ".*_unittest\.cc": [ - "+cc/test", -- "+components/viz/test", - "+gpu/ipc/gl_in_process_context.h", - "+media/base", - "+ui/gl", -diff --git a/components/viz/host/DEPS b/components/viz/host/DEPS -index 83389e05a389..b9d508f19a49 100644 ---- a/components/viz/host/DEPS -+++ b/components/viz/host/DEPS -@@ -24,7 +24,4 @@ specific_include_rules = { - "+components/viz/service/frame_sinks/frame_sink_manager_impl.h", - "+components/viz/service/surfaces/surface_manager.h", - ], -- ".*_unittest\.cc": [ -- "+components/viz/test", -- ] - } -diff --git a/components/viz/host/host_frame_sink_manager_unittest.cc b/components/viz/host/host_frame_sink_manager_unittest.cc -index f957e388a5c9..0f91e10691be 100644 ---- a/components/viz/host/host_frame_sink_manager_unittest.cc -+++ b/components/viz/host/host_frame_sink_manager_unittest.cc -@@ -13,6 +13,7 @@ - #include "components/viz/common/surfaces/frame_sink_id.h" - #include "components/viz/common/surfaces/surface_id.h" - #include "components/viz/common/surfaces/surface_info.h" -+#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h" - #include "components/viz/service/frame_sinks/compositor_frame_sink_support.h" - #include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" - #include "components/viz/service/surfaces/surface_manager.h" -@@ -69,7 +70,8 @@ struct RootCompositorFrameSinkData { - // A mock implementation of mojom::FrameSinkManager. - class MockFrameSinkManagerImpl : public FrameSinkManagerImpl { - public: -- MockFrameSinkManagerImpl() = default; -+ explicit MockFrameSinkManagerImpl(SharedBitmapManager* shared_bitmap_manager) -+ : FrameSinkManagerImpl(shared_bitmap_manager) {} - ~MockFrameSinkManagerImpl() override = default; - - // mojom::FrameSinkManager: -@@ -148,6 +150,7 @@ class HostFrameSinkManagerTestBase : public testing::Test { - } - - protected: -+ ServerSharedBitmapManager shared_bitmap_manager_; - std::unique_ptr host_manager_; - std::unique_ptr> manager_impl_; - -@@ -171,7 +174,8 @@ class HostFrameSinkManagerLocalTest : public HostFrameSinkManagerTestBase { - // testing::Test: - void SetUp() override { - manager_impl_ = -- std::make_unique>(); -+ std::make_unique>( -+ &shared_bitmap_manager_); - host_manager_ = std::make_unique(); - - manager_impl_->SetLocalClient(host_manager_.get()); -@@ -195,7 +199,8 @@ class HostFrameSinkManagerRemoteTest : public HostFrameSinkManagerTestBase { - DCHECK(!manager_impl_); - - manager_impl_ = -- std::make_unique>(); -+ std::make_unique>( -+ &shared_bitmap_manager_); - - mojom::FrameSinkManagerPtr frame_sink_manager; - mojom::FrameSinkManagerRequest frame_sink_manager_request = -diff --git a/components/viz/service/DEPS b/components/viz/service/DEPS -index 4ec6497057fc..0f76030dfcb0 100644 ---- a/components/viz/service/DEPS -+++ b/components/viz/service/DEPS -@@ -12,9 +12,3 @@ include_rules = [ - "+ui/latency", - "+ui/ozone/public", - ] -- --specific_include_rules = { -- ".*_unittest\.cc": [ -- "+components/viz/test", -- ] --} -diff --git a/components/viz/service/display/display_unittest.cc b/components/viz/service/display/display_unittest.cc -index e0790451dc8a..d71831e15c53 100644 ---- a/components/viz/service/display/display_unittest.cc -+++ b/components/viz/service/display/display_unittest.cc -@@ -18,11 +18,11 @@ - #include "components/viz/common/quads/render_pass_draw_quad.h" - #include "components/viz/common/quads/solid_color_draw_quad.h" - #include "components/viz/common/quads/surface_draw_quad.h" --#include "components/viz/common/resources/shared_bitmap_manager.h" - #include "components/viz/common/surfaces/frame_sink_id.h" - #include "components/viz/common/surfaces/parent_local_surface_id_allocator.h" - #include "components/viz/service/display/display_client.h" - #include "components/viz/service/display/display_scheduler.h" -+#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h" - #include "components/viz/service/frame_sinks/compositor_frame_sink_support.h" - #include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" - #include "components/viz/service/surfaces/surface.h" -@@ -31,7 +31,6 @@ - #include "components/viz/test/fake_output_surface.h" - #include "components/viz/test/mock_compositor_frame_sink_client.h" - #include "components/viz/test/test_gles2_interface.h" --#include "components/viz/test/test_shared_bitmap_manager.h" - #include "gpu/GLES2/gl2extchromium.h" - #include "testing/gmock/include/gmock/gmock.h" - #include "testing/gtest/include/gtest/gtest.h" -@@ -97,7 +96,8 @@ class TestDisplayScheduler : public DisplayScheduler { - class DisplayTest : public testing::Test { - public: - DisplayTest() -- : support_(std::make_unique( -+ : manager_(&shared_bitmap_manager_), -+ support_(std::make_unique( - nullptr, - &manager_, - kArbitraryFrameSinkId, -@@ -186,11 +186,11 @@ class DisplayTest : public testing::Test { - - void LatencyInfoCapTest(bool over_capacity); - -+ ServerSharedBitmapManager shared_bitmap_manager_; - FrameSinkManagerImpl manager_; - std::unique_ptr support_; - ParentLocalSurfaceIdAllocator id_allocator_; - scoped_refptr task_runner_; -- TestSharedBitmapManager shared_bitmap_manager_; - std::unique_ptr begin_frame_source_; - std::unique_ptr display_; - TestSoftwareOutputDevice* software_output_device_ = nullptr; -diff --git a/components/viz/service/display/surface_aggregator_pixeltest.cc b/components/viz/service/display/surface_aggregator_pixeltest.cc -index 549191558eaf..493ba4987a0a 100644 ---- a/components/viz/service/display/surface_aggregator_pixeltest.cc -+++ b/components/viz/service/display/surface_aggregator_pixeltest.cc -@@ -13,6 +13,7 @@ - #include "components/viz/common/quads/surface_draw_quad.h" - #include "components/viz/common/surfaces/parent_local_surface_id_allocator.h" - #include "components/viz/service/display/surface_aggregator.h" -+#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h" - #include "components/viz/service/frame_sinks/compositor_frame_sink_support.h" - #include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" - #include "components/viz/service/surfaces/surface.h" -@@ -36,7 +37,8 @@ constexpr bool kNeedsSyncPoints = true; - class SurfaceAggregatorPixelTest : public cc::RendererPixelTest { - public: - SurfaceAggregatorPixelTest() -- : support_(std::make_unique( -+ : manager_(&shared_bitmap_manager_), -+ support_(std::make_unique( - nullptr, - &manager_, - kArbitraryRootFrameSinkId, -@@ -51,6 +53,7 @@ class SurfaceAggregatorPixelTest : public cc::RendererPixelTest { - } - - protected: -+ ServerSharedBitmapManager shared_bitmap_manager_; - FrameSinkManagerImpl manager_; - ParentLocalSurfaceIdAllocator allocator_; - std::unique_ptr support_; -diff --git a/components/viz/service/display_embedder/gpu_display_provider.cc b/components/viz/service/display_embedder/gpu_display_provider.cc -index 6f8d1ae7d609..27b68891ead9 100644 ---- a/components/viz/service/display_embedder/gpu_display_provider.cc -+++ b/components/viz/service/display_embedder/gpu_display_provider.cc -@@ -69,6 +69,7 @@ GpuDisplayProvider::GpuDisplayProvider( - GpuServiceImpl* gpu_service_impl, - scoped_refptr gpu_service, - gpu::GpuChannelManager* gpu_channel_manager, -+ ServerSharedBitmapManager* server_shared_bitmap_manager, - bool headless, - bool wait_for_all_pipeline_stages_before_draw) - : restart_id_(restart_id), -@@ -79,6 +80,7 @@ GpuDisplayProvider::GpuDisplayProvider( - std::make_unique( - gpu_channel_manager)), - image_factory_(GetImageFactory(gpu_channel_manager)), -+ server_shared_bitmap_manager_(server_shared_bitmap_manager), - task_runner_(base::ThreadTaskRunnerHandle::Get()), - headless_(headless), - wait_for_all_pipeline_stages_before_draw_( -@@ -195,7 +197,7 @@ std::unique_ptr GpuDisplayProvider::CreateDisplay( - *out_begin_frame_source = std::move(synthetic_begin_frame_source); - - return std::make_unique( -- ServerSharedBitmapManager::current(), renderer_settings, frame_sink_id, -+ server_shared_bitmap_manager_, renderer_settings, frame_sink_id, - std::move(output_surface), std::move(scheduler), task_runner_, - skia_output_surface); - } -diff --git a/components/viz/service/display_embedder/gpu_display_provider.h b/components/viz/service/display_embedder/gpu_display_provider.h -index f714ee18a648..69b46536d378 100644 ---- a/components/viz/service/display_embedder/gpu_display_provider.h -+++ b/components/viz/service/display_embedder/gpu_display_provider.h -@@ -32,6 +32,7 @@ namespace viz { - class Display; - class ExternalBeginFrameControllerImpl; - class GpuServiceImpl; -+class ServerSharedBitmapManager; - class SoftwareOutputDevice; - - // In-process implementation of DisplayProvider. -@@ -42,6 +43,7 @@ class VIZ_SERVICE_EXPORT GpuDisplayProvider : public DisplayProvider { - GpuServiceImpl* gpu_service_impl, - scoped_refptr gpu_service, - gpu::GpuChannelManager* gpu_channel_manager, -+ ServerSharedBitmapManager* server_shared_bitmap_manager, - bool headless, - bool wait_for_all_pipeline_stages_before_draw); - ~GpuDisplayProvider() override; -@@ -68,6 +70,7 @@ class VIZ_SERVICE_EXPORT GpuDisplayProvider : public DisplayProvider { - gpu::GpuChannelManagerDelegate* const gpu_channel_manager_delegate_; - std::unique_ptr gpu_memory_buffer_manager_; - gpu::ImageFactory* const image_factory_; -+ ServerSharedBitmapManager* const server_shared_bitmap_manager_; - - #if defined(OS_WIN) - // Used for software compositing output on Windows. -diff --git a/components/viz/service/display_embedder/server_shared_bitmap_manager.cc b/components/viz/service/display_embedder/server_shared_bitmap_manager.cc -index 5e252917bc0f..142131ce2057 100644 ---- a/components/viz/service/display_embedder/server_shared_bitmap_manager.cc -+++ b/components/viz/service/display_embedder/server_shared_bitmap_manager.cc -@@ -57,9 +57,6 @@ class ServerSharedBitmap : public SharedBitmap { - - } // namespace - --base::LazyInstance::DestructorAtExit -- g_shared_memory_manager = LAZY_INSTANCE_INITIALIZER; -- - ServerSharedBitmapManager::ServerSharedBitmapManager() = default; - - ServerSharedBitmapManager::~ServerSharedBitmapManager() { -@@ -68,10 +65,6 @@ ServerSharedBitmapManager::~ServerSharedBitmapManager() { - DCHECK(handle_map_.empty()); - } - --ServerSharedBitmapManager* ServerSharedBitmapManager::current() { -- return g_shared_memory_manager.Pointer(); --} -- - std::unique_ptr ServerSharedBitmapManager::GetSharedBitmapFromId( - const gfx::Size& size, - ResourceFormat format, -diff --git a/components/viz/service/display_embedder/server_shared_bitmap_manager.h b/components/viz/service/display_embedder/server_shared_bitmap_manager.h -index 578107358506..6055c3875d80 100644 ---- a/components/viz/service/display_embedder/server_shared_bitmap_manager.h -+++ b/components/viz/service/display_embedder/server_shared_bitmap_manager.h -@@ -33,8 +33,6 @@ class VIZ_SERVICE_EXPORT ServerSharedBitmapManager - ServerSharedBitmapManager(); - ~ServerSharedBitmapManager() override; - -- static ServerSharedBitmapManager* current(); -- - // SharedBitmapManager implementation. - std::unique_ptr GetSharedBitmapFromId( - const gfx::Size& size, -diff --git a/components/viz/service/frame_sinks/compositor_frame_sink_support.cc b/components/viz/service/frame_sinks/compositor_frame_sink_support.cc -index a40382267238..fae027adc21a 100644 ---- a/components/viz/service/frame_sinks/compositor_frame_sink_support.cc -+++ b/components/viz/service/frame_sinks/compositor_frame_sink_support.cc -@@ -9,9 +9,9 @@ - - #include "components/viz/common/frame_sinks/begin_frame_source.h" - #include "components/viz/common/quads/compositor_frame.h" -+#include "components/viz/common/resources/shared_bitmap_manager.h" - #include "components/viz/common/surfaces/surface_info.h" - #include "components/viz/service/display/display.h" --#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h" - #include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" - #include "components/viz/service/surfaces/surface.h" - #include "components/viz/service/surfaces/surface_reference.h" -@@ -65,7 +65,7 @@ CompositorFrameSinkSupport::~CompositorFrameSinkSupport() { - // SharedBitmapId that has been reported from the client. Since the client is - // gone that memory can be freed. If we don't then it would leak. - for (const auto& id : owned_bitmaps_) -- ServerSharedBitmapManager::current()->ChildDeletedSharedBitmap(id); -+ frame_sink_manager_->shared_bitmap_manager()->ChildDeletedSharedBitmap(id); - - // No video capture clients should remain after calling - // UnregisterCompositorFrameSinkSupport(). -@@ -254,7 +254,7 @@ void CompositorFrameSinkSupport::SubmitCompositorFrame( - bool CompositorFrameSinkSupport::DidAllocateSharedBitmap( - mojo::ScopedSharedBufferHandle buffer, - const SharedBitmapId& id) { -- if (!ServerSharedBitmapManager::current()->ChildAllocatedSharedBitmap( -+ if (!frame_sink_manager_->shared_bitmap_manager()->ChildAllocatedSharedBitmap( - std::move(buffer), id)) - return false; - -@@ -264,7 +264,7 @@ bool CompositorFrameSinkSupport::DidAllocateSharedBitmap( - - void CompositorFrameSinkSupport::DidDeleteSharedBitmap( - const SharedBitmapId& id) { -- ServerSharedBitmapManager::current()->ChildDeletedSharedBitmap(id); -+ frame_sink_manager_->shared_bitmap_manager()->ChildDeletedSharedBitmap(id); - owned_bitmaps_.erase(id); - } - -diff --git a/components/viz/service/frame_sinks/compositor_frame_sink_support_unittest.cc b/components/viz/service/frame_sinks/compositor_frame_sink_support_unittest.cc -index 9852c9b2f180..c1a68ede915e 100644 ---- a/components/viz/service/frame_sinks/compositor_frame_sink_support_unittest.cc -+++ b/components/viz/service/frame_sinks/compositor_frame_sink_support_unittest.cc -@@ -11,6 +11,7 @@ - #include "components/viz/common/surfaces/frame_sink_id.h" - #include "components/viz/common/surfaces/surface_id.h" - #include "components/viz/common/surfaces/surface_info.h" -+#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h" - #include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" - #include "components/viz/test/begin_frame_args_test.h" - #include "components/viz/test/compositor_frame_helpers.h" -@@ -81,7 +82,8 @@ class MockFrameSinkManagerClient : public mojom::FrameSinkManagerClient { - class CompositorFrameSinkSupportTest : public testing::Test { - public: - CompositorFrameSinkSupportTest() -- : begin_frame_source_(0.f, false), -+ : manager_(&shared_bitmap_manager_), -+ begin_frame_source_(0.f, false), - local_surface_id_(3, kArbitraryToken), - frame_sync_token_(GenTestSyncToken(4)), - consumer_sync_token_(GenTestSyncToken(5)) { -@@ -181,6 +183,7 @@ class CompositorFrameSinkSupportTest : public testing::Test { - } - - protected: -+ ServerSharedBitmapManager shared_bitmap_manager_; - FrameSinkManagerImpl manager_; - MockFrameSinkManagerClient frame_sink_manager_client_; - FakeCompositorFrameSinkClient fake_support_client_; -diff --git a/components/viz/service/frame_sinks/direct_layer_tree_frame_sink_unittest.cc b/components/viz/service/frame_sinks/direct_layer_tree_frame_sink_unittest.cc -index 26f1c30b4842..4b742b4a1f93 100644 ---- a/components/viz/service/frame_sinks/direct_layer_tree_frame_sink_unittest.cc -+++ b/components/viz/service/frame_sinks/direct_layer_tree_frame_sink_unittest.cc -@@ -68,6 +68,7 @@ class DirectLayerTreeFrameSinkTest : public testing::Test { - task_runner_(new cc::OrderedSimpleTaskRunner(now_src_.get(), true)), - display_size_(1920, 1080), - display_rect_(display_size_), -+ frame_sink_manager_(&bitmap_manager_), - support_manager_(&frame_sink_manager_), - context_provider_(TestContextProvider::Create()) { - auto display_output_surface = FakeOutputSurface::Create3d(); -@@ -130,9 +131,9 @@ class DirectLayerTreeFrameSinkTest : public testing::Test { - - const gfx::Size display_size_; - const gfx::Rect display_rect_; -+ TestSharedBitmapManager bitmap_manager_; - FrameSinkManagerImpl frame_sink_manager_; - TestCompositorFrameSinkSupportManager support_manager_; -- TestSharedBitmapManager bitmap_manager_; - TestGpuMemoryBufferManager gpu_memory_buffer_manager_; - - scoped_refptr context_provider_; -diff --git a/components/viz/service/frame_sinks/frame_sink_manager_impl.cc b/components/viz/service/frame_sinks/frame_sink_manager_impl.cc -index d01557f46949..bad389a1e18a 100644 ---- a/components/viz/service/frame_sinks/frame_sink_manager_impl.cc -+++ b/components/viz/service/frame_sinks/frame_sink_manager_impl.cc -@@ -9,6 +9,7 @@ - - #include "base/logging.h" - #include "base/metrics/histogram_functions.h" -+#include "components/viz/common/resources/shared_bitmap_manager.h" - #include "components/viz/service/display/display.h" - #include "components/viz/service/display_embedder/display_provider.h" - #include "components/viz/service/display_embedder/external_begin_frame_controller_impl.h" -@@ -39,9 +40,11 @@ FrameSinkManagerImpl::FrameSinkSourceMapping::operator=( - FrameSinkSourceMapping&& other) = default; - - FrameSinkManagerImpl::FrameSinkManagerImpl( -+ SharedBitmapManager* shared_bitmap_manager, - base::Optional activation_deadline_in_frames, - DisplayProvider* display_provider) -- : display_provider_(display_provider), -+ : shared_bitmap_manager_(shared_bitmap_manager), -+ display_provider_(display_provider), - surface_manager_(activation_deadline_in_frames), - hit_test_manager_(surface_manager()), - binding_(this) { -diff --git a/components/viz/service/frame_sinks/frame_sink_manager_impl.h b/components/viz/service/frame_sinks/frame_sink_manager_impl.h -index 7f2352e93677..edf6b35827d8 100644 ---- a/components/viz/service/frame_sinks/frame_sink_manager_impl.h -+++ b/components/viz/service/frame_sinks/frame_sink_manager_impl.h -@@ -37,10 +37,10 @@ - #include "services/viz/public/interfaces/compositing/video_detector_observer.mojom.h" - - namespace viz { -- - class CapturableFrameSink; - class CompositorFrameSinkSupport; - class DisplayProvider; -+class SharedBitmapManager; - - // FrameSinkManagerImpl manages BeginFrame hierarchy. This is the implementation - // detail for FrameSinkManagerImpl. -@@ -50,9 +50,11 @@ class VIZ_SERVICE_EXPORT FrameSinkManagerImpl - public mojom::FrameSinkManager, - public HitTestAggregatorDelegate { - public: -- FrameSinkManagerImpl(base::Optional activation_deadline_in_frames = -- kDefaultActivationDeadlineInFrames, -- DisplayProvider* display_provider = nullptr); -+ explicit FrameSinkManagerImpl( -+ SharedBitmapManager* shared_bitmap_manager, -+ base::Optional activation_deadline_in_frames = -+ kDefaultActivationDeadlineInFrames, -+ DisplayProvider* display_provider = nullptr); - ~FrameSinkManagerImpl() override; - - // Binds |this| as a FrameSinkManagerImpl for |request| on |task_runner|. On -@@ -142,8 +144,10 @@ class VIZ_SERVICE_EXPORT FrameSinkManagerImpl - BeginFrameSource* GetPrimaryBeginFrameSource(); - - SurfaceManager* surface_manager() { return &surface_manager_; } -- - const HitTestManager* hit_test_manager() { return &hit_test_manager_; } -+ SharedBitmapManager* shared_bitmap_manager() { -+ return shared_bitmap_manager_; -+ } - - void SubmitHitTestRegionList( - const SurfaceId& surface_id, -@@ -210,6 +214,9 @@ class VIZ_SERVICE_EXPORT FrameSinkManagerImpl - bool ChildContains(const FrameSinkId& child_frame_sink_id, - const FrameSinkId& search_frame_sink_id) const; - -+ // SharedBitmapManager for the viz display service for receiving software -+ // resources in CompositorFrameSinks. -+ SharedBitmapManager* const shared_bitmap_manager_; - // Provides a Display for CreateRootCompositorFrameSink(). - DisplayProvider* const display_provider_; - -diff --git a/components/viz/service/frame_sinks/frame_sink_manager_unittest.cc b/components/viz/service/frame_sinks/frame_sink_manager_unittest.cc -index 3f17acac088a..1fdbc3fb35e6 100644 ---- a/components/viz/service/frame_sinks/frame_sink_manager_unittest.cc -+++ b/components/viz/service/frame_sinks/frame_sink_manager_unittest.cc -@@ -12,6 +12,7 @@ - #include "components/viz/common/constants.h" - #include "components/viz/common/frame_sinks/begin_frame_source.h" - #include "components/viz/common/surfaces/parent_local_surface_id_allocator.h" -+#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h" - #include "components/viz/service/frame_sinks/compositor_frame_sink_support.h" - #include "components/viz/test/begin_frame_source_test.h" - #include "components/viz/test/compositor_frame_helpers.h" -@@ -55,7 +56,9 @@ struct RootCompositorFrameSinkData { - class FrameSinkManagerTest : public testing::Test { - public: - FrameSinkManagerTest() -- : manager_(kDefaultActivationDeadlineInFrames, &display_provider_) {} -+ : manager_(&shared_bitmap_manager_, -+ kDefaultActivationDeadlineInFrames, -+ &display_provider_) {} - ~FrameSinkManagerTest() override = default; - - std::unique_ptr CreateCompositorFrameSinkSupport( -@@ -84,6 +87,7 @@ class FrameSinkManagerTest : public testing::Test { - } - - protected: -+ ServerSharedBitmapManager shared_bitmap_manager_; - TestDisplayProvider display_provider_; - FrameSinkManagerImpl manager_; - }; -diff --git a/components/viz/service/frame_sinks/surface_references_unittest.cc b/components/viz/service/frame_sinks/surface_references_unittest.cc -index eb69755a3177..e5df8b486541 100644 ---- a/components/viz/service/frame_sinks/surface_references_unittest.cc -+++ b/components/viz/service/frame_sinks/surface_references_unittest.cc -@@ -10,6 +10,7 @@ - #include "base/containers/flat_set.h" - #include "base/test/test_mock_time_task_runner.h" - #include "components/viz/common/surfaces/surface_id.h" -+#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h" - #include "components/viz/service/frame_sinks/compositor_frame_sink_support.h" - #include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" - #include "components/viz/service/surfaces/surface.h" -@@ -126,7 +127,7 @@ class SurfaceReferencesTest : public testing::Test { - // testing::Test: - void SetUp() override { - // Start each test with a fresh SurfaceManager instance. -- manager_ = std::make_unique(); -+ manager_ = std::make_unique(&shared_bitmap_manager_); - frame_sink_manager_client_ = - std::make_unique(manager_.get()); - manager_->SetLocalClient(frame_sink_manager_client_.get()); -@@ -140,12 +141,13 @@ class SurfaceReferencesTest : public testing::Test { - scoped_refptr task_runner_; - base::TestMockTimeTaskRunner::ScopedContext scoped_context_; - -+ ServerSharedBitmapManager shared_bitmap_manager_; -+ std::unique_ptr manager_; -+ std::unique_ptr frame_sink_manager_client_; - std::unordered_map, - FrameSinkIdHash> - supports_; -- std::unique_ptr manager_; -- std::unique_ptr frame_sink_manager_client_; - }; - - TEST_F(SurfaceReferencesTest, AddReference) { -diff --git a/components/viz/service/frame_sinks/surface_synchronization_unittest.cc b/components/viz/service/frame_sinks/surface_synchronization_unittest.cc -index 8b83cea05dd3..36eb4787a071 100644 ---- a/components/viz/service/frame_sinks/surface_synchronization_unittest.cc -+++ b/components/viz/service/frame_sinks/surface_synchronization_unittest.cc -@@ -5,6 +5,7 @@ - #include "base/containers/flat_set.h" - #include "base/test/simple_test_tick_clock.h" - #include "components/viz/common/surfaces/surface_id.h" -+#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h" - #include "components/viz/service/frame_sinks/compositor_frame_sink_support.h" - #include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" - #include "components/viz/test/begin_frame_args_test.h" -@@ -87,7 +88,8 @@ class FakeExternalBeginFrameSourceClient - class SurfaceSynchronizationTest : public testing::Test { - public: - SurfaceSynchronizationTest() -- : frame_sink_manager_client_(&frame_sink_manager_), -+ : frame_sink_manager_(&shared_bitmap_manager_), -+ frame_sink_manager_client_(&frame_sink_manager_), - surface_observer_(false) {} - ~SurfaceSynchronizationTest() override {} - -@@ -258,6 +260,7 @@ class SurfaceSynchronizationTest : public testing::Test { - - private: - std::unique_ptr now_src_; -+ ServerSharedBitmapManager shared_bitmap_manager_; - FrameSinkManagerImpl frame_sink_manager_; - TestFrameSinkManagerClient frame_sink_manager_client_; - FakeSurfaceObserver surface_observer_; -diff --git a/components/viz/service/frame_sinks/video_detector_unittest.cc b/components/viz/service/frame_sinks/video_detector_unittest.cc -index c56d8d49f82a..d7f76b72c88a 100644 ---- a/components/viz/service/frame_sinks/video_detector_unittest.cc -+++ b/components/viz/service/frame_sinks/video_detector_unittest.cc -@@ -13,6 +13,7 @@ - #include "components/viz/common/quads/surface_draw_quad.h" - #include "components/viz/common/surfaces/parent_local_surface_id_allocator.h" - #include "components/viz/service/display/surface_aggregator.h" -+#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h" - #include "components/viz/service/frame_sinks/compositor_frame_sink_support.h" - #include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" - #include "components/viz/service/frame_sinks/video_detector.h" -@@ -74,7 +75,8 @@ class TestObserver : public mojom::VideoDetectorObserver { - class VideoDetectorTest : public testing::Test { - public: - VideoDetectorTest() -- : surface_aggregator_(frame_sink_manager_.surface_manager(), -+ : frame_sink_manager_(&shared_bitmap_manager_), -+ surface_aggregator_(frame_sink_manager_.surface_manager(), - nullptr, - false) {} - -@@ -192,6 +194,7 @@ class VideoDetectorTest : public testing::Test { - .Build(); - } - -+ ServerSharedBitmapManager shared_bitmap_manager_; - FrameSinkManagerImpl frame_sink_manager_; - FakeCompositorFrameSinkClient frame_sink_client_; - ParentLocalSurfaceIdAllocator parent_local_surface_id_allocator_; -diff --git a/components/viz/service/hit_test/hit_test_aggregator_unittest.cc b/components/viz/service/hit_test/hit_test_aggregator_unittest.cc -index d59985209db2..7e8a966240bd 100644 ---- a/components/viz/service/hit_test/hit_test_aggregator_unittest.cc -+++ b/components/viz/service/hit_test/hit_test_aggregator_unittest.cc -@@ -11,6 +11,7 @@ - #include "components/viz/common/surfaces/frame_sink_id.h" - #include "components/viz/common/surfaces/surface_id.h" - #include "components/viz/host/host_frame_sink_manager.h" -+#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h" - #include "components/viz/service/frame_sinks/compositor_frame_sink_support.h" - #include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" - #include "components/viz/service/hit_test/hit_test_aggregator_delegate.h" -@@ -59,7 +60,8 @@ class TestHostFrameSinkManager : public HostFrameSinkManager { - - class TestFrameSinkManagerImpl : public FrameSinkManagerImpl { - public: -- TestFrameSinkManagerImpl() = default; -+ explicit TestFrameSinkManagerImpl(SharedBitmapManager* shared_bitmap_manager) -+ : FrameSinkManagerImpl(shared_bitmap_manager) {} - ~TestFrameSinkManagerImpl() override = default; - - void SetLocalClient(TestHostFrameSinkManager* client) { -@@ -112,7 +114,8 @@ class HitTestAggregatorTest : public testing::Test { - - // testing::Test: - void SetUp() override { -- frame_sink_manager_ = std::make_unique(); -+ frame_sink_manager_ = -+ std::make_unique(&shared_bitmap_manager_); - host_frame_sink_manager_ = std::make_unique(); - local_surface_id_lookup_delegate_ = - std::make_unique(); -@@ -208,6 +211,7 @@ class HitTestAggregatorTest : public testing::Test { - } - - private: -+ ServerSharedBitmapManager shared_bitmap_manager_; - std::unique_ptr hit_test_aggregator_; - std::unique_ptr frame_sink_manager_; - std::unique_ptr host_frame_sink_manager_; -diff --git a/components/viz/service/hit_test/hit_test_manager_fuzzer.cc b/components/viz/service/hit_test/hit_test_manager_fuzzer.cc -index 734d626750d8..9b6001433292 100644 ---- a/components/viz/service/hit_test/hit_test_manager_fuzzer.cc -+++ b/components/viz/service/hit_test/hit_test_manager_fuzzer.cc -@@ -8,6 +8,7 @@ - - #include "base/command_line.h" - #include "base/test/fuzzed_data_provider.h" -+#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h" - #include "components/viz/service/frame_sinks/compositor_frame_sink_support.h" - #include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" - #include "components/viz/service/hit_test/hit_test_aggregator.h" -@@ -134,7 +135,8 @@ void SubmitHitTestRegionList( - - extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t num_bytes) { - base::FuzzedDataProvider fuzz(data, num_bytes); -- viz::FrameSinkManagerImpl frame_sink_manager; -+ viz::ServerSharedBitmapManager shared_bitmap_manager; -+ viz::FrameSinkManagerImpl frame_sink_manager(&shared_bitmap_manager); - viz::TestLatestLocalSurfaceIdLookupDelegate delegate; - viz::TestLatestLocalSurfaceIdLookupDelegate* lsi_delegate = - fuzz.ConsumeBool() ? &delegate : nullptr; -diff --git a/components/viz/service/main/viz_main_impl.cc b/components/viz/service/main/viz_main_impl.cc -index 72b26afce32d..662034906499 100644 ---- a/components/viz/service/main/viz_main_impl.cc -+++ b/components/viz/service/main/viz_main_impl.cc -@@ -12,9 +12,11 @@ - #include "base/power_monitor/power_monitor_device_source.h" - #include "base/single_thread_task_runner.h" - #include "base/threading/sequenced_task_runner_handle.h" -+#include "base/trace_event/memory_dump_manager.h" - #include "build/build_config.h" - #include "components/viz/common/switches.h" - #include "components/viz/service/display_embedder/gpu_display_provider.h" -+#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h" - #include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" - #include "components/viz/service/gl/gpu_service_impl.h" - #include "gpu/command_buffer/common/activity_flags.h" -@@ -279,9 +281,14 @@ void VizMainImpl::CreateFrameSinkManagerOnCompositorThread( - - base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - -+ server_shared_bitmap_manager_ = std::make_unique(); -+ base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( -+ server_shared_bitmap_manager_.get(), "viz::ServerSharedBitmapManager", -+ base::ThreadTaskRunnerHandle::Get()); -+ - display_provider_ = std::make_unique( - params->restart_id, gpu_service_.get(), gpu_command_service_, -- gpu_service_->gpu_channel_manager(), -+ gpu_service_->gpu_channel_manager(), server_shared_bitmap_manager_.get(), - command_line->HasSwitch(switches::kHeadless), - command_line->HasSwitch(switches::kRunAllCompositorStagesBeforeDraw)); - -@@ -291,14 +298,20 @@ void VizMainImpl::CreateFrameSinkManagerOnCompositorThread( - if (params->use_activation_deadline) - activation_deadline_in_frames = params->activation_deadline_in_frames; - frame_sink_manager_ = std::make_unique( -- activation_deadline_in_frames, display_provider_.get()); -+ server_shared_bitmap_manager_.get(), activation_deadline_in_frames, -+ display_provider_.get()); - frame_sink_manager_->BindAndSetClient(std::move(params->frame_sink_manager), - nullptr, std::move(client)); - } - - void VizMainImpl::TearDownOnCompositorThread() { -+ base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( -+ server_shared_bitmap_manager_.get()); -+ - frame_sink_manager_.reset(); - display_provider_.reset(); -+ -+ server_shared_bitmap_manager_.reset(); - } - - void VizMainImpl::PreSandboxStartup() { -diff --git a/components/viz/service/main/viz_main_impl.h b/components/viz/service/main/viz_main_impl.h -index 8bb8e2be1643..48e12c66da18 100644 ---- a/components/viz/service/main/viz_main_impl.h -+++ b/components/viz/service/main/viz_main_impl.h -@@ -33,6 +33,7 @@ namespace viz { - class DisplayProvider; - class FrameSinkManagerImpl; - class GpuServiceImpl; -+class ServerSharedBitmapManager; - - class VizMainImpl : public gpu::GpuSandboxHelper, public mojom::VizMain { - public: -@@ -149,8 +150,9 @@ class VizMainImpl : public gpu::GpuSandboxHelper, public mojom::VizMain { - - // Provides mojo interfaces for creating and managing FrameSinks. These live - // on the compositor thread. -- std::unique_ptr frame_sink_manager_; -+ std::unique_ptr server_shared_bitmap_manager_; - std::unique_ptr display_provider_; -+ std::unique_ptr frame_sink_manager_; - - const scoped_refptr gpu_thread_task_runner_; - -diff --git a/components/viz/service/surfaces/surface_hittest_unittest.cc b/components/viz/service/surfaces/surface_hittest_unittest.cc -index ea2e4788e7d8..d9cd05c3d9e4 100644 ---- a/components/viz/service/surfaces/surface_hittest_unittest.cc -+++ b/components/viz/service/surfaces/surface_hittest_unittest.cc -@@ -6,6 +6,7 @@ - - #include "components/viz/common/quads/compositor_frame.h" - #include "components/viz/common/surfaces/parent_local_surface_id_allocator.h" -+#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h" - #include "components/viz/service/frame_sinks/compositor_frame_sink_support.h" - #include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" - #include "components/viz/service/surfaces/surface.h" -@@ -70,7 +71,7 @@ using namespace test; - - class SurfaceHittestTest : public testing::Test { - public: -- SurfaceHittestTest() = default; -+ SurfaceHittestTest() : frame_sink_manager_(&shared_bitmap_manager_) {} - ~SurfaceHittestTest() override = default; - - CompositorFrameSinkSupport& root_support() { return *supports_[0]; } -@@ -96,6 +97,7 @@ class SurfaceHittestTest : public testing::Test { - void TearDown() override { supports_.clear(); } - - private: -+ ServerSharedBitmapManager shared_bitmap_manager_; - FrameSinkManagerImpl frame_sink_manager_; - std::vector> supports_; - FakeCompositorFrameSinkClient client_; -diff --git a/components/viz/service/surfaces/surface_unittest.cc b/components/viz/service/surfaces/surface_unittest.cc -index fb4bb3cd7777..c1d55fdfa622 100644 ---- a/components/viz/service/surfaces/surface_unittest.cc -+++ b/components/viz/service/surfaces/surface_unittest.cc -@@ -6,6 +6,7 @@ - #include "cc/test/scheduler_test_common.h" - #include "components/viz/common/frame_sinks/copy_output_result.h" - #include "components/viz/common/surfaces/parent_local_surface_id_allocator.h" -+#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h" - #include "components/viz/service/frame_sinks/compositor_frame_sink_support.h" - #include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" - #include "components/viz/service/surfaces/surface_dependency_tracker.h" -@@ -28,7 +29,8 @@ TEST(SurfaceTest, PresentationCallback) { - constexpr gfx::Rect kDamageRect(0, 0); - const LocalSurfaceId local_surface_id(6, base::UnguessableToken::Create()); - -- FrameSinkManagerImpl frame_sink_manager; -+ ServerSharedBitmapManager shared_bitmap_manager; -+ FrameSinkManagerImpl frame_sink_manager(&shared_bitmap_manager); - MockCompositorFrameSinkClient client; - auto support = std::make_unique( - &client, &frame_sink_manager, kArbitraryFrameSinkId, kIsRoot, -@@ -78,7 +80,8 @@ void TestCopyResultCallback(bool* called, - // Test that CopyOutputRequests can outlive the current frame and be - // aggregated on the next frame. - TEST(SurfaceTest, CopyRequestLifetime) { -- FrameSinkManagerImpl frame_sink_manager; -+ ServerSharedBitmapManager shared_bitmap_manager; -+ FrameSinkManagerImpl frame_sink_manager(&shared_bitmap_manager); - SurfaceManager* surface_manager = frame_sink_manager.surface_manager(); - auto support = std::make_unique( - nullptr, &frame_sink_manager, kArbitraryFrameSinkId, kIsRoot, -diff --git a/components/viz/test/test_layer_tree_frame_sink.cc b/components/viz/test/test_layer_tree_frame_sink.cc -index 14e1c74a9e88..932cfb499826 100644 ---- a/components/viz/test/test_layer_tree_frame_sink.cc -+++ b/components/viz/test/test_layer_tree_frame_sink.cc -@@ -73,7 +73,8 @@ bool TestLayerTreeFrameSink::BindToClient( - if (!LayerTreeFrameSink::BindToClient(client)) - return false; - -- frame_sink_manager_ = std::make_unique(); -+ frame_sink_manager_ = -+ std::make_unique(&shared_bitmap_manager_); - - std::unique_ptr display_output_surface = - test_client_->CreateDisplayOutputSurface(context_provider()); -diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc -index c17b467f2140..6ac229f6ba79 100644 ---- a/content/browser/browser_main_loop.cc -+++ b/content/browser/browser_main_loop.cc -@@ -750,9 +750,13 @@ void BrowserMainLoop::PostMainMessageLoopStart() { - - // Enable memory-infra dump providers. - InitSkiaEventTracer(); -- base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( -- viz::ServerSharedBitmapManager::current(), -- "viz::ServerSharedBitmapManager", nullptr); -+#if !defined(OS_ANDROID) -+ if (server_shared_bitmap_manager_) { -+ base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( -+ server_shared_bitmap_manager_.get(), "viz::ServerSharedBitmapManager", -+ nullptr); -+ } -+#endif - base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( - skia::SkiaMemoryDumpProvider::GetInstance(), "Skia", nullptr); - base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( -@@ -1055,6 +1059,7 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() { - host_frame_sink_manager_.reset(); - frame_sink_manager_impl_.reset(); - compositing_mode_reporter_impl_.reset(); -+ server_shared_bitmap_manager_.reset(); - #endif - - // The device monitors are using |system_monitor_| as dependency, so delete -@@ -1150,6 +1155,11 @@ base::SequencedTaskRunner* BrowserMainLoop::audio_service_runner() { - viz::FrameSinkManagerImpl* BrowserMainLoop::GetFrameSinkManager() const { - return frame_sink_manager_impl_.get(); - } -+ -+viz::ServerSharedBitmapManager* BrowserMainLoop::GetServerSharedBitmapManager() -+ const { -+ return server_shared_bitmap_manager_.get(); -+} - #endif - - void BrowserMainLoop::GetCompositingModeReporter( -@@ -1267,17 +1277,20 @@ int BrowserMainLoop::BrowserThreadsStarted() { - transport_factory->ConnectHostFrameSinkManager(); - ImageTransportFactory::SetFactory(std::move(transport_factory)); - } else { -+ server_shared_bitmap_manager_ = -+ std::make_unique(); - frame_sink_manager_impl_ = std::make_unique( -+ server_shared_bitmap_manager_.get(), - switches::GetDeadlineToSynchronizeSurfaces()); - - surface_utils::ConnectWithLocalFrameSinkManager( - host_frame_sink_manager_.get(), frame_sink_manager_impl_.get()); - -- - ImageTransportFactory::SetFactory( - std::make_unique( - BrowserGpuChannelHostFactory::instance(), -- compositing_mode_reporter_impl_.get(), GetResizeTaskRunner())); -+ compositing_mode_reporter_impl_.get(), -+ server_shared_bitmap_manager_.get(), GetResizeTaskRunner())); - } - } - -diff --git a/content/browser/browser_main_loop.h b/content/browser/browser_main_loop.h -index f117bf39fa7b..572bfdcda6ab 100644 ---- a/content/browser/browser_main_loop.h -+++ b/content/browser/browser_main_loop.h -@@ -91,6 +91,7 @@ namespace viz { - class CompositingModeReporterImpl; - class FrameSinkManagerImpl; - class HostFrameSinkManager; -+class ServerSharedBitmapManager; - } - - namespace content { -@@ -217,6 +218,9 @@ class CONTENT_EXPORT BrowserMainLoop { - // TODO(crbug.com/657959): This will be removed once there are no users, as - // SurfaceManager is being moved out of process. - viz::FrameSinkManagerImpl* GetFrameSinkManager() const; -+ -+ // This returns null when the display compositor is out of process. -+ viz::ServerSharedBitmapManager* GetServerSharedBitmapManager() const; - #endif - - // Fulfills a mojo pointer to the singleton CompositingModeReporter. -@@ -384,6 +388,11 @@ class CONTENT_EXPORT BrowserMainLoop { - scoped_refptr save_file_manager_; - std::unique_ptr tracing_controller_; - #if !defined(OS_ANDROID) -+ // A SharedBitmapManager used to sharing and mapping IDs to shared memory -+ // between processes for software compositing. When the display compositor is -+ // in the browser process, then |server_shared_bitmap_manager_| is set, and -+ // when it is in the viz process, then it is null. -+ std::unique_ptr server_shared_bitmap_manager_; - std::unique_ptr host_frame_sink_manager_; - // This is owned here so that SurfaceManager will be accessible in process - // when display is in the same process. Other than using SurfaceManager, -diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc -index d90a276fc0e1..f0db9d11ce10 100644 ---- a/content/browser/compositor/gpu_process_transport_factory.cc -+++ b/content/browser/compositor/gpu_process_transport_factory.cc -@@ -178,6 +178,7 @@ struct GpuProcessTransportFactory::PerCompositorData { - GpuProcessTransportFactory::GpuProcessTransportFactory( - gpu::GpuChannelEstablishFactory* gpu_channel_factory, - viz::CompositingModeReporterImpl* compositing_mode_reporter, -+ viz::ServerSharedBitmapManager* server_shared_bitmap_manager, - scoped_refptr resize_task_runner) - : frame_sink_id_allocator_(kDefaultClientId), - renderer_settings_(viz::CreateRendererSettings()), -@@ -185,6 +186,7 @@ GpuProcessTransportFactory::GpuProcessTransportFactory( - task_graph_runner_(new cc::SingleThreadTaskGraphRunner), - gpu_channel_factory_(gpu_channel_factory), - compositing_mode_reporter_(compositing_mode_reporter), -+ server_shared_bitmap_manager_(server_shared_bitmap_manager), - callback_factory_(this) { - DCHECK(gpu_channel_factory_); - cc::SetClientNameForMetrics("Browser"); -@@ -641,7 +643,7 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( - - // The Display owns and uses the |display_output_surface| created above. - data->display = std::make_unique( -- viz::ServerSharedBitmapManager::current(), renderer_settings_, -+ server_shared_bitmap_manager_, renderer_settings_, - compositor->frame_sink_id(), std::move(display_output_surface), - std::move(scheduler), compositor->task_runner()); - data->display_client = -diff --git a/content/browser/compositor/gpu_process_transport_factory.h b/content/browser/compositor/gpu_process_transport_factory.h -index 02c1ec0d59bd..2ea8c9f4162e 100644 ---- a/content/browser/compositor/gpu_process_transport_factory.h -+++ b/content/browser/compositor/gpu_process_transport_factory.h -@@ -47,6 +47,7 @@ class ContextProviderCommandBuffer; - namespace viz { - class CompositingModeReporterImpl; - class OutputDeviceBacking; -+class ServerSharedBitmapManager; - class SoftwareOutputDevice; - class VulkanInProcessContextProvider; - class RasterContextProvider; -@@ -62,6 +63,7 @@ class GpuProcessTransportFactory : public ui::ContextFactory, - GpuProcessTransportFactory( - gpu::GpuChannelEstablishFactory* gpu_channel_factory, - viz::CompositingModeReporterImpl* compositing_mode_reporter, -+ viz::ServerSharedBitmapManager* server_shared_bitmap_manager, - scoped_refptr resize_task_runner); - - ~GpuProcessTransportFactory() override; -@@ -180,6 +182,8 @@ class GpuProcessTransportFactory : public ui::ContextFactory, - // Service-side impl that controls the compositing mode based on what mode the - // display compositors are using. - viz::CompositingModeReporterImpl* const compositing_mode_reporter_; -+ // Manages a mapping of SharedBitmapId to shared memory objects. -+ viz::ServerSharedBitmapManager* const server_shared_bitmap_manager_; - - base::WeakPtrFactory callback_factory_; - -diff --git a/content/browser/compositor/test/test_image_transport_factory.cc b/content/browser/compositor/test/test_image_transport_factory.cc -index 037a51961140..cb6f07bdc3e0 100644 ---- a/content/browser/compositor/test/test_image_transport_factory.cc -+++ b/content/browser/compositor/test/test_image_transport_factory.cc -@@ -9,6 +9,7 @@ - - #include "components/viz/common/features.h" - #include "components/viz/common/gl_helper.h" -+#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h" - #include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" - #include "components/viz/test/test_frame_sink_manager.h" - #include "content/browser/compositor/surface_utils.h" -@@ -61,7 +62,9 @@ TestImageTransportFactory::TestImageTransportFactory() - std::move(frame_sink_manager_request), - std::move(frame_sink_manager_client)); - } else { -- frame_sink_manager_impl_ = std::make_unique(); -+ shared_bitmap_manager_ = std::make_unique(); -+ frame_sink_manager_impl_ = std::make_unique( -+ shared_bitmap_manager_.get()); - surface_utils::ConnectWithLocalFrameSinkManager( - &host_frame_sink_manager_, frame_sink_manager_impl_.get()); - } -diff --git a/content/browser/compositor/test/test_image_transport_factory.h b/content/browser/compositor/test/test_image_transport_factory.h -index 76196cee2e27..1cd245d0a01a 100644 ---- a/content/browser/compositor/test/test_image_transport_factory.h -+++ b/content/browser/compositor/test/test_image_transport_factory.h -@@ -23,6 +23,7 @@ - namespace viz { - class GLHelper; - class FrameSinkManagerImpl; -+class ServerSharedBitmapManager; - class TestFrameSinkManagerImpl; - } // namespace viz - -@@ -98,6 +99,7 @@ class TestImageTransportFactory : public ui::ContextFactory, - viz::HostFrameSinkManager host_frame_sink_manager_; - - // Objects that exist if |enable_viz_| is false. -+ std::unique_ptr shared_bitmap_manager_; - std::unique_ptr frame_sink_manager_impl_; - std::unique_ptr gl_helper_; - -diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc -index d2f18a562af3..85e4d4b5c1df 100644 ---- a/content/browser/renderer_host/compositor_impl_android.cc -+++ b/content/browser/renderer_host/compositor_impl_android.cc -@@ -174,7 +174,10 @@ class CompositorDependencies { - bool enable_viz = - base::FeatureList::IsEnabled(features::kVizDisplayCompositor); - if (!enable_viz) { -- frame_sink_manager_impl = std::make_unique(); -+ // The SharedBitmapManager can be null as software compositing is not -+ // supported or used on Android. -+ frame_sink_manager_impl = std::make_unique( -+ /*shared_bitmap_manager=*/nullptr); - surface_utils::ConnectWithLocalFrameSinkManager( - &host_frame_sink_manager, frame_sink_manager_impl.get()); - } -@@ -1008,9 +1011,8 @@ void CompositorImpl::InitializeDisplay( - const bool should_register_begin_frame_source = !display_; - - display_ = std::make_unique( -- viz::ServerSharedBitmapManager::current(), renderer_settings, -- frame_sink_id_, std::move(display_output_surface), std::move(scheduler), -- task_runner); -+ nullptr, renderer_settings, frame_sink_id_, -+ std::move(display_output_surface), std::move(scheduler), task_runner); - - auto layer_tree_frame_sink = std::make_unique( - frame_sink_id_, GetHostFrameSinkManager(), manager, display_.get(), -diff --git a/content/browser/renderer_host/embedded_frame_sink_provider_impl_unittest.cc b/content/browser/renderer_host/embedded_frame_sink_provider_impl_unittest.cc -index 02999045b0b3..71073a5ff02d 100644 ---- a/content/browser/renderer_host/embedded_frame_sink_provider_impl_unittest.cc -+++ b/content/browser/renderer_host/embedded_frame_sink_provider_impl_unittest.cc -@@ -13,6 +13,7 @@ - #include "build/build_config.h" - #include "components/viz/common/quads/compositor_frame.h" - #include "components/viz/host/host_frame_sink_manager.h" -+#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h" - #include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" - #include "components/viz/test/compositor_frame_helpers.h" - #include "components/viz/test/fake_host_frame_sink_client.h" -@@ -119,7 +120,8 @@ class EmbeddedFrameSinkProviderImplTest : public testing::Test { - host_frame_sink_manager_ = std::make_unique(); - - // The FrameSinkManagerImpl implementation is in-process here for tests. -- frame_sink_manager_ = std::make_unique(); -+ frame_sink_manager_ = -+ std::make_unique(&shared_bitmap_manager_); - surface_utils::ConnectWithLocalFrameSinkManager( - host_frame_sink_manager_.get(), frame_sink_manager_.get()); - -@@ -140,6 +142,7 @@ class EmbeddedFrameSinkProviderImplTest : public testing::Test { - // A MessageLoop is required for mojo bindings which are used to - // connect to graphics services. - base::MessageLoop message_loop_; -+ viz::ServerSharedBitmapManager shared_bitmap_manager_; - viz::FakeHostFrameSinkClient host_frame_sink_client_; - std::unique_ptr host_frame_sink_manager_; - std::unique_ptr frame_sink_manager_; -diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index 2efe7a5c7de9..856dc18181f1 100644 ---- a/content/browser/renderer_host/render_widget_host_impl.cc -+++ b/content/browser/renderer_host/render_widget_host_impl.cc -@@ -421,6 +421,17 @@ RenderWidgetHostImpl::RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate, - enable_surface_synchronization_ = features::IsSurfaceSynchronizationEnabled(); - enable_viz_ = base::FeatureList::IsEnabled(features::kVizDisplayCompositor); - -+ if (!enable_viz_) { -+#if !defined(OS_ANDROID) -+ // Software compositing is not supported or used on Android. -+ // -+ // The BrowserMainLoop is null in unit tests, but they do not use -+ // compositing and report SharedBitmapIds. -+ if (BrowserMainLoop* main_loop = BrowserMainLoop::GetInstance()) -+ shared_bitmap_manager_ = main_loop->GetServerSharedBitmapManager(); -+#endif -+ } -+ - delegate_->RenderWidgetCreated(this); - render_frame_metadata_provider_.AddObserver(this); - } -@@ -1991,8 +2002,15 @@ void RenderWidgetHostImpl::Destroy(bool also_delete) { - // The display compositor has ownership of shared memory for each - // SharedBitmapId that has been reported from the client. Since the client is - // gone that memory can be freed. If we don't then it would leak. -- for (const auto& id : owned_bitmaps_) -- viz::ServerSharedBitmapManager::current()->ChildDeletedSharedBitmap(id); -+ if (shared_bitmap_manager_) { -+ for (const auto& id : owned_bitmaps_) -+ shared_bitmap_manager_->ChildDeletedSharedBitmap(id); -+ } else { -+ // If the display compositor is not in the browser process, then the -+ // |bitmap_manager| is not present in the process either, and no bitmaps -+ // should have been registered with this class. -+ DCHECK(owned_bitmaps_.empty()); -+ } - - process_->RemoveWidget(this); - process_->RemoveRoute(routing_id_); -@@ -2150,8 +2168,8 @@ void RenderWidgetHostImpl::DidNotProduceFrame(const viz::BeginFrameAck& ack) { - void RenderWidgetHostImpl::DidAllocateSharedBitmap( - mojo::ScopedSharedBufferHandle buffer, - const viz::SharedBitmapId& id) { -- if (!viz::ServerSharedBitmapManager::current()->ChildAllocatedSharedBitmap( -- std::move(buffer), id)) { -+ if (!shared_bitmap_manager_->ChildAllocatedSharedBitmap(std::move(buffer), -+ id)) { - bad_message::ReceivedBadMessage(GetProcess(), - bad_message::RWH_SHARED_BITMAP); - } -@@ -2160,7 +2178,7 @@ void RenderWidgetHostImpl::DidAllocateSharedBitmap( - - void RenderWidgetHostImpl::DidDeleteSharedBitmap( - const viz::SharedBitmapId& id) { -- viz::ServerSharedBitmapManager::current()->ChildDeletedSharedBitmap(id); -+ shared_bitmap_manager_->ChildDeletedSharedBitmap(id); - owned_bitmaps_.erase(id); - } - -diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h -index 7328c615c87d..05f539cddbd3 100644 ---- a/content/browser/renderer_host/render_widget_host_impl.h -+++ b/content/browser/renderer_host/render_widget_host_impl.h -@@ -96,6 +96,10 @@ namespace ui { - enum class DomCode; - } - -+namespace viz { -+class ServerSharedBitmapManager; -+} -+ - namespace content { - - class BrowserAccessibilityManager; -@@ -1170,9 +1174,15 @@ class CONTENT_EXPORT RenderWidgetHostImpl - base::Optional screen_orientation_angle_for_testing_; - base::Optional screen_orientation_type_for_testing_; - -+ // When the viz display compositor is in the browser process, this is used to -+ // register and unregister the bitmaps (stored in |owned_bitmaps_| reported to -+ // this class from the renderer. -+ viz::ServerSharedBitmapManager* shared_bitmap_manager_ = nullptr; - // The set of SharedBitmapIds that have been reported as allocated to this - // interface. On closing this interface, the display compositor should drop -- // ownership of the bitmaps with these ids to avoid leaking them. -+ // ownership of the bitmaps with these ids to avoid leaking them. This is only -+ // used when SharedBitmaps are reported to this class because the display -+ // compositor is in the browser process. - std::set owned_bitmaps_; - - bool force_enable_zoom_ = false; -diff --git a/third_party/blink/renderer/platform/graphics/offscreen_canvas_resource_provider.cc b/third_party/blink/renderer/platform/graphics/offscreen_canvas_resource_provider.cc -index 8c140158bfd4..6d2fe1f74f78 100644 ---- a/third_party/blink/renderer/platform/graphics/offscreen_canvas_resource_provider.cc -+++ b/third_party/blink/renderer/platform/graphics/offscreen_canvas_resource_provider.cc -@@ -181,8 +181,10 @@ void OffscreenCanvasResourceProvider::ReclaimResourceInternal( - } - - OffscreenCanvasResourceProvider::FrameResource::~FrameResource() { -- provider->frame_dispatcher_->DidDeleteSharedBitmap( -- SharedBitmapIdToGpuMailboxPtr(shared_bitmap_id)); -+ if (!shared_bitmap_id.IsZero()) { -+ provider->frame_dispatcher_->DidDeleteSharedBitmap( -+ SharedBitmapIdToGpuMailboxPtr(shared_bitmap_id)); -+ } - } - - } // namespace blink -diff --git a/ui/aura/BUILD.gn b/ui/aura/BUILD.gn -index c5eb719ef5d8..6f6a0534e8c9 100644 ---- a/ui/aura/BUILD.gn -+++ b/ui/aura/BUILD.gn -@@ -344,6 +344,7 @@ executable("demo") { - "//build/config:exe_and_shlib_deps", - "//build/win:default_exe_manifest", - "//components/viz/host", -+ "//components/viz/service", - "//skia", - "//third_party/icu", - "//ui/base", -diff --git a/ui/aura/demo/DEPS b/ui/aura/demo/DEPS -index 4026dbd84623..608c21f85e51 100644 ---- a/ui/aura/demo/DEPS -+++ b/ui/aura/demo/DEPS -@@ -1,5 +1,6 @@ - include_rules = [ - "+components/viz/host", -+ "+components/viz/service", # In-process viz service. - "+ui/display", # Windows DPI Initialization. - "+ui/gl/init/gl_factory.h", # To initialize GL bindings. - ] -diff --git a/ui/aura/demo/demo_main.cc b/ui/aura/demo/demo_main.cc -index 7c7c6da576b2..c44a9f8bf1fb 100644 ---- a/ui/aura/demo/demo_main.cc -+++ b/ui/aura/demo/demo_main.cc -@@ -16,6 +16,8 @@ - #include "base/task_scheduler/task_scheduler.h" - #include "build/build_config.h" - #include "components/viz/host/host_frame_sink_manager.h" -+#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h" -+#include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" - #include "third_party/skia/include/core/SkBlendMode.h" - #include "ui/aura/client/default_capture_client.h" - #include "ui/aura/client/window_parenting_client.h" -@@ -147,7 +149,8 @@ int DemoMain() { - - // The ContextFactory must exist before any Compositors are created. - viz::HostFrameSinkManager host_frame_sink_manager; -- viz::FrameSinkManagerImpl frame_sink_manager; -+ viz::ServerSharedBitmapManager server_shared_bitmap_manager; -+ viz::FrameSinkManagerImpl frame_sink_manager(&server_shared_bitmap_manager); - host_frame_sink_manager.SetLocalManager(&frame_sink_manager); - frame_sink_manager.SetLocalClient(&host_frame_sink_manager); - auto context_factory = std::make_unique( -diff --git a/ui/compositor/test/context_factories_for_test.cc b/ui/compositor/test/context_factories_for_test.cc -index ece65c0bddc0..aa1eb1807135 100644 ---- a/ui/compositor/test/context_factories_for_test.cc -+++ b/ui/compositor/test/context_factories_for_test.cc -@@ -7,6 +7,7 @@ - #include "base/command_line.h" - #include "base/sys_info.h" - #include "components/viz/host/host_frame_sink_manager.h" -+#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h" - #include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" - #include "ui/compositor/compositor.h" - #include "ui/compositor/compositor_switches.h" -@@ -16,6 +17,7 @@ - namespace { - - static viz::HostFrameSinkManager* g_host_frame_sink_manager = nullptr; -+static viz::ServerSharedBitmapManager* g_shared_bitmap_manager = nullptr; - static viz::FrameSinkManagerImpl* g_frame_sink_manager = nullptr; - static ui::InProcessContextFactory* g_implicit_factory = nullptr; - static gl::DisableNullDrawGLBindings* g_disable_null_draw = nullptr; -@@ -44,7 +46,8 @@ void InitializeContextFactoryForTests( - if (enable_pixel_output) - g_disable_null_draw = new gl::DisableNullDrawGLBindings; - g_host_frame_sink_manager = new viz::HostFrameSinkManager; -- g_frame_sink_manager = new viz::FrameSinkManagerImpl; -+ g_shared_bitmap_manager = new viz::ServerSharedBitmapManager; -+ g_frame_sink_manager = new viz::FrameSinkManagerImpl(g_shared_bitmap_manager); - g_implicit_factory = new InProcessContextFactory(g_host_frame_sink_manager, - g_frame_sink_manager); - g_implicit_factory->SetUseFastRefreshRateForTests(); -@@ -64,6 +67,8 @@ void TerminateContextFactoryForTests() { - g_host_frame_sink_manager = nullptr; - delete g_frame_sink_manager; - g_frame_sink_manager = nullptr; -+ delete g_shared_bitmap_manager; -+ g_shared_bitmap_manager = nullptr; - delete g_disable_null_draw; - g_disable_null_draw = nullptr; - } -diff --git a/ui/views/examples/BUILD.gn b/ui/views/examples/BUILD.gn -index 661329c2482e..aec5cf1466b3 100644 ---- a/ui/views/examples/BUILD.gn -+++ b/ui/views/examples/BUILD.gn -@@ -114,6 +114,7 @@ executable("views_examples_exe") { - "//build/config:exe_and_shlib_deps", - "//build/win:default_exe_manifest", - "//components/viz/host", -+ "//components/viz/service", - "//ui/base", - "//ui/compositor", - "//ui/compositor:test_support", -diff --git a/ui/views/examples/DEPS b/ui/views/examples/DEPS -index c55d1e8778f1..38ff08c5007e 100644 ---- a/ui/views/examples/DEPS -+++ b/ui/views/examples/DEPS -@@ -1,5 +1,6 @@ - include_rules = [ - "+components/viz/host", -+ "+components/viz/service", # In-process viz service. - "+content/public", - "+content/shell", - "+sandbox", -diff --git a/ui/views/examples/examples_main.cc b/ui/views/examples/examples_main.cc -index 9ddb537f8c52..4dd22a71197b 100644 ---- a/ui/views/examples/examples_main.cc -+++ b/ui/views/examples/examples_main.cc -@@ -17,6 +17,8 @@ - #include "base/test/test_discardable_memory_allocator.h" - #include "build/build_config.h" - #include "components/viz/host/host_frame_sink_manager.h" -+#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h" -+#include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" - #include "ui/base/ime/input_method_initializer.h" - #include "ui/base/material_design/material_design_controller.h" - #include "ui/base/resource/resource_bundle.h" -@@ -68,7 +70,8 @@ int main(int argc, char** argv) { - - // The ContextFactory must exist before any Compositors are created. - viz::HostFrameSinkManager host_frame_sink_manager; -- viz::FrameSinkManagerImpl frame_sink_manager; -+ viz::ServerSharedBitmapManager shared_bitmap_manager; -+ viz::FrameSinkManagerImpl frame_sink_manager(&shared_bitmap_manager); - host_frame_sink_manager.SetLocalManager(&frame_sink_manager); - frame_sink_manager.SetLocalClient(&host_frame_sink_manager); - auto context_factory = std::make_unique( diff --git a/patches/common/chromium/backport_cd7154e0bb5.patch b/patches/common/chromium/backport_cd7154e0bb5.patch deleted file mode 100644 index c79f2a73051..00000000000 --- a/patches/common/chromium/backport_cd7154e0bb5.patch +++ /dev/null @@ -1,100 +0,0 @@ -From 0dc7f85f52b9a5668481dfa206e6e55d40357cc2 Mon Sep 17 00:00:00 2001 -From: Elly Fong-Jones -Date: Wed, 6 Jun 2018 21:31:34 +0000 -Subject: mac: support build with 10.14 SDK - -Two changes are required: - -1) Explicitly upcast the result of dispatch_get_global_queue() to a -dispatch_queue_t*, since it changed to return dispatch_queue_global_t*; -2) Add empty implementations of the new methods on ICCameraDeviceDelegate for -ImageCaptureDevice - -TBR=maxmorin@chromium.org - -Bug: 849689 -Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel -Change-Id: I9448d1b07f8d4116ecdb0c75a7796472e51c6dd8 -Reviewed-on: https://chromium-review.googlesource.com/1087169 -Reviewed-by: Elly Fong-Jones -Reviewed-by: Robert Sesek -Reviewed-by: Tommy Li -Commit-Queue: Elly Fong-Jones -Cr-Commit-Position: refs/heads/master@{#565040} - -diff --git a/components/storage_monitor/image_capture_device.mm b/components/storage_monitor/image_capture_device.mm -index af289bd66eb6..831cb65ac970 100644 ---- a/components/storage_monitor/image_capture_device.mm -+++ b/components/storage_monitor/image_capture_device.mm -@@ -231,4 +231,38 @@ base::FilePath PathForCameraItem(ICCameraItem* item) { - name)); - } - -+// MacOS 10.14 SDK methods, not yet implemented (https://crbug.com/849689) -+- (void)cameraDevice:(ICCameraDevice*)camera -+ didRenameItems:(NSArray*)items { -+ NOTIMPLEMENTED(); -+} -+ -+- (void)cameraDevice:(ICCameraDevice*)camera didRemoveItem:(ICCameraItem*)item { -+ NOTIMPLEMENTED(); -+} -+ -+- (void)cameraDevice:(ICCameraDevice*)camera -+ didCompleteDeleteFilesWithError:(NSError*)error { -+ NOTIMPLEMENTED(); -+} -+ -+- (void)cameraDeviceDidChangeCapability:(ICCameraDevice*)camera { -+ NOTIMPLEMENTED(); -+} -+ -+- (void)cameraDevice:(ICCameraDevice*)camera -+ didReceiveThumbnailForItem:(ICCameraItem*)item { -+ NOTIMPLEMENTED(); -+} -+ -+- (void)cameraDevice:(ICCameraDevice*)camera -+ didReceiveMetadataForItem:(ICCameraItem*)item { -+ NOTIMPLEMENTED(); -+} -+ -+- (void)cameraDevice:(ICCameraDevice*)camera -+ didReceivePTPEvent:(NSData*)eventData { -+ NOTIMPLEMENTED(); -+} -+ - @end // ImageCaptureDevice -diff --git a/media/audio/mac/coreaudio_dispatch_override.cc b/media/audio/mac/coreaudio_dispatch_override.cc -index 2ac812b0f3fc..34d1ad2a0fbe 100644 ---- a/media/audio/mac/coreaudio_dispatch_override.cc -+++ b/media/audio/mac/coreaudio_dispatch_override.cc -@@ -22,6 +22,9 @@ struct dyld_interpose_tuple { - const void* replacement; - const void* replacee; - }; -+ -+using DispatchGetGlobalQueueFunc = dispatch_queue_t (*)(long id, -+ unsigned long flags); - } // namespace - - // This method, and the tuple above, is defined in dyld_priv.h; see: -@@ -175,8 +178,13 @@ bool InitializeCoreAudioDispatchOverride() { - const auto* header = reinterpret_cast(info.dli_fbase); - g_pause_resume_queue = - dispatch_queue_create("org.chromium.CoreAudioPauseResumeQueue", nullptr); -- dyld_interpose_tuple interposition(&GetGlobalQueueOverride, -- &dispatch_get_global_queue); -+ // The reinterpret_cast<> is needed because in the macOS 10.14 SDK, the return -+ // type of dispatch_get_global_queue changed to return a subtype of -+ // dispatch_queue_t* instead of dispatch_queue_t* itself, and T(*)(...) isn't -+ // automatically converted to U(*)(...) even if U is a superclass of T. -+ dyld_interpose_tuple interposition( -+ &GetGlobalQueueOverride, -+ reinterpret_cast(&dispatch_get_global_queue)); - dyld_dynamic_interpose(header, &interposition, 1); - g_dispatch_override_installed = true; - LogInitResult(RESULT_INITIALIZED); --- -2.17.0 - diff --git a/patches/common/chromium/backport_d65792a.patch b/patches/common/chromium/backport_d65792a.patch deleted file mode 100644 index 45715da707f..00000000000 --- a/patches/common/chromium/backport_d65792a.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc -index bf4b1d07f7fe..8435c60a0786 100644 ---- a/ui/views/widget/widget.cc -+++ b/ui/views/widget/widget.cc -@@ -995,7 +995,8 @@ bool Widget::IsTranslucentWindowOpacitySupported() const { - - void Widget::OnSizeConstraintsChanged() { - native_widget_->OnSizeConstraintsChanged(); -- non_client_view_->SizeConstraintsChanged(); -+ if (non_client_view_) -+ non_client_view_->SizeConstraintsChanged(); - } - - void Widget::OnOwnerClosing() {} diff --git a/patches/common/chromium/blink-worker-enable-csp-in-file-scheme.patch b/patches/common/chromium/blink-worker-enable-csp-in-file-scheme.patch index 5f74df4f7b5..04ac8b55727 100644 --- a/patches/common/chromium/blink-worker-enable-csp-in-file-scheme.patch +++ b/patches/common/chromium/blink-worker-enable-csp-in-file-scheme.patch @@ -1,8 +1,14 @@ +From 439ba549807dab957a49a3959dccded956fc1b6b Mon Sep 17 00:00:00 2001 +From: deepak1556 +Date: Thu, 20 Sep 2018 17:47:47 -0700 +Subject: blink-worker-enable-csp-in-file-scheme.patch + + 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 -index 4b47f551f366..227c58a5629d 100644 +index 6e803af108f3..94a72b37ae8e 100644 --- a/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc +++ b/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc -@@ -246,7 +246,6 @@ void WorkerClassicScriptLoader::ProcessContentSecurityPolicy( +@@ -244,7 +244,6 @@ void WorkerClassicScriptLoader::ProcessContentSecurityPolicy( // document (which is implemented in WorkerMessagingProxy, and // m_contentSecurityPolicy should be left as nullptr to inherit the policy). if (!response.Url().ProtocolIs("blob") && @@ -10,3 +16,6 @@ index 4b47f551f366..227c58a5629d 100644 !response.Url().ProtocolIs("filesystem")) { content_security_policy_ = ContentSecurityPolicy::Create(); content_security_policy_->SetOverrideURLForSelf(response.Url()); +-- +2.17.0 + diff --git a/patches/common/chromium/blink_file_path.patch b/patches/common/chromium/blink_file_path.patch index e9a4968da89..fd7230c0107 100644 --- a/patches/common/chromium/blink_file_path.patch +++ b/patches/common/chromium/blink_file_path.patch @@ -1,3 +1,9 @@ +From 50f9d1164c07306d128d9860be5a4891310ef495 Mon Sep 17 00:00:00 2001 +From: Cheng Zhao +Date: Thu, 20 Sep 2018 17:45:00 -0700 +Subject: blink_file_path.patch + + diff --git a/third_party/blink/renderer/core/fileapi/file.h b/third_party/blink/renderer/core/fileapi/file.h index 39831f1902c6..fddb013aa122 100644 --- a/third_party/blink/renderer/core/fileapi/file.h @@ -24,3 +30,6 @@ index a74beceda3e7..7196fd5f5f9e 100644 readonly attribute long long lastModified; // Non-standard APIs +-- +2.17.0 + diff --git a/patches/common/chromium/blink_fix_prototype_assert.patch b/patches/common/chromium/blink_fix_prototype_assert.patch index 7bbfef0ae68..9ca6edfd512 100644 --- a/patches/common/chromium/blink_fix_prototype_assert.patch +++ b/patches/common/chromium/blink_fix_prototype_assert.patch @@ -1,3 +1,15 @@ +From 3ac191f7b549fb23471d357294a84836520d7373 Mon Sep 17 00:00:00 2001 +From: Cheng Zhao +Date: Thu, 20 Sep 2018 17:48:19 -0700 +Subject: blink_fix_prototype_assert.patch + +A recent Chromium change has accidentally added assertion for the case when +a new window object may not have a prototype attached. In Electron it may +happen when preventDefault for a native new-window event. +https://chromium.googlesource.com/chromium/src/+/f47b361887a31cccf42a6e21a82bccf28372bdaa%5E%21 +In the long term we should investigate why it happened, and take a more +formal fix. But for now I'm just make this assertion silently pass away. + diff --git a/third_party/blink/renderer/platform/bindings/v8_object_constructor.cc b/third_party/blink/renderer/platform/bindings/v8_object_constructor.cc index 87f2176ce897..ce3d9ce19bff 100644 --- a/third_party/blink/renderer/platform/bindings/v8_object_constructor.cc @@ -15,3 +27,6 @@ index 87f2176ce897..ce3d9ce19bff 100644 prototype_object = prototype_value.As(); if (prototype_object->InternalFieldCount() == +-- +2.17.0 + diff --git a/patches/common/chromium/blink_initialization_order.patch b/patches/common/chromium/blink_initialization_order.patch index 3fc941ebfc6..6c3286d85be 100644 --- a/patches/common/chromium/blink_initialization_order.patch +++ b/patches/common/chromium/blink_initialization_order.patch @@ -1,12 +1,22 @@ +From d3439444d4aa219c6d3ebacb241bff165a76cf22 Mon Sep 17 00:00:00 2001 +From: Samuel Attard +Date: Thu, 20 Sep 2018 17:50:24 -0700 +Subject: blink_initialization_order.patch + +Backport of https://chromium-review.googlesource.com/c/chromium/src/+/1030530 +to fix the order of V8 and Blink initialization. Also fixes order +of DidCreateScriptContext notification with initialization of window globals +to fix electron/electron#13787. The backport landed in Chromium 67 but the +DidCreateScriptContext re-ordering needs to be upstreamed or kept indefinitely + 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 -index 5c00e3e935b2..43f882eb0883 100644 +index cbd9f811d978..160e5bc7d57a 100644 --- a/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc +++ b/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc -@@ -171,11 +171,11 @@ void LocalWindowProxy::Initialize() { +@@ -177,11 +177,10 @@ void LocalWindowProxy::Initialize() { GetFrame()->IsMainFrame()); - MainThreadDebugger::Instance()->ContextCreated(script_state_.get(), - GetFrame(), origin); -+ + MainThreadDebugger::Instance()->ContextCreated(script_state_, GetFrame(), + origin); + InstallConditionalFeatures(); GetFrame()->Client()->DidCreateScriptContext(context, world_->GetWorldId()); } @@ -16,3 +26,6 @@ index 5c00e3e935b2..43f882eb0883 100644 if (World().IsMainWorld()) { GetFrame()->Loader().DispatchDidClearWindowObjectInMainWorld(); } +-- +2.17.0 + diff --git a/patches/common/chromium/blink_local_frame.patch b/patches/common/chromium/blink_local_frame.patch index 251a0fdc60c..8be99725f3c 100644 --- a/patches/common/chromium/blink_local_frame.patch +++ b/patches/common/chromium/blink_local_frame.patch @@ -1,8 +1,23 @@ +From 791d604902bb958ca62522ce3a50aa496c3f713b Mon Sep 17 00:00:00 2001 +From: Cheng Zhao +Date: Thu, 20 Sep 2018 17:45:03 -0700 +Subject: blink_local_frame.patch + +According to electron/electron#3699, it is unreliable to use |unload| +event for process.exit('exit'), so we have to do that in +willReleaseScriptContext. + +However Chromium then disallowed scripting in willReleaseScriptContext +in https://codereview.chromium.org/1657583002, and crash will happen +when there is code doing that. + +This patch reverts the change to fix the crash in Electron. + diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc -index 5686e6a06d6f..4798d7e36bec 100644 +index 52810bba03b0..65575d432df5 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc -@@ -382,10 +382,6 @@ void LocalFrame::Detach(FrameDetachType type) { +@@ -392,10 +392,6 @@ void LocalFrame::Detach(FrameDetachType type) { } CHECK(!view_ || !view_->IsAttached()); @@ -13,7 +28,7 @@ index 5686e6a06d6f..4798d7e36bec 100644 if (!Client()) return; -@@ -403,6 +399,10 @@ void LocalFrame::Detach(FrameDetachType type) { +@@ -413,6 +409,10 @@ void LocalFrame::Detach(FrameDetachType type) { // Notify ScriptController that the frame is closing, since its cleanup ends // up calling back to LocalFrameClient via WindowProxy. GetScriptController().ClearForClose(); @@ -24,3 +39,6 @@ index 5686e6a06d6f..4798d7e36bec 100644 // TODO(crbug.com/729196): Trace why LocalFrameView::DetachFromLayout crashes. CHECK(!view_->IsAttached()); +-- +2.17.0 + diff --git a/patches/common/chromium/blink_world_context.patch b/patches/common/chromium/blink_world_context.patch index ec0d1996fbf..2df7061f675 100644 --- a/patches/common/chromium/blink_world_context.patch +++ b/patches/common/chromium/blink_world_context.patch @@ -1,8 +1,14 @@ +From 026d3f1ce69e4b94b5168422018c744103437e72 Mon Sep 17 00:00:00 2001 +From: Anonymous +Date: Thu, 20 Sep 2018 17:45:11 -0700 +Subject: blink_world_context.patch + + diff --git a/third_party/blink/public/web/web_local_frame.h b/third_party/blink/public/web/web_local_frame.h -index 601242f8df12..8cb523f82df0 100644 +index 437e8b22c0f5..0ff6b21fd5a9 100644 --- a/third_party/blink/public/web/web_local_frame.h +++ b/third_party/blink/public/web/web_local_frame.h -@@ -427,6 +427,9 @@ class WebLocalFrame : public WebFrame { +@@ -438,6 +438,9 @@ class WebLocalFrame : public WebFrame { // be calling this API. virtual v8::Local MainWorldScriptContext() const = 0; @@ -13,10 +19,10 @@ index 601242f8df12..8cb523f82df0 100644 // that the script evaluated to with callback. Script execution can be // suspend. 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 -index db86ae3c5eb4..602841d00df4 100644 +index 082b055a570c..345d97f888b5 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc -@@ -892,6 +892,13 @@ v8::Local WebLocalFrameImpl::GlobalProxy() const { +@@ -874,6 +874,13 @@ v8::Local WebLocalFrameImpl::GlobalProxy() const { return MainWorldScriptContext()->Global(); } @@ -31,15 +37,18 @@ index db86ae3c5eb4..602841d00df4 100644 return BindingSecurity::ShouldAllowAccessToFrame( CurrentDOMWindow(V8PerIsolateData::MainThreadIsolate()), 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 -index 0adc92eb48f2..a17891ce397c 100644 +index feb4b14bc8e5..95d1cc2c91ca 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.h +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.h -@@ -144,6 +144,8 @@ class CORE_EXPORT WebLocalFrameImpl final +@@ -145,6 +145,8 @@ class CORE_EXPORT WebLocalFrameImpl final int argc, v8::Local argv[]) override; v8::Local MainWorldScriptContext() const override; + v8::Local WorldScriptContext( + v8::Isolate* isolate, int world_id) const override; v8::Local GlobalProxy() const override; - void Reload(WebFrameLoadType) override; + void StartReload(WebFrameLoadType) override; void ReloadImage(const WebNode&) override; +-- +2.17.0 + diff --git a/patches/common/chromium/boringssl_build_gn.patch b/patches/common/chromium/boringssl_build_gn.patch index 3f33e6f2910..768b2ad5b2c 100644 --- a/patches/common/chromium/boringssl_build_gn.patch +++ b/patches/common/chromium/boringssl_build_gn.patch @@ -1,3 +1,11 @@ +From 1e77d2109d61aea5270d1026a7df5fb44e639568 Mon Sep 17 00:00:00 2001 +From: Jeremy Apthorp +Date: Thu, 20 Sep 2018 17:48:05 -0700 +Subject: boringssl_build_gn.patch + +Build BoringSSL with some extra functions that nodejs needs. Only affects +the GN build; with the GYP build, nodejs is still built with OpenSSL. + diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn index d31a9f29fa9c..dea5a6403f4c 100644 --- a/third_party/boringssl/BUILD.gn @@ -16,3 +24,6 @@ index d31a9f29fa9c..dea5a6403f4c 100644 # Windows' assembly is built with Yasm. The other platforms use the platform # assembler. +-- +2.17.0 + diff --git a/patches/common/chromium/browser_compositor_mac.patch b/patches/common/chromium/browser_compositor_mac.patch index 5a8b3f8a384..f69199fbde6 100644 --- a/patches/common/chromium/browser_compositor_mac.patch +++ b/patches/common/chromium/browser_compositor_mac.patch @@ -1,5 +1,11 @@ +From 4b6fd85950701d177879f3a239b19f08c9ff3a66 Mon Sep 17 00:00:00 2001 +From: Cheng Zhao +Date: Thu, 20 Sep 2018 17:45:14 -0700 +Subject: browser_compositor_mac.patch + + diff --git a/content/browser/renderer_host/browser_compositor_view_mac.h b/content/browser/renderer_host/browser_compositor_view_mac.h -index bc9eba153a6a..5200f79afd05 100644 +index 46be85eea4b5..4c816b7021f8 100644 --- a/content/browser/renderer_host/browser_compositor_view_mac.h +++ b/content/browser/renderer_host/browser_compositor_view_mac.h @@ -59,6 +59,8 @@ class CONTENT_EXPORT BrowserCompositorMac : public DelegatedFrameHostClient, @@ -16,15 +22,15 @@ index bc9eba153a6a..5200f79afd05 100644 const gfx::CALayerParams* GetLastCALayerParams() const; + ui::Compositor* GetCompositor(); - gfx::AcceleratedWidget GetAcceleratedWidget(); void DidCreateNewRendererCompositorFrameSink( viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink); + void OnDidNotProduceFrame(const viz::BeginFrameAck& ack); diff --git a/content/browser/renderer_host/browser_compositor_view_mac.mm b/content/browser/renderer_host/browser_compositor_view_mac.mm -index 3d12a1126a0d..7a60368b2c8a 100644 +index 92afcc779106..42bd6fd7c169 100644 --- a/content/browser/renderer_host/browser_compositor_view_mac.mm +++ b/content/browser/renderer_host/browser_compositor_view_mac.mm -@@ -240,6 +240,12 @@ BrowserCompositorMac::~BrowserCompositorMac() { - g_spare_recyclable_compositors.Get().clear(); +@@ -81,6 +81,12 @@ BrowserCompositorMac::~BrowserCompositorMac() { + DCHECK_EQ(1u, num_erased); } +ui::Compositor* BrowserCompositorMac::GetCompositor() { @@ -33,6 +39,9 @@ index 3d12a1126a0d..7a60368b2c8a 100644 + return nullptr; +} + - gfx::AcceleratedWidget BrowserCompositorMac::GetAcceleratedWidget() { - if (recyclable_compositor_) { - return recyclable_compositor_->accelerated_widget_mac() + DelegatedFrameHost* BrowserCompositorMac::GetDelegatedFrameHost() { + DCHECK(delegated_frame_host_); + return delegated_frame_host_.get(); +-- +2.17.0 + diff --git a/patches/common/chromium/browser_plugin_guest.patch b/patches/common/chromium/browser_plugin_guest.patch index da722fc444a..60dbc90f9a2 100644 --- a/patches/common/chromium/browser_plugin_guest.patch +++ b/patches/common/chromium/browser_plugin_guest.patch @@ -1,8 +1,14 @@ +From 402d52b4cf68772c493920f9e4977132918d9b48 Mon Sep 17 00:00:00 2001 +From: Tomas Rycl +Date: Thu, 20 Sep 2018 17:47:25 -0700 +Subject: browser_plugin_guest.patch + + diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc -index a0bc9305e62d..7f022f6cfda7 100644 +index f56ce93c3d5b..19c302c2714f 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.cc +++ b/content/browser/browser_plugin/browser_plugin_guest.cc -@@ -207,8 +207,11 @@ void BrowserPluginGuest::Init() { +@@ -206,8 +206,11 @@ void BrowserPluginGuest::Init() { WebContentsImpl* owner_web_contents = static_cast( delegate_->GetOwnerWebContents()); @@ -16,3 +22,6 @@ index a0bc9305e62d..7f022f6cfda7 100644 } base::WeakPtr BrowserPluginGuest::AsWeakPtr() { +-- +2.17.0 + diff --git a/patches/common/chromium/browser_plugin_wheel.patch b/patches/common/chromium/browser_plugin_wheel.patch index 942b2ddde47..d2c471445ff 100644 --- a/patches/common/chromium/browser_plugin_wheel.patch +++ b/patches/common/chromium/browser_plugin_wheel.patch @@ -1,8 +1,14 @@ +From 4032ed30d0df7f78fde3da3725f8aa3759493e4c Mon Sep 17 00:00:00 2001 +From: Anonymous +Date: Thu, 20 Sep 2018 17:45:21 -0700 +Subject: browser_plugin_wheel.patch + + diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc -index d64895137a73..c42dd6ddf172 100644 +index 4d8251069ae9..fbd5cc809962 100644 --- a/content/renderer/browser_plugin/browser_plugin.cc +++ b/content/renderer/browser_plugin/browser_plugin.cc -@@ -642,15 +642,11 @@ blink::WebInputEventResult BrowserPlugin::HandleInputEvent( +@@ -656,15 +656,11 @@ blink::WebInputEventResult BrowserPlugin::HandleInputEvent( DCHECK(!blink::WebInputEvent::IsTouchEventType(event.GetType())); @@ -23,3 +29,6 @@ index d64895137a73..c42dd6ddf172 100644 if (blink::WebInputEvent::IsGestureEventType(event.GetType())) { auto gesture_event = static_cast(event); +-- +2.17.0 + diff --git a/patches/common/chromium/build_gn.patch b/patches/common/chromium/build_gn.patch index 5a2cb2bf7e3..fdcc9e14a1b 100644 --- a/patches/common/chromium/build_gn.patch +++ b/patches/common/chromium/build_gn.patch @@ -1,5 +1,11 @@ +From aca453bd9e35003bc70adfc77a576492f05c5954 Mon Sep 17 00:00:00 2001 +From: Ales Pergl +Date: Thu, 20 Sep 2018 17:44:29 -0700 +Subject: build_gn.patch + + diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn -index 93a97ff2803f..02c469e930a1 100644 +index fcc00ee0e49f..3232a0360e94 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn @@ -123,6 +123,9 @@ if (current_os == "") { @@ -12,7 +18,7 @@ index 93a97ff2803f..02c469e930a1 100644 # Set to enable the official build level of optimization. This has nothing # to do with branding, but enables an additional level of optimization above # release (!is_debug). This might be better expressed as a tri-state -@@ -527,6 +531,7 @@ default_compiler_configs = [ +@@ -536,6 +539,7 @@ default_compiler_configs = [ "//build/config/compiler:thin_archive", "//build/config/coverage:default_coverage", "//build/config/sanitizers:default_sanitizer_flags", @@ -21,24 +27,28 @@ index 93a97ff2803f..02c469e930a1 100644 if (is_win) { diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn -index 83337d52e4b9..8ec56ca46c74 100644 +index 959a59231746..48f1285c4657 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn -@@ -636,10 +636,13 @@ config("compiler") { - ldflags += [ "-Wl,--lto-O0" ] - } +@@ -634,12 +634,12 @@ config("compiler") { -- cflags += [ "-fwhole-program-vtables" ] -- if (!is_win) { -- ldflags += [ "-fwhole-program-vtables" ] + # TODO(pcc): Re-enable this flag on Android. This will require libc++ to be + # built with ThinLTO (see https://crbug.com/767901) as well as the GVR shim. +- if (!is_android) { +- cflags += [ "-fwhole-program-vtables" ] +- if (!is_win) { +- ldflags += [ "-fwhole-program-vtables" ] +- } - } -+ # -fwhole-program-vtables doesn't work well in Electron right now, as it's -+ # not a single binary and the optimizations break interfaces used across -+ # binary boundaries. -+ # cflags += [ "-fwhole-program-vtables" ] -+ # if (!is_win) { -+ # ldflags += [ "-fwhole-program-vtables" ] -+ #} ++ # if (!is_android) { ++ # cflags += [ "-fwhole-program-vtables" ] ++ # if (!is_win) { ++ # ldflags += [ "-fwhole-program-vtables" ] ++ # } ++ # } # Work-around for http://openradar.appspot.com/20356002 if (is_mac) { +-- +2.17.0 + diff --git a/patches/common/chromium/build_toolchain_win_patch.patch b/patches/common/chromium/build_toolchain_win_patch.patch index e54a83f628a..55c8519bdfc 100644 --- a/patches/common/chromium/build_toolchain_win_patch.patch +++ b/patches/common/chromium/build_toolchain_win_patch.patch @@ -1,8 +1,27 @@ +From 88c91c7f60e6251c35fdb3549a5dd7fc66cfdf3b Mon Sep 17 00:00:00 2001 +From: Anonymous +Date: Wed, 19 Sep 2018 18:55:58 -0700 +Subject: build_toolchain_win_patch.patch + +Patch the Windows build toolchain to generate unique PDB names + +When the PDB files generated by the `static_library` build are +packaged for distribution they are all copied to a single folder, +some of the PDB files have identical names so they end up +overwriting each other. The missing PDB files cause linker warnings +when building Electron in Release mode, and make it more difficult +to debug release builds. + +This patch modifies the PDB naming convention for the +`static_library` build configuration to ensure PDB names are unique. +For example, instead of generating `obj/ui/base/base_cc.pdb` the +build will now generate `obj/ui/base/obj_ui_base_base_cc.pdb`. + diff --git a/build/toolchain/win/BUILD.gn b/build/toolchain/win/BUILD.gn -index 4d9d1f45f870..286c791613ba 100644 +index eb3e2b2b377d..fdffcdbdbbfe 100644 --- a/build/toolchain/win/BUILD.gn +++ b/build/toolchain/win/BUILD.gn -@@ -154,6 +154,12 @@ template("msvc_toolchain") { +@@ -173,6 +173,12 @@ template("msvc_toolchain") { ] command = "$env_wrapper$cl /nologo /showIncludes ${clflags} $sys_include_flags{{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} /c {{source}} /Fo{{output}} /Fd\"$pdbname\"" @@ -15,7 +34,7 @@ index 4d9d1f45f870..286c791613ba 100644 } tool("cxx") { -@@ -170,6 +176,12 @@ template("msvc_toolchain") { +@@ -189,6 +195,12 @@ template("msvc_toolchain") { ] command = "$env_wrapper$cl /nologo /showIncludes ${clflags} $sys_include_flags{{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} /c {{source}} /Fo{{output}} /Fd\"$pdbname\"" @@ -29,10 +48,10 @@ index 4d9d1f45f870..286c791613ba 100644 tool("rc") { diff --git a/build/toolchain/win/tool_wrapper.py b/build/toolchain/win/tool_wrapper.py -index b2cb093377ee..801d7a9b8e03 100644 +index cb0393ecd507..ee21eb4b194b 100644 --- a/build/toolchain/win/tool_wrapper.py +++ b/build/toolchain/win/tool_wrapper.py -@@ -270,6 +270,25 @@ class WinTool(object): +@@ -247,6 +247,25 @@ class WinTool(object): dirname = dirname[0] if dirname else None return subprocess.call(args, shell=True, env=env, cwd=dirname) @@ -58,3 +77,6 @@ index b2cb093377ee..801d7a9b8e03 100644 if __name__ == '__main__': sys.exit(main(sys.argv[1:])) +-- +2.17.0 + diff --git a/patches/common/chromium/can_create_window.patch b/patches/common/chromium/can_create_window.patch index 6fbb8ea8af2..fe8d314ded8 100644 --- a/patches/common/chromium/can_create_window.patch +++ b/patches/common/chromium/can_create_window.patch @@ -1,8 +1,14 @@ +From 0809b4654f69adbc8912ad8922465f46b2d3be18 Mon Sep 17 00:00:00 2001 +From: Cheng Zhao +Date: Thu, 20 Sep 2018 17:45:32 -0700 +Subject: can_create_window.patch + + diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc -index 321a12f74202..7a53675a2139 100644 +index 520dcffb5353..783dc705f748 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc -@@ -3058,6 +3058,38 @@ void RenderFrameHostImpl::CreateNewWindow( +@@ -3142,6 +3142,38 @@ void RenderFrameHostImpl::CreateNewWindow( "frame_tree_node", frame_tree_node_->frame_tree_node_id(), "url", params->target_url.possibly_invalid_spec()); @@ -41,23 +47,19 @@ index 321a12f74202..7a53675a2139 100644 bool no_javascript_access = false; // Filter out URLs to which navigation is disallowed from this context. -@@ -3080,8 +3112,9 @@ void RenderFrameHostImpl::CreateNewWindow( - frame_tree_node_->frame_tree()->GetMainFrame()->GetLastCommittedURL(), +@@ -3170,6 +3202,7 @@ void RenderFrameHostImpl::CreateNewWindow( last_committed_origin_.GetURL(), params->window_container_type, params->target_url, params->referrer, params->frame_name, -- params->disposition, *params->features, params->user_gesture, -- params->opener_suppressed, &no_javascript_access); -+ params->disposition, *params->features, params->additional_features, -+ body, params->user_gesture, params->opener_suppressed, -+ &no_javascript_access); + params->disposition, *params->features, ++ params->additional_features, body, + effective_transient_activation_state, params->opener_suppressed, + &no_javascript_access); - if (!can_create_window) { - std::move(callback).Run(mojom::CreateNewWindowStatus::kIgnore, nullptr); diff --git a/content/browser/security_exploit_browsertest.cc b/content/browser/security_exploit_browsertest.cc -index 9c298b182440..2fcbde75ba47 100644 +index e3b04edb5a30..254f94016b97 100644 --- a/content/browser/security_exploit_browsertest.cc +++ b/content/browser/security_exploit_browsertest.cc -@@ -293,6 +293,7 @@ IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest, +@@ -313,6 +313,7 @@ IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest, mojom::CreateNewWindowParamsPtr params = mojom::CreateNewWindowParams::New(); params->target_url = GURL("about:blank"); @@ -66,10 +68,10 @@ index 9c298b182440..2fcbde75ba47 100644 std::move(params), base::BindOnce([](mojom::CreateNewWindowStatus, mojom::CreateNewWindowReplyPtr) {})); diff --git a/content/common/frame.mojom b/content/common/frame.mojom -index 09b5766c0794..edb604c80d3f 100644 +index fb4732e6e666..804086522994 100644 --- a/content/common/frame.mojom +++ b/content/common/frame.mojom -@@ -11,6 +11,8 @@ import "content/public/common/resource_type.mojom"; +@@ -12,6 +12,8 @@ import "content/public/common/resource_type.mojom"; import "content/public/common/resource_load_info.mojom"; import "content/public/common/transferrable_url_loader.mojom"; import "content/public/common/window_container_type.mojom"; @@ -78,7 +80,7 @@ index 09b5766c0794..edb604c80d3f 100644 import "mojo/public/mojom/base/string16.mojom"; import "mojo/public/mojom/base/unguessable_token.mojom"; import "services/network/public/mojom/url_loader.mojom"; -@@ -148,6 +150,24 @@ interface FrameFactory { +@@ -157,6 +159,24 @@ interface FrameFactory { CreateFrame(int32 frame_routing_id, Frame& frame); }; @@ -102,8 +104,8 @@ index 09b5766c0794..edb604c80d3f 100644 + struct CreateNewWindowParams { // True if this open request came in the context of a user gesture. - bool user_gesture; -@@ -184,6 +204,10 @@ struct CreateNewWindowParams { + // +@@ -196,6 +216,10 @@ struct CreateNewWindowParams { // The window features to use for the new window. blink.mojom.WindowFeatures features; @@ -115,10 +117,10 @@ index 09b5766c0794..edb604c80d3f 100644 // Operation result when the renderer asks the browser to create a new window. diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc -index a8927d0ba8da..396ae3d82ba2 100644 +index 2a896c7072ca..bb54b89bef5c 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc -@@ -401,6 +401,8 @@ bool ContentBrowserClient::CanCreateWindow( +@@ -435,6 +435,8 @@ bool ContentBrowserClient::CanCreateWindow( const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -128,10 +130,10 @@ index a8927d0ba8da..396ae3d82ba2 100644 bool opener_suppressed, bool* no_javascript_access) { diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index e9c6b810e050..3ca627448e33 100644 +index fd5d62fee117..3be31602689c 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h -@@ -153,6 +153,7 @@ class RenderFrameHost; +@@ -162,6 +162,7 @@ class RenderFrameHost; class RenderProcessHost; class RenderViewHost; class ResourceContext; @@ -139,7 +141,7 @@ index e9c6b810e050..3ca627448e33 100644 class ServiceManagerConnection; class SiteInstance; class SpeechRecognitionManagerDelegate; -@@ -651,6 +652,8 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -706,6 +707,8 @@ class CONTENT_EXPORT ContentBrowserClient { const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -149,18 +151,18 @@ index e9c6b810e050..3ca627448e33 100644 bool opener_suppressed, bool* no_javascript_access); diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc -index 4aba7a9e290e..a13cc1599d70 100644 +index 03d9cda9f95d..edad9fc3198c 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc -@@ -78,6 +78,7 @@ +@@ -79,6 +79,7 @@ #include "content/renderer/ime_event_guard.h" #include "content/renderer/internal_document_state_data.h" #include "content/renderer/loader/request_extra_data.h" +#include "content/renderer/loader/web_url_request_util.h" - #include "content/renderer/media/audio_device_factory.h" + #include "content/renderer/media/audio/audio_device_factory.h" #include "content/renderer/media/stream/media_stream_device_observer.h" #include "content/renderer/media/video_capture_impl_manager.h" -@@ -1243,6 +1244,46 @@ WebView* RenderViewImpl::CreateView(WebLocalFrame* creator, +@@ -1270,6 +1271,46 @@ WebView* RenderViewImpl::CreateView(WebLocalFrame* creator, } params->features = ConvertWebWindowFeaturesToMojoWindowFeatures(features); @@ -208,10 +210,10 @@ index 4aba7a9e290e..a13cc1599d70 100644 // moved on send. bool is_background_tab = diff --git a/content/shell/browser/layout_test/layout_test_content_browser_client.cc b/content/shell/browser/layout_test/layout_test_content_browser_client.cc -index 3a908d742130..52294125b799 100644 +index fe0e3720ea5d..4a31617b5a89 100644 --- a/content/shell/browser/layout_test/layout_test_content_browser_client.cc +++ b/content/shell/browser/layout_test/layout_test_content_browser_client.cc -@@ -247,6 +247,8 @@ bool LayoutTestContentBrowserClient::CanCreateWindow( +@@ -276,6 +276,8 @@ bool LayoutTestContentBrowserClient::CanCreateWindow( const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -221,10 +223,10 @@ index 3a908d742130..52294125b799 100644 bool opener_suppressed, bool* no_javascript_access) { diff --git a/content/shell/browser/layout_test/layout_test_content_browser_client.h b/content/shell/browser/layout_test/layout_test_content_browser_client.h -index d0ba19167522..3d1154b3cb8a 100644 +index fa458cf0c92d..cdd95a1d88e5 100644 --- a/content/shell/browser/layout_test/layout_test_content_browser_client.h +++ b/content/shell/browser/layout_test/layout_test_content_browser_client.h -@@ -67,6 +67,8 @@ class LayoutTestContentBrowserClient : public ShellContentBrowserClient { +@@ -66,6 +66,8 @@ class LayoutTestContentBrowserClient : public ShellContentBrowserClient { const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -233,3 +235,6 @@ index d0ba19167522..3d1154b3cb8a 100644 bool user_gesture, bool opener_suppressed, bool* no_javascript_access) override; +-- +2.17.0 + diff --git a/patches/common/chromium/chrome_key_systems.patch b/patches/common/chromium/chrome_key_systems.patch index 30e26a2747b..7aa3b9981de 100644 --- a/patches/common/chromium/chrome_key_systems.patch +++ b/patches/common/chromium/chrome_key_systems.patch @@ -1,8 +1,16 @@ +From 63fb1abe3afa2b19ac0640b462658e6f286b3c6c Mon Sep 17 00:00:00 2001 +From: deepak1556 +Date: Thu, 20 Sep 2018 17:50:13 -0700 +Subject: chrome_key_systems.patch + +Disable persiste licence support check for widevine cdm, +as its not supported in the current version of chrome. + diff --git a/chrome/renderer/media/chrome_key_systems.cc b/chrome/renderer/media/chrome_key_systems.cc -index c0cf00b5da05..992827ca6782 100644 +index 5c38d0b1ce7c..4ffaf2a3301e 100644 --- a/chrome/renderer/media/chrome_key_systems.cc +++ b/chrome/renderer/media/chrome_key_systems.cc -@@ -14,7 +14,9 @@ +@@ -15,7 +15,9 @@ #include "base/strings/string_split.h" #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" @@ -12,10 +20,10 @@ index c0cf00b5da05..992827ca6782 100644 #include "components/cdm/renderer/external_clear_key_key_system_properties.h" #include "components/cdm/renderer/widevine_key_system_properties.h" #include "content/public/renderer/render_thread.h" -@@ -142,12 +144,14 @@ static void AddExternalClearKey( - #if defined(WIDEVINE_CDM_AVAILABLE) +@@ -185,12 +187,14 @@ static SupportedCodecs GetSupportedCodecs( // Returns persistent-license session support. - EmeSessionTypeSupport GetPersistentLicenseSupport(bool supported_by_the_cdm) { + static EmeSessionTypeSupport GetPersistentLicenseSupport( + bool supported_by_the_cdm) { +#if 0 // Do not support persistent-license if the process cannot persist data. // TODO(crbug.com/457487): Have a better plan on this. See bug for details. @@ -27,3 +35,6 @@ index c0cf00b5da05..992827ca6782 100644 if (!supported_by_the_cdm) { DVLOG(2) << __func__ << ": Not supported by the CDM."; +-- +2.17.0 + diff --git a/patches/common/chromium/compositor_delegate.patch b/patches/common/chromium/compositor_delegate.patch index 411d7523f4c..2876c832fc4 100644 --- a/patches/common/chromium/compositor_delegate.patch +++ b/patches/common/chromium/compositor_delegate.patch @@ -1,8 +1,14 @@ +From df47eeaea5e574c7af03eed15d384ad9cad58fb1 Mon Sep 17 00:00:00 2001 +From: Anonymous +Date: Thu, 20 Sep 2018 17:45:36 -0700 +Subject: compositor_delegate.patch + + diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc -index e679dbb02a81..d90a276fc0e1 100644 +index 511d805187b1..5fb01fee0378 100644 --- a/content/browser/compositor/gpu_process_transport_factory.cc +++ b/content/browser/compositor/gpu_process_transport_factory.cc -@@ -507,10 +507,20 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( +@@ -494,10 +494,20 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( // surfaces as they are not following the correct mode. DisableGpuCompositing(compositor.get()); } @@ -26,7 +32,7 @@ index e679dbb02a81..d90a276fc0e1 100644 } else { DCHECK(context_provider); diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h -index eb250697ebd6..36be87675e9a 100644 +index e0ec33400b17..29ba88a504c3 100644 --- a/ui/compositor/compositor.h +++ b/ui/compositor/compositor.h @@ -24,6 +24,7 @@ @@ -37,8 +43,8 @@ index eb250697ebd6..36be87675e9a 100644 #include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkMatrix44.h" #include "ui/compositor/compositor_animation_observer.h" -@@ -183,6 +184,15 @@ class COMPOSITOR_EXPORT ContextFactory { - virtual void RemoveObserver(ContextFactoryObserver* observer) = 0; +@@ -199,6 +200,15 @@ class COMPOSITOR_EXPORT ContextFactory { + virtual bool SyncTokensRequiredForDisplayCompositor() = 0; }; +class COMPOSITOR_EXPORT CompositorDelegate { @@ -53,7 +59,7 @@ index eb250697ebd6..36be87675e9a 100644 // Compositor object to take care of GPU painting. // A Browser compositor object is responsible for generating the final // displayable form of pixels comprising a single widget's contents. It draws an -@@ -222,6 +232,9 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient, +@@ -239,6 +249,9 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient, // Schedules a redraw of the layer tree associated with this compositor. void ScheduleDraw(); @@ -63,7 +69,7 @@ index eb250697ebd6..36be87675e9a 100644 // Sets the root of the layer tree drawn by this Compositor. The root layer // must have no parent. The compositor's root layer is reset if the root layer // is destroyed. NULL can be passed to reset the root layer, in which case the -@@ -447,6 +460,8 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient, +@@ -461,6 +474,8 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient, ui::ContextFactory* context_factory_; ui::ContextFactoryPrivate* context_factory_private_; @@ -72,3 +78,6 @@ index eb250697ebd6..36be87675e9a 100644 // The root of the Layer tree drawn by this compositor. Layer* root_layer_ = nullptr; +-- +2.17.0 + diff --git a/patches/common/chromium/crashpad_http_status.patch b/patches/common/chromium/crashpad_http_status.patch index 20e1e439d92..e6a8ad9354c 100644 --- a/patches/common/chromium/crashpad_http_status.patch +++ b/patches/common/chromium/crashpad_http_status.patch @@ -25,10 +25,10 @@ index 8d5f78c..a433bb3 100644 implicit_cast(http_status)); return false; diff --git a/third_party/crashpad/crashpad/util/net/http_transport_socket.cc b/third_party/crashpad/crashpad/util/net/http_transport_socket.cc -index f0e2dc1..34d8dee 100644 +index f0e2dc14a8a4..34d8deeb5c25 100644 --- a/third_party/crashpad/crashpad/util/net/http_transport_socket.cc +++ b/third_party/crashpad/crashpad/util/net/http_transport_socket.cc -@@ -457,10 +457,18 @@ +@@ -457,10 +457,18 @@ bool ReadResponseLine(Stream* stream) { LOG(ERROR) << "ReadLine"; return false; } @@ -49,8 +49,8 @@ index f0e2dc1..34d8dee 100644 + &http_status) && + http_status >= 200 && http_status <= 203; } - - bool ReadResponseHeaders(int sock, HTTPHeaders* headers) { + + bool ReadResponseHeaders(Stream* stream, HTTPHeaders* headers) { diff --git a/third_party/crashpad/crashpad/util/net/http_transport_test.cc b/third_party/crashpad/crashpad/util/net/http_transport_test.cc index 7b5f41d..d73dc99 100644 --- a/third_party/crashpad/crashpad/util/net/http_transport_test.cc diff --git a/patches/common/chromium/dcheck.patch b/patches/common/chromium/dcheck.patch index 918e7c5fb95..66456e942da 100644 --- a/patches/common/chromium/dcheck.patch +++ b/patches/common/chromium/dcheck.patch @@ -1,27 +1,82 @@ +From 0a8757b6650df0e762cc4ec400ecb7ee8ca7be4a Mon Sep 17 00:00:00 2001 +From: deepak1556 +Date: Thu, 20 Sep 2018 17:44:38 -0700 +Subject: dcheck.patch + +This disables some debug checks which currently fail when running the Electron +test suite. In general there should be sustained effort to have all debug checks +enabled. If you want to help, choose one of the diffs below and remove it. Then +build Electron (debug configuration) and make sure all tests pass on the CI +systems. Unfortunately the tests don't always cover the check failures, so it's +good to also run some non-trivial Electron app to verify. + +Apart from getting rid of a whole diff, you may also be able to replace one diff +with another which enables at least some of the previously disabled checks. For +example, the checks might be disabled for a whole build target, but actually +only one or two specific checks fail. Then it's better to simply comment out the +failing checks and allow the rest of the target to have them enabled. + +Please keep the following lists updated. + +The ELECTRON_NO_DCHECK build flag disables debug checks universally. +This patch applies the flag to the following GN targets: + + third_party/blink/renderer/core/loader:loader + url:url + +These files have debug checks explicitly commented out: + + base/memory/weak_ptr.cc + base/process/kill_win.cc + components/viz/service/display/program_binding.h + components/viz/service/display_embedder/server_shared_bitmap_manager.cc + content/browser/frame_host/navigation_controller_impl.cc + content/browser/frame_host/render_frame_host_impl.cc + content/browser/renderer_host/render_widget_host_view_mac.mm + ppapi/host/ppapi_host.cc + third_party/blink/renderer/core/dom/node.cc + third_party/blink/renderer/platform/wtf/text/string_impl.cc + ui/base/clipboard/clipboard_win.cc + diff --git a/base/logging.h b/base/logging.h -index 29960599a5c6..7352201e7b66 100644 +index 08c1f0fc5967..7a758ce3ef90 100644 --- a/base/logging.h +++ b/base/logging.h @@ -874,7 +874,7 @@ const LogSeverity LOG_DCHECK = LOG_FATAL; - + #else // !(defined(_PREFAST_) && defined(OS_WIN)) - + -#if DCHECK_IS_ON() +#if DCHECK_IS_ON() && !defined(ELECTRON_NO_DCHECK) - + #define DCHECK(condition) \ LAZY_STREAM(LOG_STREAM(DCHECK), !ANALYZER_ASSUME_TRUE(condition)) \ +diff --git a/base/memory/weak_ptr.cc b/base/memory/weak_ptr.cc +index c993fcb8a13a..80a5b708d259 100644 +--- a/base/memory/weak_ptr.cc ++++ b/base/memory/weak_ptr.cc +@@ -25,8 +25,8 @@ void WeakReference::Flag::Invalidate() { + } + + bool WeakReference::Flag::IsValid() const { +- DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_) +- << "WeakPtrs must be checked on the same sequenced thread."; ++ // DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_) ++ // << "WeakPtrs must be checked on the same sequenced thread."; + return !invalidated_.IsSet(); + } + diff --git a/base/process/kill_win.cc b/base/process/kill_win.cc index 7a664429bcd3..26f49dc3d1e7 100644 --- a/base/process/kill_win.cc +++ b/base/process/kill_win.cc @@ -23,7 +23,7 @@ TerminationStatus GetTerminationStatus(ProcessHandle handle, int* exit_code) { DWORD tmp_exit_code = 0; - + if (!::GetExitCodeProcess(handle, &tmp_exit_code)) { - DPLOG(FATAL) << "GetExitCodeProcess() failed"; + // DPLOG(FATAL) << "GetExitCodeProcess() failed"; - + // This really is a random number. We haven't received any // information about the exit code, presumably because this diff --git a/base/process/process_metrics_win.cc b/base/process/process_metrics_win.cc @@ -43,10 +98,10 @@ index 18ef58a725c3..239f319c8b4c 100644 } } diff --git a/components/viz/service/display/program_binding.h b/components/viz/service/display/program_binding.h -index 8b28c57f854e..a0e7056af23f 100644 +index 2a8fb9f54847..2c318b310b2a 100644 --- a/components/viz/service/display/program_binding.h +++ b/components/viz/service/display/program_binding.h -@@ -433,7 +433,7 @@ class VIZ_SERVICE_EXPORT Program : public ProgramBindingBase { +@@ -434,7 +434,7 @@ class VIZ_SERVICE_EXPORT Program : public ProgramBindingBase { if (!ProgramBindingBase::Init(context_provider->ContextGL(), vertex_shader_.GetShaderString(), fragment_shader_.GetShaderString())) { @@ -54,37 +109,37 @@ index 8b28c57f854e..a0e7056af23f 100644 + // DCHECK(IsContextLost(context_provider->ContextGL())); return; } - -@@ -445,7 +445,7 @@ class VIZ_SERVICE_EXPORT Program : public ProgramBindingBase { - + +@@ -446,7 +446,7 @@ class VIZ_SERVICE_EXPORT Program : public ProgramBindingBase { + // Link after binding uniforms if (!Link(context_provider->ContextGL())) { - DCHECK(IsContextLost(context_provider->ContextGL())); + // DCHECK(IsContextLost(context_provider->ContextGL())); return; } - + diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc -index 74ff6b4286c2..02bf1c55d86f 100644 +index d8aca9e2cbff..86224ab7a3c5 100644 --- a/content/browser/frame_host/navigation_controller_impl.cc +++ b/content/browser/frame_host/navigation_controller_impl.cc -@@ -1083,8 +1083,10 @@ NavigationType NavigationControllerImpl::ClassifyNavigation( +@@ -995,8 +995,10 @@ NavigationType NavigationControllerImpl::ClassifyNavigation( return NAVIGATION_TYPE_NEW_SUBFRAME; } - + - // We only clear the session history when navigating to a new page. - DCHECK(!params.history_list_was_cleared); + // Electron does its own book keeping of navigation entries and we + // expect content to not track any, by clearing history list for + // all navigations. + // DCHECK(!params.history_list_was_cleared); - + if (rfh->GetParent()) { // All manual subframes would be did_create_new_entry and handled above, so -@@ -1305,7 +1307,10 @@ void NavigationControllerImpl::RendererDidNavigateToNewPage( +@@ -1233,7 +1235,10 @@ void NavigationControllerImpl::RendererDidNavigateToNewPage( new_entry->GetFavicon() = GetLastCommittedEntry()->GetFavicon(); } - + - DCHECK(!params.history_list_was_cleared || !replace_entry); + // Electron does its own book keeping of navigation entries and we + // expect content to not track any, by clearing history list for @@ -94,12 +149,12 @@ index 74ff6b4286c2..02bf1c55d86f 100644 // navigation. Now we know that the renderer has updated its state accordingly // and it is safe to also clear the browser side history. diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc -index cd755cbc3f2c..321a12f74202 100644 +index 8e5af3e3b9c5..520dcffb5353 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc -@@ -2345,8 +2345,10 @@ void RenderFrameHostImpl::AllowBindings(int bindings_flags) { +@@ -2416,8 +2416,10 @@ void RenderFrameHostImpl::AllowBindings(int bindings_flags) { } - + enabled_bindings_ |= bindings_flags; - if (GetParent()) - DCHECK_EQ(GetParent()->GetEnabledBindings(), GetEnabledBindings()); @@ -107,43 +162,28 @@ index cd755cbc3f2c..321a12f74202 100644 + // Fix this when we use OOPIF in Electron. + // if (GetParent()) + // DCHECK_EQ(GetParent()->GetEnabledBindings(), GetEnabledBindings()); - + if (render_frame_created_) { if (!frame_bindings_control_) -diff --git a/content/browser/renderer_host/render_widget_host_view_cocoa.mm b/content/browser/renderer_host/render_widget_host_view_cocoa.mm -index d86576cc36ac..5b4ae0732914 100644 ---- a/content/browser/renderer_host/render_widget_host_view_cocoa.mm -+++ b/content/browser/renderer_host/render_widget_host_view_cocoa.mm -@@ -650,8 +650,8 @@ void ExtractUnderlines(NSAttributedString* string, - if (EventIsReservedBySystem(theEvent)) - return; - -- DCHECK(eventType != NSKeyDown || -- !equiv == !(modifierFlags & NSCommandKeyMask)); -+ // DCHECK(eventType != NSKeyDown || -+ // !equiv == !(modifierFlags & NSCommandKeyMask)); - - if (eventType == NSFlagsChanged) { - // Ignore NSFlagsChanged events from the NumLock and Fn keys as diff --git a/ppapi/host/ppapi_host.cc b/ppapi/host/ppapi_host.cc -index f3c68fab3de6..b8609daf3ef9 100644 +index 3f80e73535c8..bf40b94ad24c 100644 --- a/ppapi/host/ppapi_host.cc +++ b/ppapi/host/ppapi_host.cc -@@ -240,7 +240,7 @@ void PpapiHost::OnHostMsgResourceCreated( +@@ -238,7 +238,7 @@ void PpapiHost::OnHostMsgResourceCreated( CreateResourceHost(params.pp_resource(), instance, nested_msg); - + if (!resource_host.get()) { - NOTREACHED(); + // NOTREACHED(); return; } - + diff --git a/third_party/blink/renderer/core/dom/node.cc b/third_party/blink/renderer/core/dom/node.cc -index ca47b2d09693..b4b6ce96209b 100644 +index 5629f8170851..bc773ac9b1e4 100644 --- a/third_party/blink/renderer/core/dom/node.cc +++ b/third_party/blink/renderer/core/dom/node.cc -@@ -2535,7 +2535,7 @@ StaticNodeList* Node::getDestinationInsertionPoints() { - +@@ -2568,7 +2568,7 @@ StaticNodeList* Node::getDestinationInsertionPoints() { + HTMLSlotElement* Node::AssignedSlot() const { // assignedSlot doesn't need to call updateDistribution(). - DCHECK(!IsPseudoElement()); @@ -152,10 +192,10 @@ index ca47b2d09693..b4b6ce96209b 100644 return root->AssignedSlotFor(*this); return nullptr; diff --git a/third_party/blink/renderer/core/loader/BUILD.gn b/third_party/blink/renderer/core/loader/BUILD.gn -index 82f6e8bc9d33..ccad95d61a4a 100644 +index 49b4ead3dc52..0083e5c8efb7 100644 --- a/third_party/blink/renderer/core/loader/BUILD.gn +++ b/third_party/blink/renderer/core/loader/BUILD.gn -@@ -129,4 +129,11 @@ blink_core_sources("loader") { +@@ -135,4 +135,11 @@ blink_core_sources("loader") { public_deps = [ "//third_party/blink/renderer/platform", ] @@ -168,12 +208,12 @@ index 82f6e8bc9d33..ccad95d61a4a 100644 + } } diff --git a/third_party/blink/renderer/platform/wtf/text/string_impl.h b/third_party/blink/renderer/platform/wtf/text/string_impl.h -index 158d81ca9ba2..1b6aafecadef 100644 +index 0e7c40b732ec..7c513d95a586 100644 --- a/third_party/blink/renderer/platform/wtf/text/string_impl.h +++ b/third_party/blink/renderer/platform/wtf/text/string_impl.h @@ -258,21 +258,21 @@ class WTF_EXPORT StringImpl { } - + ALWAYS_INLINE bool HasOneRef() const { -#if DCHECK_IS_ON() +#if 0 @@ -181,7 +221,7 @@ index 158d81ca9ba2..1b6aafecadef 100644 #endif return ref_count_ == 1; } - + ALWAYS_INLINE void AddRef() const { -#if DCHECK_IS_ON() +#if 0 @@ -189,7 +229,7 @@ index 158d81ca9ba2..1b6aafecadef 100644 #endif ++ref_count_; } - + ALWAYS_INLINE void Release() const { -#if DCHECK_IS_ON() +#if 0 @@ -202,7 +242,7 @@ index e49dd8c81270..9e61c901cd2d 100644 +++ b/ui/base/clipboard/clipboard_win.cc @@ -905,9 +905,9 @@ void ClipboardWin::WriteBitmapFromHandle(HBITMAP source_hbitmap, } - + void ClipboardWin::WriteToClipboard(unsigned int format, HANDLE handle) { - DCHECK(clipboard_owner_->hwnd() != NULL); + // DCHECK(clipboard_owner_->hwnd() != NULL); @@ -213,7 +253,7 @@ index e49dd8c81270..9e61c901cd2d 100644 } } diff --git a/url/BUILD.gn b/url/BUILD.gn -index c4deb10db9ca..ecc068d7447a 100644 +index 57bbe16c15ea..07725187c595 100644 --- a/url/BUILD.gn +++ b/url/BUILD.gn @@ -98,6 +98,10 @@ component("url") { @@ -225,8 +265,7 @@ index c4deb10db9ca..ecc068d7447a 100644 + defines += [ "ELECTRON_NO_DCHECK" ] + } } - - if (is_android) { --- -2.17.0 + if (is_android) { +-- +2.17.0 diff --git a/patches/common/chromium/desktop_screen_win.patch b/patches/common/chromium/desktop_screen_win.patch index 0fe31a35126..62f6f4de17b 100644 --- a/patches/common/chromium/desktop_screen_win.patch +++ b/patches/common/chromium/desktop_screen_win.patch @@ -1,3 +1,9 @@ +From 0dbac64c4877f7783726d3bc04f332a1491285b7 Mon Sep 17 00:00:00 2001 +From: Anonymous +Date: Thu, 20 Sep 2018 17:45:44 -0700 +Subject: desktop_screen_win.patch + + diff --git a/ui/views/widget/desktop_aura/desktop_screen_win.cc b/ui/views/widget/desktop_aura/desktop_screen_win.cc index f772f64d656e..7d13f9f81b6c 100644 --- a/ui/views/widget/desktop_aura/desktop_screen_win.cc @@ -11,3 +17,6 @@ index f772f64d656e..7d13f9f81b6c 100644 aura::WindowTreeHost* host = window->GetHost(); return host ? host->GetAcceleratedWidget() : NULL; } +-- +2.17.0 + diff --git a/patches/common/chromium/disable-redraw-lock.patch b/patches/common/chromium/disable-redraw-lock.patch index 60c46954025..98676491856 100644 --- a/patches/common/chromium/disable-redraw-lock.patch +++ b/patches/common/chromium/disable-redraw-lock.patch @@ -1,8 +1,24 @@ +From 2067d5a31905f889d7537c4a4ab680577bb5e75f Mon Sep 17 00:00:00 2001 +From: Heilig Benedek +Date: Thu, 20 Sep 2018 17:47:54 -0700 +Subject: disable-redraw-lock.patch + +Chromium uses a custom window titlebar implementation on Windows when DWM +is disabled (Windows 7 and earlier, non Aero theme). The native titlebar +sometimes painted over this custom titlebar, so a workaround was put in +place to lock redraws in reaction to certain events if DWM is disabled, +since the code assumes that in that case, the custom titlebar is painted. +Electron forces the use of the native titlebar, which the workaround doesn't +take into account, and still locks redraws, causing weird repainting issues +in electron (and other applications). This patch provides a way to disable +the redraw locking mechanism, which fixes these issues. The electron issue +can be found at https://github.com/electron/electron/issues/1821 + diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index cadeb2322620..3c5d1afbdfee 100644 +index d5f442f71da7..a8f39b060115 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -256,6 +256,10 @@ const int kSynthesizedMouseMessagesTimeDifference = 500; +@@ -281,6 +281,10 @@ const int kSynthesizedMouseMessagesTimeDifference = 500; } // namespace @@ -13,7 +29,7 @@ index cadeb2322620..3c5d1afbdfee 100644 // A scoping class that prevents a window from being able to redraw in response // to invalidations that may occur within it for the lifetime of the object. // -@@ -307,6 +311,7 @@ class HWNDMessageHandler::ScopedRedrawLock { +@@ -332,6 +336,7 @@ class HWNDMessageHandler::ScopedRedrawLock { cancel_unlock_(false), should_lock_(owner_->IsVisible() && !owner->HasChildRenderingWindow() && ::IsWindow(hwnd_) && @@ -21,7 +37,7 @@ index cadeb2322620..3c5d1afbdfee 100644 (!(GetWindowLong(hwnd_, GWL_STYLE) & WS_CAPTION) || !ui::win::IsAeroGlassEnabled())) { if (should_lock_) -@@ -898,6 +903,10 @@ bool HWNDMessageHandler::HasChildRenderingWindow() { +@@ -940,6 +945,10 @@ bool HWNDMessageHandler::HasChildRenderingWindow() { hwnd()); } @@ -33,10 +49,10 @@ index cadeb2322620..3c5d1afbdfee 100644 // HWNDMessageHandler, gfx::WindowImpl overrides: diff --git a/ui/views/win/hwnd_message_handler.h b/ui/views/win/hwnd_message_handler.h -index 5afb32aa043c..3d17f29dff9a 100644 +index 91afedec8e29..fa514d102538 100644 --- a/ui/views/win/hwnd_message_handler.h +++ b/ui/views/win/hwnd_message_handler.h -@@ -177,6 +177,8 @@ class VIEWS_EXPORT HWNDMessageHandler : public gfx::WindowImpl, +@@ -181,6 +181,8 @@ class VIEWS_EXPORT HWNDMessageHandler : public gfx::WindowImpl, typedef std::set TouchIDs; enum class DwmFrameState { OFF, ON }; @@ -58,3 +74,6 @@ index 1b2d98a85738..dd080180aebd 100644 // Returns who we want to be drawing the frame. Either the system (Windows) // will handle it or Chrome will custom draw it. virtual FrameMode GetFrameMode() const = 0; +-- +2.17.0 + diff --git a/patches/common/chromium/disable_detach_webview_frame.patch b/patches/common/chromium/disable_detach_webview_frame.patch index f97caf6ab91..51dc6ba2a9f 100644 --- a/patches/common/chromium/disable_detach_webview_frame.patch +++ b/patches/common/chromium/disable_detach_webview_frame.patch @@ -1,8 +1,19 @@ +From 4d1fb504c014998e2cc80b63db3a820dd73adbec Mon Sep 17 00:00:00 2001 +From: zcbenz +Date: Thu, 20 Sep 2018 17:50:27 -0700 +Subject: disable_detach_webview_frame.patch + +Don't detach the frame for webview, we will manage the WebContents +manually. +This is part of the fixes for https://github.com/electron/electron/issues/14211. +We should revisit this bug after upgrading to newer versions of Chrome, +this patch was introduced in Chrome 66. + diff --git a/content/browser/frame_host/render_frame_proxy_host.cc b/content/browser/frame_host/render_frame_proxy_host.cc -index 838bc1e20c30..2aa16fbf19fc 100644 +index b06a4b9242d3..b7793aaa094a 100644 --- a/content/browser/frame_host/render_frame_proxy_host.cc +++ b/content/browser/frame_host/render_frame_proxy_host.cc -@@ -260,6 +260,12 @@ void RenderFrameProxyHost::SetDestructionCallback( +@@ -286,6 +286,12 @@ void RenderFrameProxyHost::SetDestructionCallback( void RenderFrameProxyHost::OnDetach() { if (frame_tree_node_->render_manager()->ForInnerDelegate()) { @@ -15,3 +26,6 @@ index 838bc1e20c30..2aa16fbf19fc 100644 // Only main frame proxy can detach for inner WebContents. DCHECK(frame_tree_node_->IsMainFrame()); frame_tree_node_->render_manager()->RemoveOuterDelegateFrame(); +-- +2.17.0 + diff --git a/patches/common/chromium/disable_extensions_gn.patch b/patches/common/chromium/disable_extensions_gn.patch index 8a5014c2e2f..89e3a6eb561 100644 --- a/patches/common/chromium/disable_extensions_gn.patch +++ b/patches/common/chromium/disable_extensions_gn.patch @@ -1,5 +1,12 @@ +From 790e1e19af133252e95e3a4de8c8e7a3a011bf02 Mon Sep 17 00:00:00 2001 +From: deepak1556 +Date: Thu, 20 Sep 2018 17:50:48 -0700 +Subject: disable_extensions_gn.patch + +Fix build files generation when chrome extensions are disabled. + diff --git a/chrome/browser/apps/app_shim/BUILD.gn b/chrome/browser/apps/app_shim/BUILD.gn -index b480129fcd7c..4f4f7d06029b 100644 +index f8a6d1868788..350c3572ec54 100644 --- a/chrome/browser/apps/app_shim/BUILD.gn +++ b/chrome/browser/apps/app_shim/BUILD.gn @@ -1,6 +1,7 @@ @@ -19,8 +26,8 @@ index b480129fcd7c..4f4f7d06029b 100644 "unix_domain_socket_acceptor.cc", "unix_domain_socket_acceptor.h", ] -@@ -23,7 +22,16 @@ source_set("app_shim") { - deps = [ +@@ -24,7 +23,16 @@ source_set("app_shim") { + "//chrome/common:mojo_bindings", "//content/public/browser", "//content/public/common", - "//extensions/browser", @@ -39,18 +46,20 @@ index b480129fcd7c..4f4f7d06029b 100644 + } } diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn -index c514878fafe7..bcd3432f75c9 100644 +index 1b14d628a63b..00401612c191 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn -@@ -2495,7 +2495,10 @@ split_static_library("ui") { +@@ -2570,7 +2570,10 @@ split_static_library("ui") { "views/tabs/window_finder_mac.mm", ] - + - deps += [ "//extensions/components/native_app_window" ] + + if (enable_extensions) { + deps += [ "//extensions/components/native_app_window" ] + } - + # Truly cocoa-browser-specific sources. These are secondary UI pieces that # are obsolete before mac_views_browser will ever ship, so they aren't +-- +2.17.0 diff --git a/patches/common/chromium/disable_hidden.patch b/patches/common/chromium/disable_hidden.patch index 3dd9128b674..34a6b1d6a79 100644 --- a/patches/common/chromium/disable_hidden.patch +++ b/patches/common/chromium/disable_hidden.patch @@ -1,8 +1,14 @@ +From 624474e13fd8533e9e1f69e3d9b2d551c8fb807a Mon Sep 17 00:00:00 2001 +From: Cheng Zhao +Date: Thu, 20 Sep 2018 17:45:47 -0700 +Subject: disable_hidden.patch + + diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index 213f32e0891f..60cfacdcf9fc 100644 +index 9ab96c3f933b..28879dc5e9bb 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc -@@ -668,6 +668,9 @@ void RenderWidgetHostImpl::WasHidden() { +@@ -712,6 +712,9 @@ void RenderWidgetHostImpl::WasHidden() { if (is_hidden_) return; @@ -13,10 +19,10 @@ index 213f32e0891f..60cfacdcf9fc 100644 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::WasHidden"); diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h -index 316385180c60..afce0525e89d 100644 +index 4af5870e7c40..f2e19fe92e56 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h -@@ -149,6 +149,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl +@@ -154,6 +154,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl // RenderWidgetHostImpl. static RenderWidgetHostImpl* From(RenderWidgetHost* rwh); @@ -26,3 +32,6 @@ index 316385180c60..afce0525e89d 100644 void set_hung_renderer_delay(const base::TimeDelta& delay) { hung_renderer_delay_ = delay; } +-- +2.17.0 + diff --git a/patches/common/chromium/disable_scroll_begin_dcheck.patch b/patches/common/chromium/disable_scroll_begin_dcheck.patch index c120a4991ff..8fb032e3df4 100644 --- a/patches/common/chromium/disable_scroll_begin_dcheck.patch +++ b/patches/common/chromium/disable_scroll_begin_dcheck.patch @@ -1,21 +1,30 @@ +From 56f1078f33969f1d3c097b398a10d251ea774add Mon Sep 17 00:00:00 2001 +From: Cheng Zhao +Date: Thu, 20 Sep 2018 17:48:27 -0700 +Subject: disable_scroll_begin_dcheck.patch + +When testing https://github.com/electron/electron/issues/13137 I have met +these assertions. I grouped them together since they are all related to the +ScrollBegin event. + diff --git a/content/browser/renderer_host/input/mouse_wheel_event_queue.cc b/content/browser/renderer_host/input/mouse_wheel_event_queue.cc -index c3f4641e8525..dd50ff1c2557 100644 +index 702915772e4f..71fb66a7401c 100644 --- a/content/browser/renderer_host/input/mouse_wheel_event_queue.cc +++ b/content/browser/renderer_host/input/mouse_wheel_event_queue.cc -@@ -362,7 +362,7 @@ void MouseWheelEventQueue::SendScrollBegin( - (synthetic && !needs_scroll_begin_when_scroll_latching_disabled_) || - needs_scroll_begin_when_scroll_latching_disabled_); - +@@ -295,7 +295,7 @@ void MouseWheelEventQueue::SendScrollEnd(WebGestureEvent update_event, + void MouseWheelEventQueue::SendScrollBegin( + const WebGestureEvent& gesture_update, + bool synthetic) { - DCHECK(!client_->IsWheelScrollInProgress()); + // DCHECK(!client_->IsWheelScrollInProgress()); WebGestureEvent scroll_begin(gesture_update); scroll_begin.SetType(WebInputEvent::kGestureScrollBegin); diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index 9b930b8acd1d..f3d356f86f15 100644 +index 28879dc5e9bb..222b5d7e91ec 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc -@@ -1263,8 +1263,8 @@ void RenderWidgetHostImpl::ForwardGestureEventWithLatencyInfo( +@@ -1321,8 +1321,8 @@ void RenderWidgetHostImpl::ForwardGestureEventWithLatencyInfo( // GSB and GSU events instead of sending them to the renderer and continues // to progress the fling. So, the renderer doesn't receive two GSB events // without any GSE in between. @@ -26,3 +35,6 @@ index 9b930b8acd1d..f3d356f86f15 100644 is_in_gesture_scroll_[gesture_event.SourceDevice()] = true; } else if (gesture_event.GetType() == blink::WebInputEvent::kGestureScrollEnd) { +-- +2.17.0 + diff --git a/patches/common/chromium/disable_user_gesture_requirement_for_beforeunload_dialogs.patch b/patches/common/chromium/disable_user_gesture_requirement_for_beforeunload_dialogs.patch index 60ba30ea219..25d57762e37 100644 --- a/patches/common/chromium/disable_user_gesture_requirement_for_beforeunload_dialogs.patch +++ b/patches/common/chromium/disable_user_gesture_requirement_for_beforeunload_dialogs.patch @@ -1,11 +1,18 @@ +From 1294052a41b0f304e45e5bea986b194bee511d49 Mon Sep 17 00:00:00 2001 +From: Aleksei Kuzmin +Date: Thu, 20 Sep 2018 17:47:33 -0700 +Subject: disable_user_gesture_requirement_for_beforeunload_dialogs.patch + +See https://github.com/electron/electron/issues/10754 + diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc -index 9abb526ef011..296abf0a1b93 100644 +index 5bfe30b8b880..70129284e60b 100644 --- a/third_party/blink/renderer/core/dom/document.cc +++ b/third_party/blink/renderer/core/dom/document.cc -@@ -3442,7 +3442,9 @@ bool Document::DispatchBeforeUnloadEvent(ChromeClient& chrome_client, - "Blocked attempt to show a 'beforeunload' confirmation panel for a " +@@ -3508,7 +3508,9 @@ bool Document::DispatchBeforeUnloadEvent(ChromeClient& chrome_client, "frame that never had a user gesture since its load. " - "https://www.chromestatus.com/feature/5082396709879808")); + "https://www.chromestatus.com/feature/5082396709879808"; + Intervention::GenerateReport(frame_, "BeforeUnloadNoGesture", message); - return true; + // TODO(alexeykuzmin): Uncomment `return true` when Electron tests are fixed. + // See https://github.com/electron/electron/issues/10754 @@ -13,3 +20,6 @@ index 9abb526ef011..296abf0a1b93 100644 } if (did_allow_navigation) { +-- +2.17.0 + diff --git a/patches/common/chromium/dom_storage_map.patch b/patches/common/chromium/dom_storage_map.patch index 29b0772cfc9..8b9acfc1bf7 100644 --- a/patches/common/chromium/dom_storage_map.patch +++ b/patches/common/chromium/dom_storage_map.patch @@ -1,8 +1,14 @@ +From 71828a0d7703c56120f127ca42f097fda647ef1c Mon Sep 17 00:00:00 2001 +From: Cheng Zhao +Date: Thu, 20 Sep 2018 17:45:55 -0700 +Subject: dom_storage_map.patch + + diff --git a/content/common/dom_storage/dom_storage_map.cc b/content/common/dom_storage/dom_storage_map.cc -index 0a6b0176a982..35a1c3c11a58 100644 +index fd088fb170be..a9e4b3375e9b 100644 --- a/content/common/dom_storage/dom_storage_map.cc +++ b/content/common/dom_storage/dom_storage_map.cc -@@ -182,10 +182,12 @@ bool DOMStorageMap::SetItemInternal(MapType* map_type, +@@ -185,10 +185,12 @@ bool DOMStorageMap::SetItemInternal(MapType* map_type, size_t new_item_size = size_in_storage(key, value); size_t new_storage_used = storage_used_ - old_item_size + new_item_size; @@ -15,3 +21,6 @@ index 0a6b0176a982..35a1c3c11a58 100644 (*map_type)[key] = value; ResetKeyIterator(); +-- +2.17.0 + diff --git a/patches/common/chromium/enable_osr_components.patch b/patches/common/chromium/enable_osr_components.patch index fb7f5f9b09b..8de9b89cfaa 100644 --- a/patches/common/chromium/enable_osr_components.patch +++ b/patches/common/chromium/enable_osr_components.patch @@ -1,5 +1,12 @@ +From dab99d95ea1d84d1bb263029096a23634b795a94 Mon Sep 17 00:00:00 2001 +From: Shelley Vohr +Date: Thu, 20 Sep 2018 17:49:52 -0700 +Subject: enable_osr_components.patch + +Add MouseWheelPhaseHandler for OSR. + diff --git a/content/browser/renderer_host/input/mouse_wheel_phase_handler.h b/content/browser/renderer_host/input/mouse_wheel_phase_handler.h -index 4f7c03d62930..25b74d9b5236 100644 +index 305095fc420e..f5ca4eda4a66 100644 --- a/content/browser/renderer_host/input/mouse_wheel_phase_handler.h +++ b/content/browser/renderer_host/input/mouse_wheel_phase_handler.h @@ -7,6 +7,7 @@ @@ -19,3 +26,6 @@ index 4f7c03d62930..25b74d9b5236 100644 public: MouseWheelPhaseHandler(RenderWidgetHostViewBase* const host_view); ~MouseWheelPhaseHandler() {} +-- +2.17.0 + diff --git a/patches/common/chromium/enable_widevine.patch b/patches/common/chromium/enable_widevine.patch index 99d6badf419..2a4bde7d5c2 100644 --- a/patches/common/chromium/enable_widevine.patch +++ b/patches/common/chromium/enable_widevine.patch @@ -1,3 +1,12 @@ +From 40198545a62b90741d1adf0e1f61e1fb43b4b73a Mon Sep 17 00:00:00 2001 +From: Aleksei Kuzmin +Date: Thu, 20 Sep 2018 17:50:03 -0700 +Subject: enable_widevine.patch + +Turns `enable_widevine` flag on by default on Mac and Windows. +Electron needs that flag to be enabled on those paltforms, +but there's no way to conditionally set it during a `gn gen` call. + diff --git a/third_party/widevine/cdm/widevine.gni b/third_party/widevine/cdm/widevine.gni index 82a93622585a..cbd10bed9f3b 100644 --- a/third_party/widevine/cdm/widevine.gni @@ -11,3 +20,6 @@ index 82a93622585a..cbd10bed9f3b 100644 } enable_widevine_cdm_host_verification = +-- +2.17.0 + diff --git a/patches/common/chromium/exclude-a-few-test-files-from-build.patch b/patches/common/chromium/exclude-a-few-test-files-from-build.patch index ad8792ac7c0..ed3de41bcd4 100644 --- a/patches/common/chromium/exclude-a-few-test-files-from-build.patch +++ b/patches/common/chromium/exclude-a-few-test-files-from-build.patch @@ -1,22 +1,24 @@ +From 2f416aedbe6580b1ef07a2f76c22bcd9d1ef5942 Mon Sep 17 00:00:00 2001 +From: Aleksei Kuzmin +Date: Thu, 20 Sep 2018 17:50:45 -0700 +Subject: exclude-a-few-test-files-from-build.patch + +Compilation of those files fails with the Chromium 67. +Remove the patch during the Chromium 68 upgrade. + diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn -index 05177001104e..5b5e00e9ef2d 100644 +index d5d8e48305ba..070c6be426f4 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn -@@ -1797,7 +1797,7 @@ jumbo_source_set("blink_platform_unittests_sources") { - "graphics/compositing/chunk_to_layer_mapper_test.cc", - "graphics/compositing/composited_layer_raster_invalidator_test.cc", - "graphics/compositing/paint_artifact_compositor_test.cc", -- "graphics/compositing/paint_chunks_to_cc_layer_test.cc", -+ # "graphics/compositing/paint_chunks_to_cc_layer_test.cc", - "graphics/compositor_element_id_test.cc", - "graphics/contiguous_container_test.cc", - "graphics/decoding_image_generator_test.cc", -@@ -1873,7 +1873,7 @@ jumbo_source_set("blink_platform_unittests_sources") { - "text/date_time_format_test.cc", - "text/hyphenation_test.cc", - "text/icu_error_test.cc", -- "text/line_ending_test.cc", -+ # "text/line_ending_test.cc", - "text/platform_locale_test.cc", - "text/segmented_string_test.cc", - "text/suffix_tree_test.cc", +@@ -1790,7 +1790,7 @@ jumbo_source_set("blink_platform_unittests_sources") { + "graphics/paint/drawing_display_item_test.cc", + "graphics/paint/drawing_recorder_test.cc", + "graphics/paint/float_clip_rect_test.cc", +- "graphics/paint/geometry_mapper_test.cc", ++ #"graphics/paint/geometry_mapper_test.cc", + "graphics/paint/paint_chunk_test.cc", + "graphics/paint/paint_chunker_test.cc", + "graphics/paint/paint_controller_test.cc", +-- +2.17.0 + diff --git a/patches/common/chromium/fix_xcode_ten.patch b/patches/common/chromium/fix_xcode_ten.patch deleted file mode 100644 index ad403407cd9..00000000000 --- a/patches/common/chromium/fix_xcode_ten.patch +++ /dev/null @@ -1,86 +0,0 @@ -diff --git a/build/config/ios/rules.gni b/build/config/ios/rules.gni -index df6033b..7fdc931 100644 ---- a/build/config/ios/rules.gni -+++ b/build/config/ios/rules.gni -@@ -1805,10 +1805,15 @@ - # Xcode needs those two framework installed in the application (and signed) - # for the XCTest to run, so install them using extra_system_frameworks. - _ios_platform_library = "$ios_sdk_platform_path/Developer/Library" -- extra_system_frameworks = [ -- "$_ios_platform_library/Frameworks/XCTest.framework", -- "$_ios_platform_library/PrivateFrameworks/IDEBundleInjection.framework", -- ] -+ extra_system_frameworks = -+ [ "$_ios_platform_library/Frameworks/XCTest.framework" ] -+ -+ # TODO: Remove this once support for Xcode 9.x is dropped. -+ if (xcode_version_int < 1000) { -+ extra_system_frameworks += [ -+ "$_ios_platform_library/PrivateFrameworks/IDEBundleInjection.framework", -+ ] -+ } - - _xctest_bundle = _xctest_target + "_bundle" - if (current_toolchain == default_toolchain) { -diff --git a/build/config/mac/sdk_info.py b/build/config/mac/sdk_info.py -index 8a9edc1..46dcec8 100644 ---- a/build/config/mac/sdk_info.py -+++ b/build/config/mac/sdk_info.py -@@ -3,6 +3,8 @@ - # found in the LICENSE file. - - import argparse -+import doctest -+import itertools - import os - import subprocess - import sys -@@ -10,16 +12,32 @@ - # This script prints information about the build system, the operating - # system and the iOS or Mac SDK (depending on the platform "iphonesimulator", - # "iphoneos" or "macosx" generally). --# --# In the GYP build, this is done inside GYP itself based on the SDKROOT --# variable. -+ -+def SplitVersion(version): -+ """Splits the Xcode version to 3 values. -+ -+ >>> list(SplitVersion('8.2.1.1')) -+ ['8', '2', '1'] -+ >>> list(SplitVersion('9.3')) -+ ['9', '3', '0'] -+ >>> list(SplitVersion('10.0')) -+ ['10', '0', '0'] -+ """ -+ version = version.split('.') -+ return itertools.islice(itertools.chain(version, itertools.repeat('0')), 0, 3) - - def FormatVersion(version): -- """Converts Xcode version to a format required for Info.plist.""" -- version = version.replace('.', '') -- version = version + '0' * (3 - len(version)) -- return version.zfill(4) -+ """Converts Xcode version to a format required for DTXcode in Info.plist - -+ >>> FormatVersion('8.2.1') -+ '0821' -+ >>> FormatVersion('9.3') -+ '0930' -+ >>> FormatVersion('10.0') -+ '1000' -+ """ -+ major, minor, patch = SplitVersion(version) -+ return ('%2s%s%s' % (major, minor, patch)).replace(' ', '0') - - def FillXcodeVersion(settings): - """Fills the Xcode version and build number into |settings|.""" -@@ -53,6 +71,8 @@ - - - if __name__ == '__main__': -+ doctest.testmod() -+ - parser = argparse.ArgumentParser() - parser.add_argument("--developer_dir", required=False) - args, unknownargs = parser.parse_known_args() diff --git a/patches/common/chromium/frame_host_manager.patch b/patches/common/chromium/frame_host_manager.patch index 37593410731..d54153076ed 100644 --- a/patches/common/chromium/frame_host_manager.patch +++ b/patches/common/chromium/frame_host_manager.patch @@ -1,8 +1,14 @@ +From 4730f77f43c648f6168db58897b4569326a75627 Mon Sep 17 00:00:00 2001 +From: deepak1556 +Date: Thu, 20 Sep 2018 17:45:59 -0700 +Subject: frame_host_manager.patch + + diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc -index b682235b0f87..0c88f4bf86b6 100644 +index 872e4609c94f..a59676004f24 100644 --- a/content/browser/frame_host/render_frame_host_manager.cc +++ b/content/browser/frame_host/render_frame_host_manager.cc -@@ -1912,6 +1912,18 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( +@@ -1960,6 +1960,18 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( bool was_server_redirect = request.navigation_handle() && request.navigation_handle()->WasServerRedirect(); @@ -21,7 +27,7 @@ index b682235b0f87..0c88f4bf86b6 100644 if (frame_tree_node_->IsMainFrame()) { // Renderer-initiated main frame navigations that may require a // SiteInstance swap are sent to the browser via the OpenURL IPC and are -@@ -1931,6 +1943,19 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( +@@ -1979,6 +1991,19 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( request.common_params().url)); no_renderer_swap_allowed |= request.from_begin_navigation() && !can_renderer_initiate_transfer; @@ -41,7 +47,7 @@ index b682235b0f87..0c88f4bf86b6 100644 } else { // Subframe navigations will use the current renderer, unless specifically // allowed to swap processes. -@@ -1942,18 +1967,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( +@@ -1990,18 +2015,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( if (no_renderer_swap_allowed) return scoped_refptr(current_site_instance); @@ -62,10 +68,10 @@ index b682235b0f87..0c88f4bf86b6 100644 request.state() == NavigationRequest::FAILED, request.restore_type() != RestoreType::NONE, request.is_view_source(), diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index 3ca627448e33..7d0c9ed7e1af 100644 +index 3be31602689c..2c22cb1cfe0d 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h -@@ -186,6 +186,15 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -196,6 +196,15 @@ class CONTENT_EXPORT ContentBrowserClient { public: virtual ~ContentBrowserClient() {} @@ -81,3 +87,6 @@ index 3ca627448e33..7d0c9ed7e1af 100644 // Allows the embedder to set any number of custom BrowserMainParts // implementations for the browser startup code. See comments in // browser_main_parts.h. +-- +2.17.0 + diff --git a/patches/common/chromium/gin_enable_disable_v8_platform.patch b/patches/common/chromium/gin_enable_disable_v8_platform.patch index 4eb9b3dc481..2188279d5b5 100644 --- a/patches/common/chromium/gin_enable_disable_v8_platform.patch +++ b/patches/common/chromium/gin_enable_disable_v8_platform.patch @@ -1,8 +1,14 @@ +From eaf64921a97d513151d48ab01975b5ac966a7e34 Mon Sep 17 00:00:00 2001 +From: Cheng Zhao +Date: Thu, 20 Sep 2018 17:47:44 -0700 +Subject: gin_enable_disable_v8_platform.patch + + diff --git a/gin/isolate_holder.cc b/gin/isolate_holder.cc -index 076d137eb7cf..c10c3b0be66b 100644 +index e3a23cf30e42..e099fd3f03e5 100644 --- a/gin/isolate_holder.cc +++ b/gin/isolate_holder.cc -@@ -119,9 +119,10 @@ IsolateHolder::~IsolateHolder() { +@@ -116,9 +116,10 @@ IsolateHolder::~IsolateHolder() { void IsolateHolder::Initialize(ScriptMode mode, V8ExtrasMode v8_extras_mode, v8::ArrayBuffer::Allocator* allocator, @@ -16,10 +22,10 @@ index 076d137eb7cf..c10c3b0be66b 100644 g_reference_table = reference_table; } diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h -index 2509aca609f9..94003c6031cf 100644 +index a70ad1ce51a9..84cf66e6e9cd 100644 --- a/gin/public/isolate_holder.h +++ b/gin/public/isolate_holder.h -@@ -84,7 +84,8 @@ class GIN_EXPORT IsolateHolder { +@@ -83,7 +83,8 @@ class GIN_EXPORT IsolateHolder { static void Initialize(ScriptMode mode, V8ExtrasMode v8_extras_mode, v8::ArrayBuffer::Allocator* allocator, @@ -64,3 +70,6 @@ index 6f3265ba4d06..29f28bebbdcd 100644 // Get address and size information for currently loaded snapshot. // If no snapshot is loaded, the return values are null for addresses +-- +2.17.0 + diff --git a/patches/common/chromium/gtk_visibility.patch b/patches/common/chromium/gtk_visibility.patch index 35a76d647e0..e9a00288871 100644 --- a/patches/common/chromium/gtk_visibility.patch +++ b/patches/common/chromium/gtk_visibility.patch @@ -1,3 +1,10 @@ +From cac9e74e69a7f46b9e1f7b719b17e9a7167d3836 Mon Sep 17 00:00:00 2001 +From: Jeremy Apthorp +Date: Thu, 20 Sep 2018 17:48:38 -0700 +Subject: gtk_visibility.patch + +Allow electron and brightray to depend on GTK in the GN build. + diff --git a/build/config/linux/gtk/BUILD.gn b/build/config/linux/gtk/BUILD.gn index deae4d3455a8..fd5d906b98b0 100644 --- a/build/config/linux/gtk/BUILD.gn @@ -11,3 +18,6 @@ index deae4d3455a8..fd5d906b98b0 100644 "//examples:peerconnection_client", "//gpu/gles2_conform_support:gles2_conform_test_windowless", "//remoting/host", +-- +2.17.0 + diff --git a/patches/common/chromium/ignore_rc_check.patch b/patches/common/chromium/ignore_rc_check.patch index 65f3f595cc5..4c426024a9d 100644 --- a/patches/common/chromium/ignore_rc_check.patch +++ b/patches/common/chromium/ignore_rc_check.patch @@ -1,8 +1,16 @@ +From 6b31ce372295634832d0c2aa28534c8f4cc885f3 Mon Sep 17 00:00:00 2001 +From: Zac Walker +Date: Thu, 20 Sep 2018 17:49:55 -0700 +Subject: ignore_rc_check.patch + +Dont compare RC.exe and RC.py output. +FIXME: It has to be reverted once the script is fixed. + diff --git a/build/toolchain/win/tool_wrapper.py b/build/toolchain/win/tool_wrapper.py -index 801d7a9b8e03..7b54f8dceb36 100644 +index ee21eb4b194b..ab98a033a61c 100644 --- a/build/toolchain/win/tool_wrapper.py +++ b/build/toolchain/win/tool_wrapper.py -@@ -254,7 +254,11 @@ class WinTool(object): +@@ -231,7 +231,11 @@ class WinTool(object): if rc_exe_exit_code == 0: import filecmp # Strip "/fo" prefix. @@ -15,3 +23,6 @@ index 801d7a9b8e03..7b54f8dceb36 100644 return rc_exe_exit_code def ExecActionWrapper(self, arch, rspfile, *dirname): +-- +2.17.0 + diff --git a/patches/common/chromium/leveldb_ssize_t.patch b/patches/common/chromium/leveldb_ssize_t.patch index 58468eb81d4..5782d7bd52c 100644 --- a/patches/common/chromium/leveldb_ssize_t.patch +++ b/patches/common/chromium/leveldb_ssize_t.patch @@ -1,3 +1,12 @@ +From 070bbbe44c20c52f5e12b04b01fc101a42633119 Mon Sep 17 00:00:00 2001 +From: Jeremy Apthorp +Date: Thu, 20 Sep 2018 17:50:38 -0700 +Subject: leveldb_ssize_t.patch + +Fix conflict between leveldb & node's definition of ssize_t on +Windows by preventing leveldb from re-defining the type if it's +already defined. + diff --git a/third_party/leveldatabase/port/port_chromium.h b/third_party/leveldatabase/port/port_chromium.h index a7c449eba19c..acbce7efd582 100644 --- a/third_party/leveldatabase/port/port_chromium.h @@ -14,3 +23,6 @@ index a7c449eba19c..acbce7efd582 100644 #endif namespace leveldb { +-- +2.17.0 + diff --git a/patches/common/chromium/libgtkui_export.patch b/patches/common/chromium/libgtkui_export.patch index 7cade3fee25..f1cf99c3dcb 100644 --- a/patches/common/chromium/libgtkui_export.patch +++ b/patches/common/chromium/libgtkui_export.patch @@ -1,3 +1,10 @@ +From 4eacd7975250d8954e461f880d6bb97dcb4b003d Mon Sep 17 00:00:00 2001 +From: Jeremy Apthorp +Date: Thu, 20 Sep 2018 17:48:31 -0700 +Subject: libgtkui_export.patch + +Export libgtkui symbols for the GN component build. + diff --git a/chrome/browser/ui/libgtkui/app_indicator_icon.h b/chrome/browser/ui/libgtkui/app_indicator_icon.h index 7815fbb2cea8..f17a5c59e64b 100644 --- a/chrome/browser/ui/libgtkui/app_indicator_icon.h @@ -41,7 +48,7 @@ index e4e0da40981c..af028715ada9 100644 Gtk2StatusIcon(const gfx::ImageSkia& image, const base::string16& tool_tip); ~Gtk2StatusIcon() override; diff --git a/chrome/browser/ui/libgtkui/gtk_util.h b/chrome/browser/ui/libgtkui/gtk_util.h -index 665ec57c09d5..4ccb08807fb4 100644 +index d9f245070249..56cce5fa3e0b 100644 --- a/chrome/browser/ui/libgtkui/gtk_util.h +++ b/chrome/browser/ui/libgtkui/gtk_util.h @@ -11,6 +11,7 @@ @@ -52,7 +59,7 @@ index 665ec57c09d5..4ccb08807fb4 100644 namespace aura { class Window; -@@ -51,10 +52,10 @@ SkColor NormalURLColor(SkColor foreground); +@@ -55,10 +56,10 @@ SkColor NormalURLColor(SkColor foreground); // saturation than to look exactly like the foreground color. SkColor SelectedURLColor(SkColor foreground, SkColor background); @@ -65,7 +72,7 @@ index 665ec57c09d5..4ccb08807fb4 100644 guint GetGdkKeyCodeForAccelerator(const ui::Accelerator& accelerator); -@@ -69,7 +70,7 @@ void TurnButtonBlue(GtkWidget* button); +@@ -73,7 +74,7 @@ void TurnButtonBlue(GtkWidget* button); // Sets |dialog| as transient for |parent|, which will keep it on top and center // it above |parent|. Do nothing if |parent| is nullptr. @@ -74,15 +81,6 @@ index 665ec57c09d5..4ccb08807fb4 100644 // Gets the transient parent aura window for |dialog|. aura::Window* GetAuraTransientParent(GtkWidget* dialog); -@@ -190,7 +190,7 @@ void RenderBackground(const gfx::Size& size, - // Renders a background from the style context created by - // GetStyleContextFromCss(|css_selector|) into a 24x24 bitmap and - // returns the average color. --SkColor GetBgColor(const std::string& css_selector); -+LIBGTKUI_EXPORT SkColor GetBgColor(const std::string& css_selector); - - // Renders the border from the style context created by - // GetStyleContextFromCss(|css_selector|) into a 24x24 bitmap and diff --git a/chrome/browser/ui/libgtkui/skia_utils_gtk.h b/chrome/browser/ui/libgtkui/skia_utils_gtk.h index e05fbe9d8b2f..3afca9a72ab6 100644 --- a/chrome/browser/ui/libgtkui/skia_utils_gtk.h @@ -132,3 +130,6 @@ index 8d67e1460837..95fbb27b6a81 100644 } // namespace unity +-- +2.17.0 + diff --git a/patches/common/chromium/mas-audiodeviceduck.patch b/patches/common/chromium/mas-audiodeviceduck.patch index 9768466ab83..16b54668012 100644 --- a/patches/common/chromium/mas-audiodeviceduck.patch +++ b/patches/common/chromium/mas-audiodeviceduck.patch @@ -1,3 +1,10 @@ +From 2a1f4c039a4522620daea2898870c220318d539a Mon Sep 17 00:00:00 2001 +From: Jeremy Apthorp +Date: Thu, 20 Sep 2018 17:49:31 -0700 +Subject: mas-audiodeviceduck.patch + +Removes usage of the AudioDeviceDuck private API. + diff --git a/media/audio/mac/audio_low_latency_input_mac.cc b/media/audio/mac/audio_low_latency_input_mac.cc index 53586b888d82..c1d750dbf32d 100644 --- a/media/audio/mac/audio_low_latency_input_mac.cc diff --git a/patches/common/chromium/mas-cfisobjc.patch b/patches/common/chromium/mas-cfisobjc.patch index 71d5e3507eb..364e1b49ecc 100644 --- a/patches/common/chromium/mas-cfisobjc.patch +++ b/patches/common/chromium/mas-cfisobjc.patch @@ -1,3 +1,10 @@ +From 715baf9c695bdfffc525cc2984306768bfa7140e Mon Sep 17 00:00:00 2001 +From: Jeremy Apthorp +Date: Thu, 20 Sep 2018 17:49:20 -0700 +Subject: mas-cfisobjc.patch + +Removes usage of the _CFIsObjC private API. + diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm index 15fc15ba307e..7ca4e0ec5ca8 100644 --- a/base/mac/foundation_util.mm diff --git a/patches/common/chromium/mas-cgdisplayusesforcetogray.patch b/patches/common/chromium/mas-cgdisplayusesforcetogray.patch index 38196221868..19f170999e5 100644 --- a/patches/common/chromium/mas-cgdisplayusesforcetogray.patch +++ b/patches/common/chromium/mas-cgdisplayusesforcetogray.patch @@ -1,11 +1,12 @@ -From 0680698be349b3619561c65eb072d9880e405fae Mon Sep 17 00:00:00 2001 +From a767540b22c787e0ec6809f275e7cba5f9048792 Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp -Date: Fri, 14 Sep 2018 09:53:11 -0700 -Subject: apply patch: mas-cgdisplayusesforcetogray +Date: Thu, 20 Sep 2018 17:49:24 -0700 +Subject: mas-cgdisplayusesforcetogray.patch +Removes usage of the CGDisplayUsesForceToGray private API. diff --git a/ui/display/mac/screen_mac.mm b/ui/display/mac/screen_mac.mm -index be4f343bcd44..84fd3ec23cfa 100644 +index 99a128511250..7200a5df74e1 100644 --- a/ui/display/mac/screen_mac.mm +++ b/ui/display/mac/screen_mac.mm @@ -106,7 +106,17 @@ Display BuildDisplayForScreen(NSScreen* screen) { diff --git a/patches/common/chromium/mas-lssetapplicationlaunchservicesserverconnectionstatus.patch b/patches/common/chromium/mas-lssetapplicationlaunchservicesserverconnectionstatus.patch index 08328a44137..cccf386a105 100644 --- a/patches/common/chromium/mas-lssetapplicationlaunchservicesserverconnectionstatus.patch +++ b/patches/common/chromium/mas-lssetapplicationlaunchservicesserverconnectionstatus.patch @@ -1,8 +1,16 @@ +From c7042021cfd9d4e50b107e372225a14f7492bce5 Mon Sep 17 00:00:00 2001 +From: Jeremy Apthorp +Date: Thu, 20 Sep 2018 17:49:34 -0700 +Subject: mas-lssetapplicationlaunchservicesserverconnectionstatus.patch + +Removes usage of the _LSSetApplicationLaunchServicesServerConnectionStatus +private API. + diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc -index e6a589fb90e0..64ff5e248bd7 100644 +index f14c045d47ad..9c8751a6fe0b 100644 --- a/content/gpu/gpu_main.cc +++ b/content/gpu/gpu_main.cc -@@ -276,8 +276,10 @@ int GpuMain(const MainFunctionParams& parameters) { +@@ -274,8 +274,10 @@ int GpuMain(const MainFunctionParams& parameters) { std::unique_ptr pump(new base::MessagePumpNSRunLoop()); main_message_loop.reset(new base::MessageLoop(std::move(pump))); diff --git a/patches/common/chromium/mas_blink_no_private_api.patch b/patches/common/chromium/mas_blink_no_private_api.patch index 794bce91c5a..e59aac35216 100644 --- a/patches/common/chromium/mas_blink_no_private_api.patch +++ b/patches/common/chromium/mas_blink_no_private_api.patch @@ -1,53 +1,15 @@ -diff --git a/third_party/blink/renderer/core/paint/theme_painter_mac.mm b/third_party/blink/renderer/core/paint/theme_painter_mac.mm -index dc115581a0e1..3466cfd86e9f 100644 ---- a/third_party/blink/renderer/core/paint/theme_painter_mac.mm -+++ b/third_party/blink/renderer/core/paint/theme_painter_mac.mm -@@ -42,6 +42,7 @@ - - // The methods in this file are specific to the Mac OS X platform. - -+#ifndef MAS_BUILD - // Forward declare Mac SPIs. - extern "C" { - void _NSDrawCarbonThemeBezel(NSRect frame, BOOL enabled, BOOL flipped); -@@ -51,6 +52,7 @@ void _NSDrawCarbonThemeListBox(NSRect frame, - BOOL flipped, - BOOL always_yes); - } -+#endif - - namespace blink { - -@@ -73,10 +75,12 @@ bool ThemePainterMac::PaintTextField(const Node* node, - // behavior change while remaining a fragile solution. - // https://bugs.chromium.org/p/chromium/issues/detail?id=658085#c3 - if (!use_ns_text_field_cell) { -+#ifndef MAS_BUILD - _NSDrawCarbonThemeBezel( - CGRect(r), - LayoutTheme::IsEnabled(node) && !LayoutTheme::IsReadOnlyControl(node), - YES); -+#endif - return false; - } - -@@ -162,10 +166,12 @@ bool ThemePainterMac::PaintTextArea(const Node* node, - const PaintInfo& paint_info, - const IntRect& r) { - LocalCurrentGraphicsContext local_context(paint_info.context, r); -+#ifndef MAS_BUILD - _NSDrawCarbonThemeListBox( - CGRect(r), - LayoutTheme::IsEnabled(node) && !LayoutTheme::IsReadOnlyControl(node), - YES, YES); -+#endif - return false; - } - -diff --git a/third_party/blink/renderer/platform/mac/kill_ring_mac.mm b/third_party/blink/renderer/platform/mac/kill_ring_mac.mm -index 98dea7c4c3c9..44b4ae940dc5 100644 ---- a/third_party/blink/renderer/platform/mac/kill_ring_mac.mm -+++ b/third_party/blink/renderer/platform/mac/kill_ring_mac.mm +From b75117921e735e5d892a7320e1ebec84a2c2fd1a Mon Sep 17 00:00:00 2001 +From: Cheng Zhao +Date: Thu, 20 Sep 2018 17:48:49 -0700 +Subject: mas_blink_no_private_api.patch + +Guard usages in chromium code of private Mac APIs by MAS_BUILD, so they can +be excluded for people who want to submit their apps to the Mac App store. + +diff --git a/third_party/blink/renderer/core/editing/kill_ring_mac.mm b/third_party/blink/renderer/core/editing/kill_ring_mac.mm +index 94afefcee81b..2ec7f04c7182 100644 +--- a/third_party/blink/renderer/core/editing/kill_ring_mac.mm ++++ b/third_party/blink/renderer/core/editing/kill_ring_mac.mm @@ -27,6 +27,7 @@ namespace blink { @@ -110,3 +72,52 @@ index 98dea7c4c3c9..44b4ae940dc5 100644 } } // namespace blink +diff --git a/third_party/blink/renderer/core/paint/theme_painter_mac.mm b/third_party/blink/renderer/core/paint/theme_painter_mac.mm +index 7a1260db0a13..bf9cf7046e2f 100644 +--- a/third_party/blink/renderer/core/paint/theme_painter_mac.mm ++++ b/third_party/blink/renderer/core/paint/theme_painter_mac.mm +@@ -42,6 +42,7 @@ + + // The methods in this file are specific to the Mac OS X platform. + ++#ifndef MAS_BUILD + // Forward declare Mac SPIs. + extern "C" { + void _NSDrawCarbonThemeBezel(NSRect frame, BOOL enabled, BOOL flipped); +@@ -51,6 +52,7 @@ void _NSDrawCarbonThemeListBox(NSRect frame, + BOOL flipped, + BOOL always_yes); + } ++#endif + + namespace blink { + +@@ -73,10 +75,12 @@ bool ThemePainterMac::PaintTextField(const Node* node, + // behavior change while remaining a fragile solution. + // https://bugs.chromium.org/p/chromium/issues/detail?id=658085#c3 + if (!use_ns_text_field_cell) { ++#ifndef MAS_BUILD + _NSDrawCarbonThemeBezel( + CGRect(r), + LayoutTheme::IsEnabled(node) && !LayoutTheme::IsReadOnlyControl(node), + YES); ++#endif + return false; + } + +@@ -162,10 +166,12 @@ bool ThemePainterMac::PaintTextArea(const Node* node, + const PaintInfo& paint_info, + const IntRect& r) { + LocalCurrentGraphicsContext local_context(paint_info.context, r); ++#ifndef MAS_BUILD + _NSDrawCarbonThemeListBox( + CGRect(r), + LayoutTheme::IsEnabled(node) && !LayoutTheme::IsReadOnlyControl(node), + YES, YES); ++#endif + return false; + } + +-- +2.17.0 + diff --git a/patches/common/chromium/mas_no_private_api.patch b/patches/common/chromium/mas_no_private_api.patch index 804bcc35264..b33db7a10e9 100644 --- a/patches/common/chromium/mas_no_private_api.patch +++ b/patches/common/chromium/mas_no_private_api.patch @@ -1,5 +1,13 @@ +From 76b7181bb594403e3529a961efcacc6923af7e83 Mon Sep 17 00:00:00 2001 +From: Cheng Zhao +Date: Thu, 20 Sep 2018 17:48:52 -0700 +Subject: mas_no_private_api.patch + +Guard usages in blink of private Mac APIs by MAS_BUILD, so they can be +excluded for people who want to submit their apps to the Mac App store. + diff --git a/content/browser/accessibility/browser_accessibility_cocoa.h b/content/browser/accessibility/browser_accessibility_cocoa.h -index a03585269db6..e7b028760bba 100644 +index 44c85b5ad571..1714c403edf2 100644 --- a/content/browser/accessibility/browser_accessibility_cocoa.h +++ b/content/browser/accessibility/browser_accessibility_cocoa.h @@ -111,7 +111,9 @@ struct AXTextEdit { @@ -30,10 +38,10 @@ index a03585269db6..e7b028760bba 100644 // is concerned. @property(nonatomic, readonly) NSString* subrole; diff --git a/content/browser/accessibility/browser_accessibility_cocoa.mm b/content/browser/accessibility/browser_accessibility_cocoa.mm -index bc4b972f9c78..fb06c95af750 100644 +index 07e9862b76a9..efa52aa9de2f 100644 --- a/content/browser/accessibility/browser_accessibility_cocoa.mm +++ b/content/browser/accessibility/browser_accessibility_cocoa.mm -@@ -122,6 +122,7 @@ NSDictionary* attributeToMethodNameMap = nil; +@@ -135,6 +135,7 @@ NSDictionary* attributeToMethodNameMap = nil; // VoiceOver uses -1 to mean "no limit" for AXResultsLimit. const int kAXResultsLimitNoLimit = -1; @@ -41,7 +49,7 @@ index bc4b972f9c78..fb06c95af750 100644 extern "C" { // The following are private accessibility APIs required for cursor navigation -@@ -328,6 +329,7 @@ NSAttributedString* GetAttributedTextForTextMarkerRange( +@@ -341,6 +342,7 @@ NSAttributedString* GetAttributedTextForTextMarkerRange( AddMisspelledTextAttributes(text_only_objects, attributed_text); return [attributed_text attributedSubstringFromRange:range]; } @@ -49,7 +57,7 @@ index bc4b972f9c78..fb06c95af750 100644 // Returns an autoreleased copy of the AXNodeData's attribute. NSString* NSStringForStringAttribute( -@@ -581,7 +583,9 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; +@@ -595,7 +597,9 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; {NSAccessibilityDOMIdentifierAttribute, @"domIdentifier"}, {NSAccessibilityEditableAncestorAttribute, @"editableAncestor"}, {NSAccessibilityEnabledAttribute, @"enabled"}, @@ -57,9 +65,9 @@ index bc4b972f9c78..fb06c95af750 100644 {NSAccessibilityEndTextMarkerAttribute, @"endTextMarker"}, +#endif {NSAccessibilityExpandedAttribute, @"expanded"}, + {NSAccessibilityFocusableAncestorAttribute, @"focusableAncestor"}, {NSAccessibilityFocusedAttribute, @"focused"}, - {NSAccessibilityGrabbedAttribute, @"grabbed"}, -@@ -614,13 +618,17 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; +@@ -630,13 +634,17 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; {NSAccessibilityRowsAttribute, @"rows"}, // TODO(aboxhall): expose // NSAccessibilityServesAsTitleForUIElementsAttribute @@ -77,15 +85,15 @@ index bc4b972f9c78..fb06c95af750 100644 {NSAccessibilitySizeAttribute, @"size"}, {NSAccessibilitySortDirectionAttribute, @"sortDirection"}, {NSAccessibilitySubroleAttribute, @"subrole"}, -@@ -1091,6 +1099,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; - ax::mojom::Restriction::kDisabled]; +@@ -1114,6 +1122,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; + ax::mojom::Restriction::kDisabled]; } +#ifndef MAS_BUILD // Returns a text marker that points to the last character in the document that // can be selected with VoiceOver. - (id)endTextMarker { -@@ -1102,6 +1111,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; +@@ -1124,6 +1133,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; BrowserAccessibilityPositionInstance position = root->CreatePositionAt(0); return CreateTextMarker(position->CreatePositionAtEndOfAnchor()); } @@ -93,7 +101,7 @@ index bc4b972f9c78..fb06c95af750 100644 - (NSNumber*)expanded { if (![self instanceActive]) -@@ -1975,6 +1985,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; +@@ -2029,6 +2039,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; return [NSValue valueWithRange:NSMakeRange(selStart, selLength)]; } @@ -101,7 +109,7 @@ index bc4b972f9c78..fb06c95af750 100644 - (id)selectedTextMarkerRange { if (![self instanceActive]) return nil; -@@ -2007,6 +2018,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; +@@ -2061,6 +2072,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; anchorAffinity, *focusObject, focusOffset, focusAffinity)); } @@ -109,7 +117,7 @@ index bc4b972f9c78..fb06c95af750 100644 - (NSValue*)size { if (![self instanceActive]) -@@ -2039,6 +2051,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; +@@ -2093,6 +2105,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; return nil; } @@ -117,7 +125,7 @@ index bc4b972f9c78..fb06c95af750 100644 // Returns a text marker that points to the first character in the document that // can be selected with VoiceOver. - (id)startTextMarker { -@@ -2050,6 +2063,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; +@@ -2103,6 +2116,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; BrowserAccessibilityPositionInstance position = root->CreatePositionAt(0); return CreateTextMarker(position->CreatePositionAtStartOfAnchor()); } @@ -125,22 +133,22 @@ index bc4b972f9c78..fb06c95af750 100644 // Returns a subrole based upon the role. - (NSString*) subrole { -@@ -2335,12 +2349,14 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; +@@ -2405,12 +2419,14 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; NSMutableAttributedString* attributedValue = [[[NSMutableAttributedString alloc] initWithString:value] autorelease]; +#ifndef MAS_BUILD - if (!browserAccessibility_->IsTextOnlyObject()) { + if (!owner_->IsTextOnlyObject()) { std::vector textOnlyObjects = - BrowserAccessibilityManager::FindTextOnlyObjectsInRange( - *browserAccessibility_, *browserAccessibility_); + BrowserAccessibilityManager::FindTextOnlyObjectsInRange(*owner_, + *owner_); AddMisspelledTextAttributes(textOnlyObjects, attributedValue); } +#endif return [attributedValue attributedSubstringFromRange:range]; } -@@ -2460,6 +2476,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; +@@ -2527,6 +2543,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; return nil; } @@ -148,7 +156,7 @@ index bc4b972f9c78..fb06c95af750 100644 if ([attribute isEqualToString:@"AXUIElementForTextMarker"]) { BrowserAccessibilityPositionInstance position = CreatePositionFromTextMarker(parameter); -@@ -2637,6 +2654,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; +@@ -2704,6 +2721,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; NSString* text = GetTextForTextMarkerRange(parameter); return [NSNumber numberWithInt:[text length]]; } @@ -156,7 +164,7 @@ index bc4b972f9c78..fb06c95af750 100644 if ([attribute isEqualToString: NSAccessibilityBoundsForRangeParameterizedAttribute]) { -@@ -2674,6 +2692,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; +@@ -2741,6 +2759,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; return nil; } @@ -164,7 +172,7 @@ index bc4b972f9c78..fb06c95af750 100644 if ([attribute isEqualToString: NSAccessibilityLineTextMarkerRangeForTextMarkerParameterizedAttribute]) { BrowserAccessibilityPositionInstance position = -@@ -2753,6 +2772,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; +@@ -2820,6 +2839,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; return @(child->GetIndexInParent()); } @@ -173,10 +181,10 @@ index bc4b972f9c78..fb06c95af750 100644 return nil; } diff --git a/content/browser/accessibility/browser_accessibility_manager_mac.mm b/content/browser/accessibility/browser_accessibility_manager_mac.mm -index 134f855de654..d588ed98839d 100644 +index 8e32a0822607..93bb7273684f 100644 --- a/content/browser/accessibility/browser_accessibility_manager_mac.mm +++ b/content/browser/accessibility/browser_accessibility_manager_mac.mm -@@ -441,6 +441,7 @@ NSDictionary* BrowserAccessibilityManagerMac:: +@@ -437,6 +437,7 @@ NSDictionary* BrowserAccessibilityManagerMac:: [user_info setObject:native_focus_object forKey:NSAccessibilityTextChangeElement]; @@ -184,7 +192,7 @@ index 134f855de654..d588ed98839d 100644 id selected_text = [native_focus_object selectedTextMarkerRange]; if (selected_text) { NSString* const NSAccessibilitySelectedTextMarkerRangeAttribute = -@@ -448,6 +449,7 @@ NSDictionary* BrowserAccessibilityManagerMac:: +@@ -444,6 +445,7 @@ NSDictionary* BrowserAccessibilityManagerMac:: [user_info setObject:selected_text forKey:NSAccessibilitySelectedTextMarkerRangeAttribute]; } @@ -229,18 +237,18 @@ index 1e2cc38d3868..daa934c345e2 100644 // You are about to read a pretty disgusting hack. In a static initializer, diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm -index bb996bfd0876..eea959855615 100644 +index 8b2092ec78f9..4f2ee8e28097 100644 --- a/device/bluetooth/bluetooth_adapter_mac.mm +++ b/device/bluetooth/bluetooth_adapter_mac.mm -@@ -32,6 +32,7 @@ - #include "device/bluetooth/bluetooth_low_energy_central_manager_delegate.h" +@@ -34,6 +34,7 @@ + #include "device/bluetooth/bluetooth_low_energy_peripheral_manager_delegate.h" #include "device/bluetooth/bluetooth_socket_mac.h" +#ifndef MAS_BUILD extern "C" { // Undocumented IOBluetooth Preference API [1]. Used by `blueutil` [2] and // `Karabiner` [3] to programmatically control the Bluetooth state. Calling the -@@ -45,6 +46,7 @@ extern "C" { +@@ -47,6 +48,7 @@ extern "C" { // [4] https://support.apple.com/kb/PH25091 void IOBluetoothPreferenceSetControllerPowerState(int state); } @@ -248,7 +256,7 @@ index bb996bfd0876..eea959855615 100644 namespace { -@@ -118,8 +120,10 @@ BluetoothAdapterMac::BluetoothAdapterMac() +@@ -120,8 +122,10 @@ BluetoothAdapterMac::BluetoothAdapterMac() controller_state_function_( base::BindRepeating(&BluetoothAdapterMac::GetHostControllerState, base::Unretained(this))), @@ -259,7 +267,7 @@ index bb996bfd0876..eea959855615 100644 should_update_name_(true), classic_discovery_manager_( BluetoothDiscoveryManagerMac::CreateClassic(this)), -@@ -302,8 +306,12 @@ bool BluetoothAdapterMac::IsLowEnergyAvailable() { +@@ -314,8 +318,12 @@ bool BluetoothAdapterMac::IsLowEnergyAvailable() { } bool BluetoothAdapterMac::SetPoweredImpl(bool powered) { @@ -273,10 +281,10 @@ index bb996bfd0876..eea959855615 100644 void BluetoothAdapterMac::RemovePairingDelegateInternal( diff --git a/media/audio/BUILD.gn b/media/audio/BUILD.gn -index 8754161b0c90..7705c0dcc5cf 100644 +index 585ad87c6cb4..4305c2e67dcc 100644 --- a/media/audio/BUILD.gn +++ b/media/audio/BUILD.gn -@@ -194,6 +194,12 @@ source_set("audio") { +@@ -196,6 +196,12 @@ source_set("audio") { "mac/scoped_audio_unit.cc", "mac/scoped_audio_unit.h", ] @@ -290,10 +298,10 @@ index 8754161b0c90..7705c0dcc5cf 100644 "AudioToolbox.framework", "AudioUnit.framework", diff --git a/media/audio/mac/audio_manager_mac.cc b/media/audio/mac/audio_manager_mac.cc -index 66a5622f2d3d..b7adea918559 100644 +index 74dd21d45b4f..d7dd95b4d461 100644 --- a/media/audio/mac/audio_manager_mac.cc +++ b/media/audio/mac/audio_manager_mac.cc -@@ -864,7 +864,7 @@ AudioParameters AudioManagerMac::GetPreferredOutputStreamParameters( +@@ -868,7 +868,7 @@ AudioParameters AudioManagerMac::GetPreferredOutputStreamParameters( void AudioManagerMac::InitializeOnAudioThread() { DCHECK(GetTaskRunner()->BelongsToCurrentThread()); @@ -415,10 +423,10 @@ index 9073364142e8..2356add74dfa 100644 NOTREACHED(); return nullptr; diff --git a/ui/views/cocoa/bridged_native_widget.mm b/ui/views/cocoa/bridged_native_widget.mm -index c37fd6286340..104cc98f731a 100644 +index 69c5f1f44d7e..8a1d8e7fc0dd 100644 --- a/ui/views/cocoa/bridged_native_widget.mm +++ b/ui/views/cocoa/bridged_native_widget.mm -@@ -42,6 +42,7 @@ +@@ -43,6 +43,7 @@ #include "ui/views/widget/widget_delegate.h" #include "ui/views/window/dialog_delegate.h" @@ -426,11 +434,14 @@ index c37fd6286340..104cc98f731a 100644 extern "C" { typedef int32_t CGSConnection; -@@ -51,6 +52,7 @@ CGError CGSSetWindowBackgroundBlurRadius(CGSConnection connection, - int radius); - - } +@@ -55,6 +56,7 @@ CGError CGSSetWindowBackgroundBlurRadius(CGSConnection connection, + namespace { + constexpr auto kUIPaintTimeout = base::TimeDelta::FromSeconds(5); + } // namespace +#endif // The NSView that hosts the composited CALayer drawing the UI. It fills the // window but is not hittable so that accessibility hit tests always go to the +-- +2.17.0 + diff --git a/patches/common/chromium/net_url_request_job.patch b/patches/common/chromium/net_url_request_job.patch index c84c958c36b..55c42175af9 100644 --- a/patches/common/chromium/net_url_request_job.patch +++ b/patches/common/chromium/net_url_request_job.patch @@ -1,12 +1,21 @@ +From 49270a5ff41a1808c33e61e832e251979670f6f7 Mon Sep 17 00:00:00 2001 +From: Cheng Zhao +Date: Thu, 20 Sep 2018 17:46:06 -0700 +Subject: net_url_request_job.patch + + diff --git a/net/url_request/url_request_job.h b/net/url_request/url_request_job.h -index 389315a25d7d..d4e3c0e6c2ba 100644 +index 7a2239587510..08a3940915c6 100644 --- a/net/url_request/url_request_job.h +++ b/net/url_request/url_request_job.h -@@ -285,6 +285,7 @@ class NET_EXPORT URLRequestJob : public base::PowerObserver { - void OnCallToDelegate(); +@@ -292,6 +292,7 @@ class NET_EXPORT URLRequestJob : public base::PowerObserver { + void OnCallToDelegate(NetLogEventType type); void OnCallToDelegateComplete(); + public: // Called to read raw (pre-filtered) data from this Job. Reads at most // |buf_size| bytes into |buf|. // Possible return values: +-- +2.17.0 + diff --git a/patches/common/chromium/no_cache_storage_check.patch b/patches/common/chromium/no_cache_storage_check.patch index aa23d719a52..b501de811b5 100644 --- a/patches/common/chromium/no_cache_storage_check.patch +++ b/patches/common/chromium/no_cache_storage_check.patch @@ -1,3 +1,11 @@ +From 528adce1472de7f07de909d451c215c474f9c646 Mon Sep 17 00:00:00 2001 +From: Cheng Zhao +Date: Thu, 20 Sep 2018 17:48:16 -0700 +Subject: no_cache_storage_check.patch + +Do not check for unique origin in CacheStorage, in Electron we may have +scripts running without an origin. + diff --git a/content/browser/cache_storage/cache_storage.cc b/content/browser/cache_storage/cache_storage.cc index d91b54a4d2a1..7f946a5a04c9 100644 --- a/content/browser/cache_storage/cache_storage.cc @@ -11,3 +19,6 @@ index d91b54a4d2a1..7f946a5a04c9 100644 } virtual ~CacheLoader() {} +-- +2.17.0 + diff --git a/patches/common/chromium/no_stack_dumping.patch b/patches/common/chromium/no_stack_dumping.patch index 6594a41eba6..ba4e0c6f132 100644 --- a/patches/common/chromium/no_stack_dumping.patch +++ b/patches/common/chromium/no_stack_dumping.patch @@ -1,8 +1,14 @@ +From 643954ec09f12c4d97767cbfcfb24e92fbcd5230 Mon Sep 17 00:00:00 2001 +From: Aleksei Kuzmin +Date: Thu, 20 Sep 2018 17:46:10 -0700 +Subject: no_stack_dumping.patch + + diff --git a/content/app/content_main_runner_impl.cc b/content/app/content_main_runner_impl.cc -index 83e8990edf17..94b3450bbea5 100644 +index 8d789ef1b9f7..034fdcad958c 100644 --- a/content/app/content_main_runner_impl.cc +++ b/content/app/content_main_runner_impl.cc -@@ -871,7 +871,7 @@ int ContentMainRunnerImpl::Initialize(const ContentMainParams& params) { +@@ -835,7 +835,7 @@ int ContentMainRunnerImpl::Initialize(const ContentMainParams& params) { return nullptr; })); diff --git a/patches/common/chromium/out_of_process_instance.patch b/patches/common/chromium/out_of_process_instance.patch index ccf6c446fa5..70016077464 100644 --- a/patches/common/chromium/out_of_process_instance.patch +++ b/patches/common/chromium/out_of_process_instance.patch @@ -1,5 +1,11 @@ +From 2c3fe795d68b12828a1891c062b77a9b3cddf017 Mon Sep 17 00:00:00 2001 +From: deepak1556 +Date: Thu, 20 Sep 2018 17:46:17 -0700 +Subject: out_of_process_instance.patch + + diff --git a/pdf/out_of_process_instance.cc b/pdf/out_of_process_instance.cc -index 8486db85360f..753c93a8c056 100644 +index 0358d15fb45b..101763db35d1 100644 --- a/pdf/out_of_process_instance.cc +++ b/pdf/out_of_process_instance.cc @@ -455,7 +455,9 @@ bool OutOfProcessInstance::Init(uint32_t argc, @@ -13,3 +19,6 @@ index 8486db85360f..753c93a8c056 100644 return false; // Check if the plugin is full frame. This is passed in from JS. +-- +2.17.0 + diff --git a/patches/common/chromium/pepper_flash.patch b/patches/common/chromium/pepper_flash.patch index 2dc638c6a12..cc16764e1b1 100644 --- a/patches/common/chromium/pepper_flash.patch +++ b/patches/common/chromium/pepper_flash.patch @@ -1,3 +1,10 @@ +From 9d163de412e3c578003f946641b9f840edfc45a4 Mon Sep 17 00:00:00 2001 +From: deepak1556 +Date: Thu, 20 Sep 2018 17:48:09 -0700 +Subject: pepper_flash.patch + +Allows building chrome pepper flash integration for Electron. + diff --git a/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h b/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h index 735da93c3cab..533f53fbc423 100644 --- a/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h @@ -482,3 +489,6 @@ index e021c964da3d..e035f0fb9e2b 100644 public: explicit PepperHelper(content::RenderFrame* render_frame); ~PepperHelper() override; +-- +2.17.0 + diff --git a/patches/common/chromium/render_widget_host_view_base.patch b/patches/common/chromium/render_widget_host_view_base.patch index 4fdb7520319..b4764130f73 100644 --- a/patches/common/chromium/render_widget_host_view_base.patch +++ b/patches/common/chromium/render_widget_host_view_base.patch @@ -1,8 +1,14 @@ +From 22107b997c8c2437e90aeccf4ea795682ebc402a Mon Sep 17 00:00:00 2001 +From: Anonymous +Date: Thu, 20 Sep 2018 17:46:21 -0700 +Subject: render_widget_host_view_base.patch + + diff --git a/content/browser/renderer_host/render_widget_host_view_base.cc b/content/browser/renderer_host/render_widget_host_view_base.cc -index 1c52a5fd396f..bfaa5a0c7c35 100644 +index 5561b7a1f386..913b24cff3b2 100644 --- a/content/browser/renderer_host/render_widget_host_view_base.cc +++ b/content/browser/renderer_host/render_widget_host_view_base.cc -@@ -515,6 +515,15 @@ viz::FrameSinkId RenderWidgetHostViewBase::FrameSinkIdAtPoint( +@@ -567,6 +567,15 @@ viz::FrameSinkId RenderWidgetHostViewBase::FrameSinkIdAtPoint( return frame_sink_id.is_valid() ? frame_sink_id : GetFrameSinkId(); } @@ -19,7 +25,7 @@ index 1c52a5fd396f..bfaa5a0c7c35 100644 const blink::WebMouseEvent& event, const ui::LatencyInfo& latency) { diff --git a/content/browser/renderer_host/render_widget_host_view_base.h b/content/browser/renderer_host/render_widget_host_view_base.h -index 048fd7d3a8bf..1555b278a525 100644 +index 8ed6ffd3a284..dd7fdbbdee59 100644 --- a/content/browser/renderer_host/render_widget_host_view_base.h +++ b/content/browser/renderer_host/render_widget_host_view_base.h @@ -22,8 +22,10 @@ @@ -46,7 +52,7 @@ index 048fd7d3a8bf..1555b278a525 100644 class WebCursor; struct TextInputState; -@@ -142,6 +146,9 @@ class CONTENT_EXPORT RenderWidgetHostViewBase +@@ -144,6 +148,9 @@ class CONTENT_EXPORT RenderWidgetHostViewBase TouchSelectionControllerClientManager* GetTouchSelectionControllerClientManager() override; @@ -56,7 +62,7 @@ index 048fd7d3a8bf..1555b278a525 100644 // This only needs to be overridden by RenderWidgetHostViewBase subclasses // that handle content embedded within other RenderWidgetHostViews. gfx::PointF TransformPointToRootCoordSpaceF( -@@ -346,6 +353,11 @@ class CONTENT_EXPORT RenderWidgetHostViewBase +@@ -351,6 +358,11 @@ class CONTENT_EXPORT RenderWidgetHostViewBase virtual void ProcessGestureEvent(const blink::WebGestureEvent& event, const ui::LatencyInfo& latency); @@ -68,3 +74,6 @@ index 048fd7d3a8bf..1555b278a525 100644 // Transform a point that is in the coordinate space of a Surface that is // embedded within the RenderWidgetHostViewBase's Surface to the // coordinate space of an embedding, or embedded, Surface. Typically this +-- +2.17.0 + diff --git a/patches/common/chromium/render_widget_host_view_mac.patch b/patches/common/chromium/render_widget_host_view_mac.patch index de135e0b23b..424b0443421 100644 --- a/patches/common/chromium/render_widget_host_view_mac.patch +++ b/patches/common/chromium/render_widget_host_view_mac.patch @@ -1,8 +1,14 @@ +From 7c728945a2edf66fc4c795b6b61634b30c76bd1e Mon Sep 17 00:00:00 2001 +From: Cheng Zhao +Date: Thu, 20 Sep 2018 17:46:28 -0700 +Subject: render_widget_host_view_mac.patch + + diff --git a/content/browser/renderer_host/render_widget_host_view_cocoa.mm b/content/browser/renderer_host/render_widget_host_view_cocoa.mm -index 5b4ae0732914..ea774eb81c75 100644 +index 8b84322baa80..70d244e01b75 100644 --- a/content/browser/renderer_host/render_widget_host_view_cocoa.mm +++ b/content/browser/renderer_host/render_widget_host_view_cocoa.mm -@@ -179,6 +179,11 @@ void ExtractUnderlines(NSAttributedString* string, +@@ -174,6 +174,11 @@ void ExtractUnderlines(NSAttributedString* string, } // namespace @@ -14,7 +20,7 @@ index 5b4ae0732914..ea774eb81c75 100644 // These are not documented, so use only after checking -respondsToSelector:. @interface NSApplication (UndocumentedSpeechMethods) - (void)speakString:(NSString*)string; -@@ -363,6 +368,9 @@ void ExtractUnderlines(NSAttributedString* string, +@@ -354,6 +359,9 @@ void ExtractUnderlines(NSAttributedString* string, } - (BOOL)acceptsFirstMouse:(NSEvent*)theEvent { @@ -24,23 +30,7 @@ index 5b4ae0732914..ea774eb81c75 100644 return [self acceptsMouseEventsWhenInactive]; } -@@ -587,6 +595,7 @@ void ExtractUnderlines(NSAttributedString* string, - if (EventIsReservedBySystem(theEvent)) - return NO; - -+#if 0 - // If we return |NO| from this function, cocoa will send the key event to - // the menu and only if the menu does not process the event to |keyDown:|. We - // want to send the event to a renderer _before_ sending it to the menu, so -@@ -600,6 +609,7 @@ void ExtractUnderlines(NSAttributedString* string, - DCHECK(![[NSApp mainMenu] performKeyEquivalent:theEvent]); - return NO; - } -+#endif - - // Command key combinations are sent via performKeyEquivalent rather than - // keyDown:. We just forward this on and if WebCore doesn't want to handle -@@ -699,6 +709,10 @@ void ExtractUnderlines(NSAttributedString* string, +@@ -688,6 +696,10 @@ void ExtractUnderlines(NSAttributedString* string, eventType == NSKeyDown && !(modifierFlags & NSCommandKeyMask); @@ -50,8 +40,8 @@ index 5b4ae0732914..ea774eb81c75 100644 + // We only handle key down events and just simply forward other events. if (eventType != NSKeyDown) { - client_->OnNSViewForwardKeyboardEvent(event, latency_info); -@@ -1461,9 +1475,11 @@ void ExtractUnderlines(NSAttributedString* string, + localClient_->ForwardKeyboardEvent(event, latency_info); +@@ -1460,9 +1472,11 @@ void ExtractUnderlines(NSAttributedString* string, // Since this implementation doesn't have to wait any IPC calls, this doesn't // make any key-typing jank. --hbono 7/23/09 // @@ -63,7 +53,7 @@ index 5b4ae0732914..ea774eb81c75 100644 - (NSArray*)validAttributesForMarkedText { // This code is just copied from WebKit except renaming variables. -@@ -1472,7 +1488,10 @@ extern NSString* NSTextInputReplacementRangeAttributeName; +@@ -1471,7 +1485,10 @@ extern NSString* NSTextInputReplacementRangeAttributeName; initWithObjects:NSUnderlineStyleAttributeName, NSUnderlineColorAttributeName, NSMarkedClauseSegmentAttributeName, @@ -76,11 +66,11 @@ index 5b4ae0732914..ea774eb81c75 100644 return validAttributesForMarkedText_.get(); } diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm -index 8b012bcb8f77..077ccbeaa913 100644 +index 0703dd02c901..7186a054cf55 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm -@@ -53,6 +53,7 @@ - #include "ui/events/keycodes/dom/dom_code.h" +@@ -54,6 +54,7 @@ + #include "ui/events/keycodes/dom/dom_keyboard_layout_map.h" #include "ui/gfx/geometry/dip_util.h" #include "ui/gfx/mac/coordinate_conversion.h" +#include "ui/gl/gpu_switching_manager.h" diff --git a/patches/common/chromium/resource_file_conflict.patch b/patches/common/chromium/resource_file_conflict.patch index a50c2ea70bc..09b712a6279 100644 --- a/patches/common/chromium/resource_file_conflict.patch +++ b/patches/common/chromium/resource_file_conflict.patch @@ -1,8 +1,18 @@ +From a6b7144643673ce4e04f377f4321a4f750f8ffe4 Mon Sep 17 00:00:00 2001 +From: Jeremy Apthorp +Date: Thu, 20 Sep 2018 17:48:59 -0700 +Subject: resource_file_conflict.patch + +Resolve conflict between //chrome's .pak files and //electron's. The paths +that chrome code hardcodes require that we generate resources at these +paths, but GN throws errors if there are multiple targets that generate the +same files. + diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn -index 395d16c7cef2..66d81de66f01 100644 +index a47af42a5a5a..db8311121e75 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn -@@ -1652,6 +1652,11 @@ if (is_chrome_branded && !is_android) { +@@ -1640,6 +1640,11 @@ if (is_chrome_branded && !is_android) { } } @@ -14,7 +24,7 @@ index 395d16c7cef2..66d81de66f01 100644 chrome_paks("packed_resources") { if (is_mac) { output_dir = "$root_gen_dir/repack" -@@ -1673,6 +1678,7 @@ chrome_paks("packed_resources") { +@@ -1661,6 +1666,7 @@ chrome_paks("packed_resources") { ] } } @@ -22,3 +32,6 @@ index 395d16c7cef2..66d81de66f01 100644 repack("browser_tests_pak") { sources = [ +-- +2.17.0 + diff --git a/patches/common/chromium/scoped_clipboard_writer.patch b/patches/common/chromium/scoped_clipboard_writer.patch index b85d32870fb..9aa070d7409 100644 --- a/patches/common/chromium/scoped_clipboard_writer.patch +++ b/patches/common/chromium/scoped_clipboard_writer.patch @@ -1,5 +1,11 @@ +From 691dce7bf41c6fbc8ce3bf9fc3fb4ec0ef0cca21 Mon Sep 17 00:00:00 2001 +From: Anonymous +Date: Thu, 20 Sep 2018 17:46:32 -0700 +Subject: scoped_clipboard_writer.patch + + diff --git a/ui/base/clipboard/scoped_clipboard_writer.cc b/ui/base/clipboard/scoped_clipboard_writer.cc -index 63b5d47b4069..5c48741a3fc7 100644 +index 12680a66d17c..6b95e46e3558 100644 --- a/ui/base/clipboard/scoped_clipboard_writer.cc +++ b/ui/base/clipboard/scoped_clipboard_writer.cc @@ -103,17 +103,16 @@ void ScopedClipboardWriter::WriteImage(const SkBitmap& bitmap) { @@ -25,7 +31,7 @@ index 63b5d47b4069..5c48741a3fc7 100644 Clipboard::ObjectMapParams parameters; parameters.push_back(format_parameter); -@@ -121,6 +120,13 @@ void ScopedClipboardWriter::WritePickledData( +@@ -131,6 +130,13 @@ void ScopedClipboardWriter::WriteData(const std::string& type, objects_[Clipboard::CBF_DATA] = parameters; } @@ -40,7 +46,7 @@ index 63b5d47b4069..5c48741a3fc7 100644 objects_.clear(); bitmap_.reset(); diff --git a/ui/base/clipboard/scoped_clipboard_writer.h b/ui/base/clipboard/scoped_clipboard_writer.h -index bb889c9dd484..bf6cafd9c55a 100644 +index 385900eb67de..cf1f803ec123 100644 --- a/ui/base/clipboard/scoped_clipboard_writer.h +++ b/ui/base/clipboard/scoped_clipboard_writer.h @@ -57,6 +57,11 @@ class UI_BASE_EXPORT ScopedClipboardWriter { @@ -55,3 +61,6 @@ index bb889c9dd484..bf6cafd9c55a 100644 // Adds arbitrary pickled data to clipboard. void WritePickledData(const base::Pickle& pickle, const Clipboard::FormatType& format); +-- +2.17.0 + diff --git a/patches/common/chromium/scroll_bounce_flag.patch b/patches/common/chromium/scroll_bounce_flag.patch index c6de6438ba3..5f2bbac974b 100644 --- a/patches/common/chromium/scroll_bounce_flag.patch +++ b/patches/common/chromium/scroll_bounce_flag.patch @@ -1,8 +1,15 @@ +From cc50dccf546c8bd730fb42e912e0cd231c9b1f84 Mon Sep 17 00:00:00 2001 +From: Cheng Zhao +Date: Thu, 20 Sep 2018 17:49:03 -0700 +Subject: scroll_bounce_flag.patch + +Patch to make scrollBounce option work. + diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc -index 06f7d4487997..e1deb93f8b0d 100644 +index c078565cef71..5c31ab7654d0 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc -@@ -1644,7 +1644,7 @@ bool RenderThreadImpl::IsGpuMemoryBufferCompositorResourcesEnabled() { +@@ -1610,7 +1610,7 @@ bool RenderThreadImpl::IsGpuMemoryBufferCompositorResourcesEnabled() { } bool RenderThreadImpl::IsElasticOverscrollEnabled() { @@ -10,4 +17,7 @@ index 06f7d4487997..e1deb93f8b0d 100644 + return base::CommandLine::ForCurrentProcess()->HasSwitch("scroll-bounce"); } - scoped_refptr + bool RenderThreadImpl::IsUseZoomForDSFEnabled() { +-- +2.17.0 + diff --git a/patches/common/chromium/ssl_security_state_tab_helper.patch b/patches/common/chromium/ssl_security_state_tab_helper.patch index a43268b556e..d647be74205 100644 --- a/patches/common/chromium/ssl_security_state_tab_helper.patch +++ b/patches/common/chromium/ssl_security_state_tab_helper.patch @@ -1,5 +1,12 @@ +From 87f31d450894df2b00c6a2d6fb7eb2639b595756 Mon Sep 17 00:00:00 2001 +From: deepak1556 +Date: Thu, 20 Sep 2018 17:50:34 -0700 +Subject: ssl_security_state_tab_helper.patch + +Allows populating security tab info for devtools in Electron. + diff --git a/chrome/browser/ssl/security_state_tab_helper.cc b/chrome/browser/ssl/security_state_tab_helper.cc -index 7b12c9d2df52..e75171b86ef1 100644 +index 58066f3a532b..a1643c6492e3 100644 --- a/chrome/browser/ssl/security_state_tab_helper.cc +++ b/chrome/browser/ssl/security_state_tab_helper.cc @@ -13,17 +13,23 @@ @@ -83,7 +90,7 @@ index 7b12c9d2df52..e75171b86ef1 100644 safe_browsing::SafeBrowsingService* sb_service = g_browser_process->safe_browsing_service(); if (!sb_service) -@@ -323,6 +337,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const { +@@ -340,6 +354,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const { break; } } @@ -91,7 +98,7 @@ index 7b12c9d2df52..e75171b86ef1 100644 return security_state::MALICIOUS_CONTENT_STATUS_NONE; } -@@ -343,15 +358,19 @@ std::vector SecurityStateTabHelper::GetSecureOriginsAndPatterns() +@@ -360,15 +375,19 @@ std::vector SecurityStateTabHelper::GetSecureOriginsAndPatterns() const { const base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); @@ -112,7 +119,7 @@ index 7b12c9d2df52..e75171b86ef1 100644 return secure_origin_whitelist::ParseWhitelist(origins_str); } diff --git a/chrome/common/secure_origin_whitelist.cc b/chrome/common/secure_origin_whitelist.cc -index db9bb54ddbc1..cc7a22bdb920 100644 +index 3319df136d4d..fbc6eea480d2 100644 --- a/chrome/common/secure_origin_whitelist.cc +++ b/chrome/common/secure_origin_whitelist.cc @@ -13,7 +13,9 @@ @@ -125,7 +132,7 @@ index db9bb54ddbc1..cc7a22bdb920 100644 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" #include "url/gurl.h" #include "url/origin.h" -@@ -155,7 +157,9 @@ std::vector GetWhitelist() { +@@ -163,7 +165,9 @@ std::vector GetWhitelist() { std::set GetSchemesBypassingSecureContextCheck() { std::set schemes; @@ -135,3 +142,6 @@ index db9bb54ddbc1..cc7a22bdb920 100644 return schemes; } +-- +2.17.0 + diff --git a/patches/common/chromium/statically_build_power_save_blocker.patch b/patches/common/chromium/statically_build_power_save_blocker.patch index bc15cc6bd9c..9af88c80a96 100644 --- a/patches/common/chromium/statically_build_power_save_blocker.patch +++ b/patches/common/chromium/statically_build_power_save_blocker.patch @@ -1,3 +1,9 @@ +From a99c5f94fd02a391cde00aedfd613937cb72d558 Mon Sep 17 00:00:00 2001 +From: Aleksei Kuzmin +Date: Thu, 20 Sep 2018 17:47:22 -0700 +Subject: statically_build_power_save_blocker.patch + + diff --git a/services/device/wake_lock/power_save_blocker/BUILD.gn b/services/device/wake_lock/power_save_blocker/BUILD.gn index dfce90f6b791..a2f7f776f4d8 100644 --- a/services/device/wake_lock/power_save_blocker/BUILD.gn @@ -19,3 +25,6 @@ index dfce90f6b791..a2f7f776f4d8 100644 ] sources = [ +-- +2.17.0 + diff --git a/patches/common/chromium/stream_resource_handler.patch b/patches/common/chromium/stream_resource_handler.patch index abbdba57621..6572b880176 100644 --- a/patches/common/chromium/stream_resource_handler.patch +++ b/patches/common/chromium/stream_resource_handler.patch @@ -1,5 +1,11 @@ +From 62bf8be2412ea4b7fef28d0a6fc2a8baecc8980e Mon Sep 17 00:00:00 2001 +From: deepak1556 +Date: Thu, 20 Sep 2018 17:46:39 -0700 +Subject: stream_resource_handler.patch + + diff --git a/content/browser/loader/stream_resource_handler.h b/content/browser/loader/stream_resource_handler.h -index cb8a2d58d6b8..dbfa64089325 100644 +index b6f51bba48cd..1ee88dfacee3 100644 --- a/content/browser/loader/stream_resource_handler.h +++ b/content/browser/loader/stream_resource_handler.h @@ -11,6 +11,7 @@ @@ -19,3 +25,6 @@ index cb8a2d58d6b8..dbfa64089325 100644 public: // |origin| will be used to construct the URL for the Stream. See // WebCore::BlobURL and and WebCore::SecurityOrigin in Blink to understand +-- +2.17.0 + diff --git a/patches/common/chromium/thread_capabilities.patch b/patches/common/chromium/thread_capabilities.patch index 8efef1793ae..f8e33a33adc 100644 --- a/patches/common/chromium/thread_capabilities.patch +++ b/patches/common/chromium/thread_capabilities.patch @@ -1,3 +1,15 @@ +From 47f675c132ac4d4234f14f0c1ffb7aea407a60f7 Mon Sep 17 00:00:00 2001 +From: Anonymous +Date: Thu, 20 Sep 2018 17:46:43 -0700 +Subject: thread_capabilities.patch + +Chromium automatically drops all capabilities of renderer threads in +Linux, which may cause issues in a context like Electron, where the main +and renderer threads are supposed to keep inherited permissions over the +system. + +See https://github.com/atom/electron/issues/3666 + diff --git a/sandbox/linux/services/credentials.cc b/sandbox/linux/services/credentials.cc index ad0714a7f5ed..1406e1d53f2f 100644 --- a/sandbox/linux/services/credentials.cc @@ -13,3 +25,6 @@ index ad0714a7f5ed..1406e1d53f2f 100644 return 0; } +-- +2.17.0 + diff --git a/patches/common/chromium/use_transparent_window.patch b/patches/common/chromium/use_transparent_window.patch index c38cdae3b31..27f03be9b39 100644 --- a/patches/common/chromium/use_transparent_window.patch +++ b/patches/common/chromium/use_transparent_window.patch @@ -1,3 +1,9 @@ +From 808f3b08bf415b980b6e47573ca178c333c9c344 Mon Sep 17 00:00:00 2001 +From: Cheng Zhao +Date: Thu, 20 Sep 2018 17:46:50 -0700 +Subject: use_transparent_window.patch + + diff --git a/ui/gl/gpu_switching_manager.cc b/ui/gl/gpu_switching_manager.cc index be7156465809..4529866b0864 100644 --- a/ui/gl/gpu_switching_manager.cc @@ -46,3 +52,6 @@ index 4308bbed9398..a7cafcfccdff 100644 void AddObserver(GpuSwitchingObserver* observer); void RemoveObserver(GpuSwitchingObserver* observer); +-- +2.17.0 + diff --git a/patches/common/chromium/v8_context_snapshot_generator.patch b/patches/common/chromium/v8_context_snapshot_generator.patch index 576bab5e5b8..3ca23ecea27 100644 --- a/patches/common/chromium/v8_context_snapshot_generator.patch +++ b/patches/common/chromium/v8_context_snapshot_generator.patch @@ -1,8 +1,16 @@ +From e51d8c2a477d55c279c5935c02dab83ef34f3392 Mon Sep 17 00:00:00 2001 +From: Nitish Sakhawalkar +Date: Thu, 20 Sep 2018 17:47:58 -0700 +Subject: v8_context_snapshot_generator.patch + +v8_context_snapshot_generator is a build time executable. +The patch adds the config. + diff --git a/tools/v8_context_snapshot/BUILD.gn b/tools/v8_context_snapshot/BUILD.gn -index d6691a527f25..000105b86f53 100644 +index b119ec095c7b..47df8af5ef68 100644 --- a/tools/v8_context_snapshot/BUILD.gn +++ b/tools/v8_context_snapshot/BUILD.gn -@@ -105,6 +105,7 @@ if (use_v8_context_snapshot) { +@@ -114,6 +114,7 @@ if (use_v8_context_snapshot) { configs += [ "//v8:external_startup_data", ":disable_icf", @@ -10,3 +18,6 @@ index d6691a527f25..000105b86f53 100644 ] } } +-- +2.17.0 + diff --git a/patches/common/chromium/web_contents.patch b/patches/common/chromium/web_contents.patch index 2b361f25c14..919bfceb3a5 100644 --- a/patches/common/chromium/web_contents.patch +++ b/patches/common/chromium/web_contents.patch @@ -1,8 +1,14 @@ +From 3fae422b46dec513879ec6d4fd8c8dd4c4cdcd0f Mon Sep 17 00:00:00 2001 +From: Anonymous +Date: Thu, 20 Sep 2018 17:46:53 -0700 +Subject: web_contents.patch + + diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 6ae9bf2f9c6a..6ed6ece96d0f 100644 +index 26384f823b51..64ad6ca91d93 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -1845,6 +1845,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { +@@ -1931,6 +1931,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { std::string unique_name; frame_tree_.root()->SetFrameName(params.main_frame_name, unique_name); @@ -15,7 +21,7 @@ index 6ae9bf2f9c6a..6ed6ece96d0f 100644 WebContentsViewDelegate* delegate = GetContentClient()->browser()->GetWebContentsViewDelegate(this); -@@ -1860,6 +1866,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { +@@ -1946,6 +1952,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { &render_view_host_delegate_view_); } } @@ -24,7 +30,7 @@ index 6ae9bf2f9c6a..6ed6ece96d0f 100644 CHECK(view_.get()); diff --git a/content/browser/web_contents/web_contents_view_guest.cc b/content/browser/web_contents/web_contents_view_guest.cc -index 699570cc1390..63e60667fa7d 100644 +index 44c68ed25b66..c7b0c747fa41 100644 --- a/content/browser/web_contents/web_contents_view_guest.cc +++ b/content/browser/web_contents/web_contents_view_guest.cc @@ -67,21 +67,27 @@ gfx::NativeWindow WebContentsViewGuest::GetTopLevelNativeWindow() const { @@ -38,7 +44,7 @@ index 699570cc1390..63e60667fa7d 100644 // view hierarchy. We add this view as embedder's child here. // This would go in WebContentsViewGuest::CreateView, but that is too early to // access embedder_web_contents(). Therefore, we do it here. - if (!base::FeatureList::IsEnabled(features::kMash)) + if (features::IsAshInBrowserProcess()) - parent_view->GetNativeView()->AddChild(platform_view_->GetNativeView()); + if (parent_view->GetNativeView() != platform_view_->GetNativeView()) + parent_view->GetNativeView()->AddChild(platform_view_->GetNativeView()); @@ -49,7 +55,7 @@ index 699570cc1390..63e60667fa7d 100644 #if defined(USE_AURA) + if (!platform_view_->GetNativeView()) + return; - if (!base::FeatureList::IsEnabled(features::kMash)) { + if (features::IsAshInBrowserProcess()) { - old_parent_view->GetNativeView()->RemoveChild( - platform_view_->GetNativeView()); + if (old_parent_view->GetNativeView() != platform_view_->GetNativeView()) @@ -86,10 +92,10 @@ index 699570cc1390..63e60667fa7d 100644 RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForPopupWidget( diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h -index dee5814a247c..7690ce8d404b 100644 +index 0f82f91e437c..0deb4d93fffb 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h -@@ -74,9 +74,12 @@ class BrowserPluginGuestDelegate; +@@ -76,9 +76,12 @@ class BrowserPluginGuestDelegate; class InterstitialPage; class RenderFrameHost; class RenderViewHost; @@ -102,7 +108,7 @@ index dee5814a247c..7690ce8d404b 100644 struct CustomContextMenuContext; struct DropData; struct MHTMLGenerationParams; -@@ -213,6 +216,10 @@ class WebContents : public PageNavigator, +@@ -215,6 +218,10 @@ class WebContents : public PageNavigator, kInitializeAndWarmupRendererProcess, } desired_renderer_state; @@ -112,4 +118,7 @@ index dee5814a247c..7690ce8d404b 100644 + // Sandboxing flags set on the new WebContents. blink::WebSandboxFlags starting_sandbox_flags; - }; + +-- +2.17.0 + diff --git a/patches/common/chromium/webgl_context_attributes.patch b/patches/common/chromium/webgl_context_attributes.patch index ba6730f6486..cd3e3bfdebd 100644 --- a/patches/common/chromium/webgl_context_attributes.patch +++ b/patches/common/chromium/webgl_context_attributes.patch @@ -1,8 +1,14 @@ +From 2ece85392855af0ea2c9406f98922a869d335bcd Mon Sep 17 00:00:00 2001 +From: Milan Burda +Date: Thu, 20 Sep 2018 17:47:01 -0700 +Subject: webgl_context_attributes.patch + + diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc -index 4205c92765af..c82360f146d1 100644 +index a9b86c68fe50..46931503ec2b 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc -@@ -1021,8 +1021,10 @@ RendererBlinkPlatformImpl::CreateOffscreenGraphicsContext3DProvider( +@@ -997,8 +997,10 @@ RendererBlinkPlatformImpl::CreateOffscreenGraphicsContext3DProvider( attributes.sample_buffers = 0; attributes.bind_generates_resource = false; attributes.enable_raster_interface = web_attributes.enable_raster_interface; @@ -16,11 +22,11 @@ index 4205c92765af..c82360f146d1 100644 attributes.fail_if_major_perf_caveat = web_attributes.fail_if_major_performance_caveat; diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h -index f3ec52975650..920d161a1b81 100644 +index f927253a7e0b..12ada20ec3a3 100644 --- a/third_party/blink/public/platform/platform.h +++ b/third_party/blink/public/platform/platform.h -@@ -493,6 +493,7 @@ class BLINK_PLATFORM_EXPORT Platform { - kGLES3ContextType, // GLES 3.0 context +@@ -500,6 +500,7 @@ class BLINK_PLATFORM_EXPORT Platform { + kGLES3ContextType, // GLES 3.0 context }; struct ContextAttributes { + bool prefer_integrated_gpu = false; @@ -28,7 +34,7 @@ index f3ec52975650..920d161a1b81 100644 ContextType context_type = kGLES2ContextType; // Offscreen contexts usually share a surface for the default frame buffer diff --git a/third_party/blink/renderer/core/html/canvas/canvas_context_creation_attributes_core.h b/third_party/blink/renderer/core/html/canvas/canvas_context_creation_attributes_core.h -index 298e186289a0..5223ae30db6b 100644 +index 03da0840b0e3..9551675de44d 100644 --- a/third_party/blink/renderer/core/html/canvas/canvas_context_creation_attributes_core.h +++ b/third_party/blink/renderer/core/html/canvas/canvas_context_creation_attributes_core.h @@ -30,6 +30,7 @@ class CORE_EXPORT CanvasContextCreationAttributesCore { @@ -65,7 +71,7 @@ index 7b655dd12a77..8969eb7d98f3 100644 [OriginTrialEnabled=WebXR] XRDevice compatibleXRDevice = null; }; diff --git a/third_party/blink/renderer/modules/webgl/webgl_context_attribute_helpers.cc b/third_party/blink/renderer/modules/webgl/webgl_context_attribute_helpers.cc -index 7274af57b8ee..2a2737da1a56 100644 +index 3846b2a179d9..bf7c63a81391 100644 --- a/third_party/blink/renderer/modules/webgl/webgl_context_attribute_helpers.cc +++ b/third_party/blink/renderer/modules/webgl/webgl_context_attribute_helpers.cc @@ -18,6 +18,7 @@ WebGLContextAttributes ToWebGLContextAttributes( @@ -77,13 +83,13 @@ index 7274af57b8ee..2a2737da1a56 100644 attrs.fail_if_major_performance_caveat); result.setCompatibleXRDevice( @@ -30,6 +31,7 @@ Platform::ContextAttributes ToPlatformContextAttributes( - unsigned web_gl_version, + Platform::ContextType context_type, bool support_own_offscreen_surface) { Platform::ContextAttributes result; + result.prefer_integrated_gpu = attrs.power_preference == "low-power"; result.fail_if_major_performance_caveat = attrs.fail_if_major_performance_caveat; - result.context_type = web_gl_version == 2 ? Platform::kWebGL2ContextType + result.context_type = context_type; diff --git a/third_party/blink/renderer/modules/webgl/webgl_context_attributes.idl b/third_party/blink/renderer/modules/webgl/webgl_context_attributes.idl index 38ca0f6b6a0c..90cfe8497daf 100644 --- a/third_party/blink/renderer/modules/webgl/webgl_context_attributes.idl diff --git a/patches/common/chromium/webui_in_subframes.patch b/patches/common/chromium/webui_in_subframes.patch index e0a8de9e540..f7623901548 100644 --- a/patches/common/chromium/webui_in_subframes.patch +++ b/patches/common/chromium/webui_in_subframes.patch @@ -1,5 +1,11 @@ +From 8154c4c74afebf8f2918cf18179b6c8eda632af6 Mon Sep 17 00:00:00 2001 +From: Anonymous +Date: Thu, 20 Sep 2018 17:47:15 -0700 +Subject: webui_in_subframes.patch + + diff --git a/content/browser/frame_host/render_frame_host_delegate.cc b/content/browser/frame_host/render_frame_host_delegate.cc -index 390bcf09995e..f9090f8ea24a 100644 +index 26b8eec2bb76..fb3843168f14 100644 --- a/content/browser/frame_host/render_frame_host_delegate.cc +++ b/content/browser/frame_host/render_frame_host_delegate.cc @@ -99,7 +99,9 @@ RenderFrameHostDelegate::GetFocusedFrameIncludingInnerWebContents() { @@ -14,10 +20,10 @@ index 390bcf09995e..f9090f8ea24a 100644 } diff --git a/content/browser/frame_host/render_frame_host_delegate.h b/content/browser/frame_host/render_frame_host_delegate.h -index cd4a295dfa37..1057c6d33b9e 100644 +index 7919ac1e5795..03f331915213 100644 --- a/content/browser/frame_host/render_frame_host_delegate.h +++ b/content/browser/frame_host/render_frame_host_delegate.h -@@ -275,7 +275,8 @@ class CONTENT_EXPORT RenderFrameHostDelegate { +@@ -278,7 +278,8 @@ class CONTENT_EXPORT RenderFrameHostDelegate { // Creates a WebUI object for a frame navigating to |url|. If no WebUI // applies, returns null. virtual std::unique_ptr CreateWebUIForRenderFrameHost( @@ -28,10 +34,10 @@ index cd4a295dfa37..1057c6d33b9e 100644 // Called by |frame| to notify that it has received an update on focused // element. |bounds_in_root_view| is the rectangle containing the element that diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc -index 7a53675a2139..29bb8eaba5c1 100644 +index 783dc705f748..9fa14c824032 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc -@@ -25,6 +25,7 @@ +@@ -26,6 +26,7 @@ #include "base/task_scheduler/post_task.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" @@ -39,7 +45,7 @@ index 7a53675a2139..29bb8eaba5c1 100644 #include "build/build_config.h" #include "cc/base/switches.h" #include "content/browser/accessibility/browser_accessibility_manager.h" -@@ -4198,8 +4199,23 @@ bool RenderFrameHostImpl::UpdatePendingWebUI(const GURL& dest_url, +@@ -4314,8 +4315,23 @@ bool RenderFrameHostImpl::UpdatePendingWebUI(const GURL& dest_url, DCHECK(web_ui_); should_reuse_web_ui_ = true; } else { @@ -65,10 +71,10 @@ index 7a53675a2139..29bb8eaba5c1 100644 pending_web_ui_type_ = new_web_ui_type; diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 6ed6ece96d0f..11bf320311bb 100644 +index 64ad6ca91d93..88211169a7d7 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -752,6 +752,25 @@ RenderFrameHostManager* WebContentsImpl::GetRenderManagerForTesting() { +@@ -788,6 +788,25 @@ RenderFrameHostManager* WebContentsImpl::GetRenderManagerForTesting() { return GetRenderManager(); } @@ -94,7 +100,7 @@ index 6ed6ece96d0f..11bf320311bb 100644 bool WebContentsImpl::OnMessageReceived(RenderViewHostImpl* render_view_host, const IPC::Message& message) { for (auto& observer : observers_) { -@@ -787,9 +806,10 @@ bool WebContentsImpl::OnMessageReceived(RenderViewHostImpl* render_view_host, +@@ -823,9 +842,10 @@ bool WebContentsImpl::OnMessageReceived(RenderViewHostImpl* render_view_host, bool WebContentsImpl::OnMessageReceived(RenderFrameHostImpl* render_frame_host, const IPC::Message& message) { @@ -108,7 +114,7 @@ index 6ed6ece96d0f..11bf320311bb 100644 return true; } -@@ -5782,8 +5802,9 @@ NavigationControllerImpl& WebContentsImpl::GetControllerForRenderManager() { +@@ -5974,8 +5994,9 @@ NavigationControllerImpl& WebContentsImpl::GetControllerForRenderManager() { } std::unique_ptr WebContentsImpl::CreateWebUIForRenderFrameHost( @@ -121,10 +127,10 @@ index 6ed6ece96d0f..11bf320311bb 100644 NavigationEntry* diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h -index cd1c992c7738..5d52d8cb0bc4 100644 +index d16a99122772..907738e0bf80 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h -@@ -543,7 +543,8 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents, +@@ -542,7 +542,8 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents, SiteInstance* source_site_instance) const override; void EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) override; std::unique_ptr CreateWebUIForRenderFrameHost( @@ -134,3 +140,6 @@ index cd1c992c7738..5d52d8cb0bc4 100644 void SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) override; void DidCallFocus() override; RenderFrameHost* GetFocusedFrameIncludingInnerWebContents() override; +-- +2.17.0 + diff --git a/patches/common/chromium/webview_cross_drag.patch b/patches/common/chromium/webview_cross_drag.patch index 21bbe1fc45a..9b52d51863c 100644 --- a/patches/common/chromium/webview_cross_drag.patch +++ b/patches/common/chromium/webview_cross_drag.patch @@ -1,5 +1,11 @@ +From 27c9f8e5be435006424d885985f4e017602402fe Mon Sep 17 00:00:00 2001 +From: Anonymous +Date: Thu, 20 Sep 2018 17:47:04 -0700 +Subject: webview_cross_drag.patch + + diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc -index 984fa41d064c..28c018d9fbfc 100644 +index 713b17948ef7..cd2d022ff53e 100644 --- a/content/browser/web_contents/web_contents_view_aura.cc +++ b/content/browser/web_contents/web_contents_view_aura.cc @@ -609,6 +609,7 @@ gfx::NativeView WebContentsViewAura::GetRenderWidgetHostViewParent() const { @@ -22,3 +28,6 @@ index cec3bd8a97b8..7a2b4462bd44 100644 return targetRWH->GetProcess()->GetID() == dragStartProcessID_ || GetRenderViewHostID(webContents_->GetRenderViewHost()) != dragStartViewID_; +-- +2.17.0 + diff --git a/patches/common/chromium/webview_reattach.patch b/patches/common/chromium/webview_reattach.patch index ef9933cbdfd..2b5ae2f77dd 100644 --- a/patches/common/chromium/webview_reattach.patch +++ b/patches/common/chromium/webview_reattach.patch @@ -1,16 +1,28 @@ +From e97c5ed19320a2fc34e8b71ef838d176db8bd5b0 Mon Sep 17 00:00:00 2001 +From: Cheng Zhao +Date: Thu, 20 Sep 2018 17:49:13 -0700 +Subject: webview_reattach.patch + +Backports https://chromium-review.googlesource.com/c/chromium/src/+/1161391 +Fixes webview not working after renderer process restarted. + diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 11bf320311bb..27f087d4f706 100644 +index 88211169a7d7..7b2715aea2af 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4725,6 +4725,11 @@ void WebContentsImpl::NotifyViewSwapped(RenderViewHost* old_host, - for (auto& observer : observers_) - observer.RenderViewHostChanged(old_host, new_host); +@@ -4906,6 +4906,12 @@ void WebContentsImpl::NotifyViewSwapped(RenderViewHost* old_host, + + view_->RenderViewHostChanged(old_host, new_host); + // If this is an inner WebContents that has swapped views, we need to reattach + // it to its outer WebContents. + if (node_.outer_web_contents()) + ReattachToOuterWebContentsFrame(); ++ + // Ensure that the associated embedder gets cleared after a RenderViewHost // gets swapped, so we don't reuse the same embedder next time a // RenderViewHost is attached to this WebContents. +-- +2.17.0 + diff --git a/patches/common/chromium/windows_cc_wrapper.patch b/patches/common/chromium/windows_cc_wrapper.patch index 11326000ce0..bb3991a9cc0 100644 --- a/patches/common/chromium/windows_cc_wrapper.patch +++ b/patches/common/chromium/windows_cc_wrapper.patch @@ -1,5 +1,12 @@ +From 8fda73933a1a6d1a25b6160bc3629132ba075bfd Mon Sep 17 00:00:00 2001 +From: John Kleinschmidt +Date: Thu, 20 Sep 2018 17:49:45 -0700 +Subject: windows_cc_wrapper.patch + +Allow use of cc_wrapper (eg sccache). + diff --git a/build/toolchain/win/BUILD.gn b/build/toolchain/win/BUILD.gn -index 286c791613ba..55b5499a1cb2 100644 +index fdffcdbdbbfe..0b7487e1d288 100644 --- a/build/toolchain/win/BUILD.gn +++ b/build/toolchain/win/BUILD.gn @@ -6,6 +6,7 @@ import("//build/config/clang/clang.gni") @@ -25,21 +32,24 @@ index 286c791613ba..55b5499a1cb2 100644 } # Copy the VS runtime DLL for the default toolchain to the root build directory -@@ -381,7 +388,7 @@ if (win_build_host_cpu != "x64") { +@@ -404,7 +411,7 @@ if (win_build_host_cpu != "x64") { msvc_toolchain("win_clang_" + win_build_host_cpu) { environment = "environment." + win_build_host_cpu prefix = rebase_path("$clang_base_path/bin", root_build_dir) - cl = "${goma_prefix}$prefix/${clang_cl}" + cl = "${clang_prefix}$prefix/${clang_cl}" sys_include_flags = "${build_cpu_toolchain_data.include_flags_imsvc}" - - toolchain_args = { -@@ -422,7 +429,7 @@ template("win_x64_toolchains") { + if (host_os != "win") { + # For win cross build. +@@ -453,7 +460,7 @@ template("win_x64_toolchains") { msvc_toolchain("win_clang_" + target_name) { environment = "environment.x64" prefix = rebase_path("$clang_base_path/bin", root_build_dir) - cl = "${goma_prefix}$prefix/${clang_cl}" + cl = "${clang_prefix}$prefix/${clang_cl}" sys_include_flags = "${x64_toolchain_data.include_flags_imsvc}" - - toolchain_args = { + if (host_os != "win") { + # For win cross build +-- +2.17.0 + diff --git a/patches/common/chromium/worker_context_will_destroy.patch b/patches/common/chromium/worker_context_will_destroy.patch index a5f07e48e7e..376c12bce78 100644 --- a/patches/common/chromium/worker_context_will_destroy.patch +++ b/patches/common/chromium/worker_context_will_destroy.patch @@ -1,8 +1,14 @@ +From d822ef159744a681bee4f1ca8e1a7776a76e6d5e Mon Sep 17 00:00:00 2001 +From: Cheng Zhao +Date: Thu, 20 Sep 2018 17:47:12 -0700 +Subject: worker_context_will_destroy.patch + + diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h -index 6dd2589d653a..48bb1dbe9750 100644 +index a2dc7a811e75..5cbfe0e0bef3 100644 --- a/content/public/renderer/content_renderer_client.h +++ b/content/public/renderer/content_renderer_client.h -@@ -380,6 +380,11 @@ class CONTENT_EXPORT ContentRendererClient { +@@ -377,6 +377,11 @@ class CONTENT_EXPORT ContentRendererClient { virtual void DidInitializeWorkerContextOnWorkerThread( v8::Local context) {} @@ -15,10 +21,10 @@ index 6dd2589d653a..48bb1dbe9750 100644 // An empty URL is returned if the URL is not overriden. virtual GURL OverrideFlashEmbedWithHTML(const GURL& url); diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc -index c82360f146d1..e0a90a8a6881 100644 +index 46931503ec2b..1c2ae4550384 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc -@@ -1251,6 +1251,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() { +@@ -1108,6 +1108,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() { WorkerThreadRegistry::Instance()->WillStopCurrentWorkerThread(); } @@ -32,22 +38,22 @@ index c82360f146d1..e0a90a8a6881 100644 const v8::Local& worker) { GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h -index ecb5ce6d6aa0..dffe3bca1a34 100644 +index bebcd933b8ce..49d981cc18ea 100644 --- a/content/renderer/renderer_blink_platform_impl.h +++ b/content/renderer/renderer_blink_platform_impl.h -@@ -204,6 +204,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { +@@ -201,6 +201,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { void DidStartWorkerThread() override; void WillStopWorkerThread() override; void WorkerContextCreated(const v8::Local& worker) override; + void WorkerContextWillDestroy(const v8::Local& worker) override; - // Set the PlatformEventObserverBase in |platform_event_observers_| associated - // with |type| to |observer|. If there was already an observer associated to + // Disables the WebSandboxSupport implementation for testing. + // Tests that do not set up a full sandbox environment should call diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h -index 920d161a1b81..f97250ea984e 100644 +index 12ada20ec3a3..0e1555e5a3c9 100644 --- a/third_party/blink/public/platform/platform.h +++ b/third_party/blink/public/platform/platform.h -@@ -616,6 +616,7 @@ class BLINK_PLATFORM_EXPORT Platform { +@@ -626,6 +626,7 @@ class BLINK_PLATFORM_EXPORT Platform { virtual void DidStartWorkerThread() {} virtual void WillStopWorkerThread() {} virtual void WorkerContextCreated(const v8::Local& worker) {} @@ -56,10 +62,10 @@ index 920d161a1b81..f97250ea984e 100644 return false; } diff --git a/third_party/blink/renderer/core/workers/worker_thread.cc b/third_party/blink/renderer/core/workers/worker_thread.cc -index 7cf818b56c13..7e6e1191c399 100644 +index 6b4a2ce05520..2ba97d5ec53a 100644 --- a/third_party/blink/renderer/core/workers/worker_thread.cc +++ b/third_party/blink/renderer/core/workers/worker_thread.cc -@@ -517,6 +517,12 @@ void WorkerThread::PrepareForShutdownOnWorkerThread() { +@@ -514,6 +514,12 @@ void WorkerThread::PrepareForShutdownOnWorkerThread() { SetExitCode(ExitCode::kGracefullyTerminated); } @@ -69,8 +75,8 @@ index 7cf818b56c13..7e6e1191c399 100644 + GlobalScope()->ScriptController()->GetContext()); + } + - inspector_task_runner_->Dispose(); GetWorkerReportingProxy().WillDestroyWorkerGlobalScope(); + probe::AllAsyncTasksCanceled(GlobalScope()); -- 2.17.0 diff --git a/patches/common/v8/build_gn.patch b/patches/common/v8/build_gn.patch index 0d331aa587b..c8e70fae66e 100644 --- a/patches/common/v8/build_gn.patch +++ b/patches/common/v8/build_gn.patch @@ -1,17 +1,17 @@ diff --git a/BUILD.gn b/BUILD.gn -index 456a318c1c..283bce15f0 100644 +index 443694d880..d0ba5ed04e 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -195,7 +195,7 @@ config("internal_config") { - "$target_gen_dir", - ] +@@ -212,7 +212,7 @@ config("internal_config") { + + defines = [] - if (is_component_build) { + if (is_component_build || is_electron_build) { - defines = [ "BUILDING_V8_SHARED" ] + defines += [ "BUILDING_V8_SHARED" ] } } -@@ -2674,6 +2674,8 @@ if (current_toolchain == v8_snapshot_toolchain) { +@@ -3138,6 +3138,8 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) { configs = [ ":internal_config" ] diff --git a/patches/common/v8/node_v8_patches.patch b/patches/common/v8/node_v8_patches.patch index d9e320b5908..dae860f464d 100644 --- a/patches/common/v8/node_v8_patches.patch +++ b/patches/common/v8/node_v8_patches.patch @@ -1,3230 +1,56 @@ -From 762089e4aab680cd7f6841d9b596ab9a2ffad3fc Mon Sep 17 00:00:00 2001 -From: Matheus Marchini -Date: Mon, 18 Jun 2018 09:47:52 -0700 -Subject: [PATCH 01/23] deps: cherry-pick 5dd3395 from upstream V8 - -Original commit message: - - [log] improve --perf-basic-prof-only-functions - - Change --perf-basic-prof-only-functions to also log builtin code - creation events, otherwise InterpretedFunctions generated by - --interpreted-frames-native-stack will be filtered out. - - R=yangguo@google.com - - Change-Id: Ib0623fca88e25c514473a43de56ebbbdcb146f97 - Reviewed-on: https://chromium-review.googlesource.com/1100014 - Reviewed-by: Yang Guo - Commit-Queue: Yang Guo - Cr-Commit-Position: refs/heads/master@{#53760} - -Refs: https://github.com/v8/v8/commit/5dd33955d5cb1d84dd2509363e11d3c2a - -Backport-PR-URL: https://github.com/nodejs/node/pull/21668 -PR-URL: https://github.com/nodejs/node/pull/21386 -Reviewed-By: Yang Guo -Reviewed-By: Gus Caplan -Reviewed-By: James M Snell ---- - src/log.cc | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/log.cc b/src/log.cc -index 953216aef7..f5e1fe6baf 100644 ---- a/src/log.cc -+++ b/src/log.cc -@@ -305,6 +305,7 @@ void PerfBasicLogger::LogRecordedBuffer(AbstractCode* code, SharedFunctionInfo*, - const char* name, int length) { - if (FLAG_perf_basic_prof_only_functions && - (code->kind() != AbstractCode::INTERPRETED_FUNCTION && -+ code->kind() != AbstractCode::BUILTIN && - code->kind() != AbstractCode::OPTIMIZED_FUNCTION)) { - return; - } --- -2.17.0 - - -From bf391a14d065dcaeef410a09d300c5e91a06bf8f Mon Sep 17 00:00:00 2001 +From 5bb985d3312191d67490f9d826fd13cdbda610e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= -Date: Thu, 5 Jul 2018 08:38:02 +0200 -Subject: [PATCH 02/23] deps: cherry-pick aa6ce3e from upstream V8 +Date: Wed, 25 Jul 2018 20:03:35 +0200 +Subject: [PATCH 01/11] deps: cherry-pick 0dd3390 from upstream V8 Original commit message: - [log][api] introduce public CodeEventListener API + Reland "[builtins] Add %IsTraceCategoryEnabled and %Trace builtins" - Introduce a new public API called CodeEventListener to allow embedders - to better support external profilers and other diagnostic tools without - relying on unsupported methods like --perf-basic-prof. + This is a reland of 8d4572a22b5d2fa0547195bcc40baa18b7565386 - Bug: v8:7694 - Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng - Change-Id: I063cc965394d59401358757634c9ea84c11517e9 - Co-authored-by: Daniel Beckert - Reviewed-on: https://chromium-review.googlesource.com/1028770 + Original change's description: + > [builtins] Add %IsTraceCategoryEnabled and %Trace builtins + > + > Adds the builtin Trace and IsTraceCategoryEnabled functions + > exposed via extra bindings. These are intended to use by + > embedders to allow basic trace event support from JavaScript. + > + > ```js + > isTraceCategoryEnabled('v8.some-category') + > + > trace('e'.charCodeAt(0), 'v8.some-category', + > 'Foo', 0, { abc: 'xyz'}) + > ``` + > + > Bug: v8:7851 + > Change-Id: I7bfb9bb059efdf87d92a56a0aae326650730c250 + > Reviewed-on: https://chromium-review.googlesource.com/1103294 + > Commit-Queue: Yang Guo + > Reviewed-by: Yang Guo + > Reviewed-by: Fadi Meawad + > Reviewed-by: Camillo Bruni + > Reviewed-by: Benedikt Meurer + > Cr-Commit-Position: refs/heads/master@{#54121} + + TBR=cbruni@chromium.org + + Bug: v8:7851 + Change-Id: Id063754b2834b3b6a2b2654e76e8637bcd6aa5f8 + Reviewed-on: https://chromium-review.googlesource.com/1137071 Commit-Queue: Yang Guo - Reviewed-by: Hannes Payer Reviewed-by: Yang Guo - Reviewed-by: Andreas Haas - Cr-Commit-Position: refs/heads/master@{#53382} - -Refs: https://github.com/v8/v8/commit/aa6ce3ee617b2f324bea3a5d8e3263aee4cde6d7 - -Backport-PR-URL: https://github.com/nodejs/node/pull/21668 -PR-URL: https://github.com/nodejs/node/pull/21079 -Reviewed-By: James M Snell -Reviewed-By: Matteo Collina -Reviewed-By: Colin Ihrig -Reviewed-By: Yang Guo ---- - include/v8-profiler.h | 70 +++++ - src/api.cc | 64 ++++ - src/code-events.h | 62 ++-- - src/compiler.cc | 5 +- - src/compiler/wasm-compiler.cc | 3 +- - src/heap/mark-compact.cc | 2 +- - src/isolate.cc | 2 +- - src/isolate.h | 1 + - src/log.cc | 510 ++++++++++++++++++++++---------- - src/log.h | 86 +++++- - src/runtime/runtime-function.cc | 3 +- - src/snapshot/code-serializer.cc | 3 +- - src/snapshot/snapshot-common.cc | 6 +- - src/wasm/wasm-code-manager.cc | 2 +- - test/cctest/test-log.cc | 75 +++++ - 15 files changed, 694 insertions(+), 200 deletions(-) - -diff --git a/include/v8-profiler.h b/include/v8-profiler.h -index 34ad2b9cea..76490afe3c 100644 ---- a/include/v8-profiler.h -+++ b/include/v8-profiler.h -@@ -992,6 +992,76 @@ struct HeapStatsUpdate { - uint32_t size; // New value of size field for the interval with this index. - }; - -+#define CODE_EVENTS_LIST(V) \ -+ V(Builtin) \ -+ V(Callback) \ -+ V(Eval) \ -+ V(Function) \ -+ V(InterpretedFunction) \ -+ V(Handler) \ -+ V(BytecodeHandler) \ -+ V(LazyCompile) \ -+ V(RegExp) \ -+ V(Script) \ -+ V(Stub) -+ -+/** -+ * Note that this enum may be extended in the future. Please include a default -+ * case if this enum is used in a switch statement. -+ */ -+enum CodeEventType { -+ kUnknownType = 0 -+#define V(Name) , k##Name##Type -+ CODE_EVENTS_LIST(V) -+#undef V -+}; -+ -+/** -+ * Representation of a code creation event -+ */ -+class V8_EXPORT CodeEvent { -+ public: -+ uintptr_t GetCodeStartAddress(); -+ size_t GetCodeSize(); -+ Local GetFunctionName(); -+ Local GetScriptName(); -+ int GetScriptLine(); -+ int GetScriptColumn(); -+ /** -+ * NOTE (mmarchini): We can't allocate objects in the heap when we collect -+ * existing code, and both the code type and the comment are not stored in the -+ * heap, so we return those as const char*. -+ */ -+ CodeEventType GetCodeType(); -+ const char* GetComment(); -+ -+ static const char* GetCodeEventTypeName(CodeEventType code_event_type); -+}; -+ -+/** -+ * Interface to listen to code creation events. -+ */ -+class V8_EXPORT CodeEventHandler { -+ public: -+ /** -+ * Creates a new listener for the |isolate|. The isolate must be initialized. -+ * The listener object must be disposed after use by calling |Dispose| method. -+ * Multiple listeners can be created for the same isolate. -+ */ -+ explicit CodeEventHandler(Isolate* isolate); -+ virtual ~CodeEventHandler(); -+ -+ virtual void Handle(CodeEvent* code_event) = 0; -+ -+ void Enable(); -+ void Disable(); -+ -+ private: -+ CodeEventHandler(); -+ CodeEventHandler(const CodeEventHandler&); -+ CodeEventHandler& operator=(const CodeEventHandler&); -+ void* internal_listener_; -+}; - - } // namespace v8 - -diff --git a/src/api.cc b/src/api.cc -index 89bcb2e4fa..f51576ed2a 100644 ---- a/src/api.cc -+++ b/src/api.cc -@@ -10104,6 +10104,70 @@ void CpuProfiler::SetIdle(bool is_idle) { - isolate->SetIdle(is_idle); - } - -+uintptr_t CodeEvent::GetCodeStartAddress() { -+ return reinterpret_cast(this)->code_start_address; -+} -+ -+size_t CodeEvent::GetCodeSize() { -+ return reinterpret_cast(this)->code_size; -+} -+ -+Local CodeEvent::GetFunctionName() { -+ return ToApiHandle( -+ reinterpret_cast(this)->function_name); -+} -+ -+Local CodeEvent::GetScriptName() { -+ return ToApiHandle( -+ reinterpret_cast(this)->script_name); -+} -+ -+int CodeEvent::GetScriptLine() { -+ return reinterpret_cast(this)->script_line; -+} -+ -+int CodeEvent::GetScriptColumn() { -+ return reinterpret_cast(this)->script_column; -+} -+ -+CodeEventType CodeEvent::GetCodeType() { -+ return reinterpret_cast(this)->code_type; -+} -+ -+const char* CodeEvent::GetComment() { -+ return reinterpret_cast(this)->comment; -+} -+ -+const char* CodeEvent::GetCodeEventTypeName(CodeEventType code_event_type) { -+ switch (code_event_type) { -+ case kUnknownType: -+ return "Unknown"; -+#define V(Name) \ -+ case k##Name##Type: \ -+ return #Name; -+ CODE_EVENTS_LIST(V) -+#undef V -+ } -+} -+ -+CodeEventHandler::CodeEventHandler(Isolate* isolate) { -+ internal_listener_ = -+ new i::ExternalCodeEventListener(reinterpret_cast(isolate)); -+} -+ -+CodeEventHandler::~CodeEventHandler() { -+ delete reinterpret_cast(internal_listener_); -+} -+ -+void CodeEventHandler::Enable() { -+ reinterpret_cast(internal_listener_) -+ ->StartListening(this); -+} -+ -+void CodeEventHandler::Disable() { -+ reinterpret_cast(internal_listener_) -+ ->StopListening(); -+} - - static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) { - return const_cast( -diff --git a/src/code-events.h b/src/code-events.h -index 439cb54dca..caed5160f4 100644 ---- a/src/code-events.h -+++ b/src/code-events.h -@@ -24,32 +24,38 @@ class WasmCode; - using WasmName = Vector; - } // namespace wasm - --#define LOG_EVENTS_AND_TAGS_LIST(V) \ -- V(CODE_CREATION_EVENT, "code-creation") \ -- V(CODE_DISABLE_OPT_EVENT, "code-disable-optimization") \ -- V(CODE_MOVE_EVENT, "code-move") \ -- V(CODE_DELETE_EVENT, "code-delete") \ -- V(CODE_MOVING_GC, "code-moving-gc") \ -- V(SHARED_FUNC_MOVE_EVENT, "sfi-move") \ -- V(SNAPSHOT_CODE_NAME_EVENT, "snapshot-code-name") \ -- V(TICK_EVENT, "tick") \ -- V(BUILTIN_TAG, "Builtin") \ -- V(CALLBACK_TAG, "Callback") \ -- V(EVAL_TAG, "Eval") \ -- V(FUNCTION_TAG, "Function") \ -- V(INTERPRETED_FUNCTION_TAG, "InterpretedFunction") \ -- V(HANDLER_TAG, "Handler") \ -- V(BYTECODE_HANDLER_TAG, "BytecodeHandler") \ -- V(LAZY_COMPILE_TAG, "LazyCompile") \ -- V(REG_EXP_TAG, "RegExp") \ -- V(SCRIPT_TAG, "Script") \ -- V(STUB_TAG, "Stub") \ -- V(NATIVE_FUNCTION_TAG, "Function") \ -- V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile") \ -- V(NATIVE_SCRIPT_TAG, "Script") -+#define LOG_EVENTS_LIST(V) \ -+ V(CODE_CREATION_EVENT, code-creation) \ -+ V(CODE_DISABLE_OPT_EVENT, code-disable-optimization) \ -+ V(CODE_MOVE_EVENT, code-move) \ -+ V(CODE_DELETE_EVENT, code-delete) \ -+ V(CODE_MOVING_GC, code-moving-gc) \ -+ V(SHARED_FUNC_MOVE_EVENT, sfi-move) \ -+ V(SNAPSHOT_CODE_NAME_EVENT, snapshot-code-name) \ -+ V(TICK_EVENT, tick) -+ -+#define TAGS_LIST(V) \ -+ V(BUILTIN_TAG, Builtin) \ -+ V(CALLBACK_TAG, Callback) \ -+ V(EVAL_TAG, Eval) \ -+ V(FUNCTION_TAG, Function) \ -+ V(INTERPRETED_FUNCTION_TAG, InterpretedFunction) \ -+ V(HANDLER_TAG, Handler) \ -+ V(BYTECODE_HANDLER_TAG, BytecodeHandler) \ -+ V(LAZY_COMPILE_TAG, LazyCompile) \ -+ V(REG_EXP_TAG, RegExp) \ -+ V(SCRIPT_TAG, Script) \ -+ V(STUB_TAG, Stub) \ -+ V(NATIVE_FUNCTION_TAG, Function) \ -+ V(NATIVE_LAZY_COMPILE_TAG, LazyCompile) \ -+ V(NATIVE_SCRIPT_TAG, Script) - // Note that 'NATIVE_' cases for functions and scripts are mapped onto - // original tags when writing to the log. - -+#define LOG_EVENTS_AND_TAGS_LIST(V) \ -+ LOG_EVENTS_LIST(V) \ -+ TAGS_LIST(V) -+ - #define PROFILE(the_isolate, Call) (the_isolate)->code_event_dispatcher()->Call; - - class CodeEventListener { -@@ -85,6 +91,8 @@ class CodeEventListener { - enum DeoptKind { kSoft, kLazy, kEager }; - virtual void CodeDeoptEvent(Code* code, DeoptKind kind, Address pc, - int fp_to_sp_delta) = 0; -+ -+ virtual bool is_listening_to_code_events() { return false; } - }; - - class CodeEventDispatcher { -@@ -101,6 +109,14 @@ class CodeEventDispatcher { - base::LockGuard guard(&mutex_); - listeners_.erase(listener); - } -+ bool IsListeningToCodeEvents() { -+ for (auto it : listeners_) { -+ if (it->is_listening_to_code_events()) { -+ return true; -+ } -+ } -+ return false; -+ } - - #define CODE_EVENT_DISPATCH(code) \ - base::LockGuard guard(&mutex_); \ -diff --git a/src/compiler.cc b/src/compiler.cc -index ae6bc9c4fa..a01750b23a 100644 ---- a/src/compiler.cc -+++ b/src/compiler.cc -@@ -84,8 +84,9 @@ void LogFunctionCompilation(CodeEventListener::LogEventsAndTags tag, - // Log the code generation. If source information is available include - // script name and line number. Check explicitly whether logging is - // enabled as finding the line number is not free. -- if (!isolate->logger()->is_logging_code_events() && -- !isolate->is_profiling() && !FLAG_log_function_events) { -+ if (!isolate->logger()->is_listening_to_code_events() && -+ !isolate->is_profiling() && !FLAG_log_function_events && -+ !isolate->code_event_dispatcher()->IsListeningToCodeEvents()) { - return; - } - -diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc -index daceffd331..61c3a350f7 100644 ---- a/src/compiler/wasm-compiler.cc -+++ b/src/compiler/wasm-compiler.cc -@@ -3952,7 +3952,8 @@ Node* WasmGraphBuilder::AtomicOp(wasm::WasmOpcode opcode, Node* const* inputs, - - namespace { - bool must_record_function_compilation(Isolate* isolate) { -- return isolate->logger()->is_logging_code_events() || isolate->is_profiling(); -+ return isolate->logger()->is_listening_to_code_events() || -+ isolate->is_profiling(); - } - - PRINTF_FORMAT(4, 5) -diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc -index 50be29c29a..66575f8250 100644 ---- a/src/heap/mark-compact.cc -+++ b/src/heap/mark-compact.cc -@@ -2414,7 +2414,7 @@ void MarkCompactCollectorBase::CreateAndExecuteEvacuationTasks( - - const bool profiling = - heap()->isolate()->is_profiling() || -- heap()->isolate()->logger()->is_logging_code_events() || -+ heap()->isolate()->logger()->is_listening_to_code_events() || - heap()->isolate()->heap_profiler()->is_tracking_object_moves() || - heap()->has_heap_object_allocation_tracker(); - ProfilingMigrationObserver profiling_observer(heap()); -diff --git a/src/isolate.cc b/src/isolate.cc -index abd74ee40d..dd66479f73 100644 ---- a/src/isolate.cc -+++ b/src/isolate.cc -@@ -2892,7 +2892,7 @@ void CreateOffHeapTrampolines(Isolate* isolate) { - // thus collected by the GC. - builtins->set_builtin(i, *trampoline); - -- if (isolate->logger()->is_logging_code_events() || -+ if (isolate->logger()->is_listening_to_code_events() || - isolate->is_profiling()) { - isolate->logger()->LogCodeObject(*trampoline); - } -diff --git a/src/isolate.h b/src/isolate.h -index 929403e134..69ec1f1853 100644 ---- a/src/isolate.h -+++ b/src/isolate.h -@@ -57,6 +57,7 @@ class BuiltinsConstantsTableBuilder; - class CallInterfaceDescriptorData; - class CancelableTaskManager; - class CodeEventDispatcher; -+class ExternalCodeEventListener; - class CodeGenerator; - class CodeRange; - class CodeStubDescriptor; -diff --git a/src/log.cc b/src/log.cc -index f5e1fe6baf..20e5f2c964 100644 ---- a/src/log.cc -+++ b/src/log.cc -@@ -40,11 +40,33 @@ - namespace v8 { - namespace internal { - --#define DECLARE_EVENT(ignore1, name) name, -+#define DECLARE_EVENT(ignore1, name) #name, - static const char* kLogEventsNames[CodeEventListener::NUMBER_OF_LOG_EVENTS] = { - LOG_EVENTS_AND_TAGS_LIST(DECLARE_EVENT)}; - #undef DECLARE_EVENT - -+static v8::CodeEventType GetCodeEventTypeForTag( -+ CodeEventListener::LogEventsAndTags tag) { -+ switch (tag) { -+ case CodeEventListener::NUMBER_OF_LOG_EVENTS: -+#define V(Event, _) case CodeEventListener::Event: -+ LOG_EVENTS_LIST(V) -+#undef V -+ return v8::CodeEventType::kUnknownType; -+#define V(From, To) \ -+ case CodeEventListener::From: \ -+ return v8::CodeEventType::k##To##Type; -+ TAGS_LIST(V) -+#undef V -+ } -+} -+#define CALL_CODE_EVENT_HANDLER(Call) \ -+ if (listener_) { \ -+ listener_->Call; \ -+ } else { \ -+ PROFILE(isolate_, Call); \ -+ } -+ - static const char* ComputeMarker(SharedFunctionInfo* shared, - AbstractCode* code) { - switch (code->kind()) { -@@ -320,9 +342,147 @@ void PerfBasicLogger::LogRecordedBuffer(const wasm::WasmCode* code, - code->instructions().length(), name, length); - } - --// Low-level logging support. --#define LL_LOG(Call) if (ll_logger_) ll_logger_->Call; -+// External CodeEventListener -+ExternalCodeEventListener::ExternalCodeEventListener(Isolate* isolate) -+ : is_listening_(false), isolate_(isolate), code_event_handler_(nullptr) {} -+ -+ExternalCodeEventListener::~ExternalCodeEventListener() { -+ if (is_listening_) { -+ StopListening(); -+ } -+} -+ -+void ExternalCodeEventListener::LogExistingCode() { -+ HandleScope scope(isolate_); -+ ExistingCodeLogger logger(isolate_, this); -+ logger.LogCodeObjects(); -+ logger.LogBytecodeHandlers(); -+ logger.LogCompiledFunctions(); -+} -+ -+void ExternalCodeEventListener::StartListening( -+ CodeEventHandler* code_event_handler) { -+ if (is_listening_ || code_event_handler == nullptr) { -+ return; -+ } -+ code_event_handler_ = code_event_handler; -+ is_listening_ = isolate_->code_event_dispatcher()->AddListener(this); -+ if (is_listening_) { -+ LogExistingCode(); -+ } -+} - -+void ExternalCodeEventListener::StopListening() { -+ if (!is_listening_) { -+ return; -+ } -+ -+ isolate_->code_event_dispatcher()->RemoveListener(this); -+ is_listening_ = false; -+} -+ -+void ExternalCodeEventListener::CodeCreateEvent( -+ CodeEventListener::LogEventsAndTags tag, AbstractCode* code, -+ const char* comment) { -+ CodeEvent code_event; -+ code_event.code_start_address = -+ static_cast(code->InstructionStart()); -+ code_event.code_size = static_cast(code->InstructionSize()); -+ code_event.function_name = isolate_->factory()->empty_string(); -+ code_event.script_name = isolate_->factory()->empty_string(); -+ code_event.script_line = 0; -+ code_event.script_column = 0; -+ code_event.code_type = GetCodeEventTypeForTag(tag); -+ code_event.comment = comment; -+ -+ code_event_handler_->Handle(reinterpret_cast(&code_event)); -+} -+ -+void ExternalCodeEventListener::CodeCreateEvent( -+ CodeEventListener::LogEventsAndTags tag, AbstractCode* code, Name* name) { -+ Handle name_string = -+ Name::ToFunctionName(Handle(name, isolate_)).ToHandleChecked(); -+ -+ CodeEvent code_event; -+ code_event.code_start_address = -+ static_cast(code->InstructionStart()); -+ code_event.code_size = static_cast(code->InstructionSize()); -+ code_event.function_name = name_string; -+ code_event.script_name = isolate_->factory()->empty_string(); -+ code_event.script_line = 0; -+ code_event.script_column = 0; -+ code_event.code_type = GetCodeEventTypeForTag(tag); -+ code_event.comment = ""; -+ -+ code_event_handler_->Handle(reinterpret_cast(&code_event)); -+} -+ -+void ExternalCodeEventListener::CodeCreateEvent( -+ CodeEventListener::LogEventsAndTags tag, AbstractCode* code, -+ SharedFunctionInfo* shared, Name* name) { -+ Handle name_string = -+ Name::ToFunctionName(Handle(name, isolate_)).ToHandleChecked(); -+ -+ CodeEvent code_event; -+ code_event.code_start_address = -+ static_cast(code->InstructionStart()); -+ code_event.code_size = static_cast(code->InstructionSize()); -+ code_event.function_name = name_string; -+ code_event.script_name = isolate_->factory()->empty_string(); -+ code_event.script_line = 0; -+ code_event.script_column = 0; -+ code_event.code_type = GetCodeEventTypeForTag(tag); -+ code_event.comment = ""; -+ -+ code_event_handler_->Handle(reinterpret_cast(&code_event)); -+} -+ -+void ExternalCodeEventListener::CodeCreateEvent( -+ CodeEventListener::LogEventsAndTags tag, AbstractCode* code, -+ SharedFunctionInfo* shared, Name* source, int line, int column) { -+ Handle name_string = -+ Name::ToFunctionName(Handle(shared->Name(), isolate_)) -+ .ToHandleChecked(); -+ Handle source_string = -+ Name::ToFunctionName(Handle(source, isolate_)).ToHandleChecked(); -+ -+ CodeEvent code_event; -+ code_event.code_start_address = -+ static_cast(code->InstructionStart()); -+ code_event.code_size = static_cast(code->InstructionSize()); -+ code_event.function_name = name_string; -+ code_event.script_name = source_string; -+ code_event.script_line = line; -+ code_event.script_column = column; -+ code_event.code_type = GetCodeEventTypeForTag(tag); -+ code_event.comment = ""; -+ -+ code_event_handler_->Handle(reinterpret_cast(&code_event)); -+} -+ -+void ExternalCodeEventListener::CodeCreateEvent(LogEventsAndTags tag, -+ const wasm::WasmCode* code, -+ wasm::WasmName name) { -+ // TODO(mmarchini): handle later -+} -+ -+void ExternalCodeEventListener::RegExpCodeCreateEvent(AbstractCode* code, -+ String* source) { -+ CodeEvent code_event; -+ code_event.code_start_address = -+ static_cast(code->InstructionStart()); -+ code_event.code_size = static_cast(code->InstructionSize()); -+ code_event.function_name = Handle(source, isolate_); -+ code_event.script_name = isolate_->factory()->empty_string(); -+ code_event.script_line = 0; -+ code_event.script_column = 0; -+ code_event.code_type = GetCodeEventTypeForTag(CodeEventListener::REG_EXP_TAG); -+ code_event.comment = ""; -+ -+ code_event_handler_->Handle(reinterpret_cast(&code_event)); -+} -+ -+// Low-level logging support. - class LowLevelLogger : public CodeEventLogger { - public: - explicit LowLevelLogger(const char* file_name); -@@ -809,7 +969,8 @@ Logger::Logger(Isolate* isolate) - perf_jit_logger_(nullptr), - ll_logger_(nullptr), - jit_logger_(nullptr), -- is_initialized_(false) {} -+ is_initialized_(false), -+ existing_code_logger_(isolate) {} - - Logger::~Logger() { - delete log_; -@@ -1078,7 +1239,7 @@ void AppendCodeCreateHeader(Log::MessageBuilder& msg, - - void Logger::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, - AbstractCode* code, const char* comment) { -- if (!is_logging_code_events()) return; -+ if (!is_listening_to_code_events()) return; - if (!FLAG_log_code || !log_->IsEnabled()) return; - Log::MessageBuilder msg(log_); - AppendCodeCreateHeader(msg, tag, code, &timer_); -@@ -1088,7 +1249,7 @@ void Logger::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, - - void Logger::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, - AbstractCode* code, Name* name) { -- if (!is_logging_code_events()) return; -+ if (!is_listening_to_code_events()) return; - if (!FLAG_log_code || !log_->IsEnabled()) return; - Log::MessageBuilder msg(log_); - AppendCodeCreateHeader(msg, tag, code, &timer_); -@@ -1099,7 +1260,7 @@ void Logger::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, - void Logger::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, - AbstractCode* code, SharedFunctionInfo* shared, - Name* name) { -- if (!is_logging_code_events()) return; -+ if (!is_listening_to_code_events()) return; - if (!FLAG_log_code || !log_->IsEnabled()) return; - if (code == AbstractCode::cast( - isolate_->builtins()->builtin(Builtins::kCompileLazy))) { -@@ -1115,7 +1276,7 @@ void Logger::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, - - void Logger::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, - const wasm::WasmCode* code, wasm::WasmName name) { -- if (!is_logging_code_events()) return; -+ if (!is_listening_to_code_events()) return; - if (!FLAG_log_code || !log_->IsEnabled()) return; - Log::MessageBuilder msg(log_); - AppendCodeCreateHeader(msg, tag, AbstractCode::Kind::WASM_FUNCTION, -@@ -1143,7 +1304,7 @@ void Logger::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, - void Logger::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, - AbstractCode* code, SharedFunctionInfo* shared, - Name* source, int line, int column) { -- if (!is_logging_code_events()) return; -+ if (!is_listening_to_code_events()) return; - if (!FLAG_log_code || !log_->IsEnabled()) return; - - Log::MessageBuilder msg(log_); -@@ -1260,7 +1421,7 @@ void Logger::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag, - - void Logger::CodeDisableOptEvent(AbstractCode* code, - SharedFunctionInfo* shared) { -- if (!is_logging_code_events()) return; -+ if (!is_listening_to_code_events()) return; - if (!FLAG_log_code || !log_->IsEnabled()) return; - Log::MessageBuilder msg(log_); - msg << kLogEventsNames[CodeEventListener::CODE_DISABLE_OPT_EVENT] << kNext -@@ -1271,13 +1432,13 @@ void Logger::CodeDisableOptEvent(AbstractCode* code, - - - void Logger::CodeMovingGCEvent() { -- if (!is_logging_code_events()) return; -+ if (!is_listening_to_code_events()) return; - if (!log_->IsEnabled() || !FLAG_ll_prof) return; - base::OS::SignalCodeMovingGC(); - } - - void Logger::RegExpCodeCreateEvent(AbstractCode* code, String* source) { -- if (!is_logging_code_events()) return; -+ if (!is_listening_to_code_events()) return; - if (!FLAG_log_code || !log_->IsEnabled()) return; - Log::MessageBuilder msg(log_); - AppendCodeCreateHeader(msg, CodeEventListener::REG_EXP_TAG, code, &timer_); -@@ -1286,7 +1447,7 @@ void Logger::RegExpCodeCreateEvent(AbstractCode* code, String* source) { - } - - void Logger::CodeMoveEvent(AbstractCode* from, Address to) { -- if (!is_logging_code_events()) return; -+ if (!is_listening_to_code_events()) return; - MoveEventInternal(CodeEventListener::CODE_MOVE_EVENT, from->address(), to); - } - -@@ -1335,7 +1496,7 @@ void Logger::CodeNameEvent(Address addr, int pos, const char* code_name) { - - - void Logger::SharedFunctionInfoMoveEvent(Address from, Address to) { -- if (!is_logging_code_events()) return; -+ if (!is_listening_to_code_events()) return; - MoveEventInternal(CodeEventListener::SHARED_FUNC_MOVE_EVENT, from, to); - } - -@@ -1625,170 +1786,28 @@ static int EnumerateWasmModules(Heap* heap, - } - - void Logger::LogCodeObject(Object* object) { -- AbstractCode* code_object = AbstractCode::cast(object); -- CodeEventListener::LogEventsAndTags tag = CodeEventListener::STUB_TAG; -- const char* description = "Unknown code from the snapshot"; -- switch (code_object->kind()) { -- case AbstractCode::INTERPRETED_FUNCTION: -- case AbstractCode::OPTIMIZED_FUNCTION: -- return; // We log this later using LogCompiledFunctions. -- case AbstractCode::BYTECODE_HANDLER: -- return; // We log it later by walking the dispatch table. -- case AbstractCode::STUB: -- description = -- CodeStub::MajorName(CodeStub::GetMajorKey(code_object->GetCode())); -- if (description == nullptr) description = "A stub from the snapshot"; -- tag = CodeEventListener::STUB_TAG; -- break; -- case AbstractCode::REGEXP: -- description = "Regular expression code"; -- tag = CodeEventListener::REG_EXP_TAG; -- break; -- case AbstractCode::BUILTIN: -- description = -- isolate_->builtins()->name(code_object->GetCode()->builtin_index()); -- tag = CodeEventListener::BUILTIN_TAG; -- break; -- case AbstractCode::WASM_FUNCTION: -- description = "A Wasm function"; -- tag = CodeEventListener::FUNCTION_TAG; -- break; -- case AbstractCode::JS_TO_WASM_FUNCTION: -- description = "A JavaScript to Wasm adapter"; -- tag = CodeEventListener::STUB_TAG; -- break; -- case AbstractCode::WASM_TO_JS_FUNCTION: -- description = "A Wasm to JavaScript adapter"; -- tag = CodeEventListener::STUB_TAG; -- break; -- case AbstractCode::WASM_INTERPRETER_ENTRY: -- description = "A Wasm to Interpreter adapter"; -- tag = CodeEventListener::STUB_TAG; -- break; -- case AbstractCode::C_WASM_ENTRY: -- description = "A C to Wasm entry stub"; -- tag = CodeEventListener::STUB_TAG; -- break; -- case AbstractCode::NUMBER_OF_KINDS: -- UNIMPLEMENTED(); -- } -- PROFILE(isolate_, CodeCreateEvent(tag, code_object, description)); -+ existing_code_logger_.LogCodeObject(object); - } - --void Logger::LogCodeObjects() { -- Heap* heap = isolate_->heap(); -- HeapIterator iterator(heap); -- DisallowHeapAllocation no_gc; -- for (HeapObject* obj = iterator.next(); obj != nullptr; -- obj = iterator.next()) { -- if (obj->IsCode()) LogCodeObject(obj); -- if (obj->IsBytecodeArray()) LogCodeObject(obj); -- } --} -+void Logger::LogCodeObjects() { existing_code_logger_.LogCodeObjects(); } - - void Logger::LogBytecodeHandler(interpreter::Bytecode bytecode, - interpreter::OperandScale operand_scale, - Code* code) { -- std::string bytecode_name = -- interpreter::Bytecodes::ToString(bytecode, operand_scale); -- PROFILE(isolate_, -- CodeCreateEvent(CodeEventListener::BYTECODE_HANDLER_TAG, -- AbstractCode::cast(code), bytecode_name.c_str())); -+ existing_code_logger_.LogBytecodeHandler(bytecode, operand_scale, code); - } - - void Logger::LogBytecodeHandlers() { -- const interpreter::OperandScale kOperandScales[] = { --#define VALUE(Name, _) interpreter::OperandScale::k##Name, -- OPERAND_SCALE_LIST(VALUE) --#undef VALUE -- }; -- -- const int last_index = static_cast(interpreter::Bytecode::kLast); -- interpreter::Interpreter* interpreter = isolate_->interpreter(); -- for (auto operand_scale : kOperandScales) { -- for (int index = 0; index <= last_index; ++index) { -- interpreter::Bytecode bytecode = interpreter::Bytecodes::FromByte(index); -- if (interpreter::Bytecodes::BytecodeHasHandler(bytecode, operand_scale)) { -- Code* code = interpreter->GetBytecodeHandler(bytecode, operand_scale); -- if (isolate_->heap()->IsDeserializeLazyHandler(code)) continue; -- LogBytecodeHandler(bytecode, operand_scale, code); -- } -- } -- } -+ existing_code_logger_.LogBytecodeHandlers(); - } - - void Logger::LogExistingFunction(Handle shared, - Handle code) { -- if (shared->script()->IsScript()) { -- Handle