From 534bf77d9b29dd6355f0ebec9c2cbef47a02d5dd Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 9 Jun 2023 02:30:36 +0900 Subject: [PATCH] chore: modify patches so we can build other chromium targets (#38637) chore: tune patches so we can build other chromium targets --- ..._scheduler_throttling_per_renderview.patch | 20 ++++++++--- ...ld_config_in_the_required_components.patch | 36 ++++++++++++++++++- ...screen_rendering_with_viz_compositor.patch | 28 +++++++++++++++ 3 files changed, 79 insertions(+), 5 deletions(-) diff --git a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch index c28d76a3f51a..f92da6c7e3e5 100644 --- a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch +++ b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch @@ -34,7 +34,7 @@ index 180abdc9f983887c83fd9d4a596472222e9ab472..00842717a7570561ee9e3eca11190ab5 void SendRendererPreferencesToRenderer( const blink::RendererPreferences& preferences); diff --git a/content/public/browser/render_view_host.h b/content/public/browser/render_view_host.h -index 9979c25ecd57e68331b628a518368635db5c2027..32733bf951af3eff7da5fd5758bbcbaa49ff0e3c 100644 +index 9979c25ecd57e68331b628a518368635db5c2027..f65bfbbb663a5bb0511ffa389d3163e0fdeb4d1f 100644 --- a/content/public/browser/render_view_host.h +++ b/content/public/browser/render_view_host.h @@ -76,6 +76,9 @@ class CONTENT_EXPORT RenderViewHost { @@ -42,11 +42,23 @@ index 9979c25ecd57e68331b628a518368635db5c2027..32733bf951af3eff7da5fd5758bbcbaa perfetto::TracedProto context) const = 0; + // Disable/Enable scheduler throttling. -+ virtual void SetSchedulerThrottling(bool allowed) = 0; ++ virtual void SetSchedulerThrottling(bool allowed) {} + private: // This interface should only be implemented inside content. friend class RenderViewHostImpl; +diff --git a/content/test/test_page_broadcast.h b/content/test/test_page_broadcast.h +index 3f4396e50b419cd6a16f34036f4a0a1113109c55..60e038413369ea1021bcad86f9398c9964140652 100644 +--- a/content/test/test_page_broadcast.h ++++ b/content/test/test_page_broadcast.h +@@ -43,6 +43,7 @@ class TestPageBroadcast : public blink::mojom::PageBroadcast { + blink::mojom::RemoteFrameInterfacesFromBrowserPtr remote_frame_interfaces, + blink::mojom::RemoteMainFrameInterfacesPtr remote_main_frame_interfaces) + override; ++ void SetSchedulerThrottling(bool allowed) override {} + + mojo::AssociatedReceiver receiver_; + }; diff --git a/third_party/blink/public/mojom/page/page.mojom b/third_party/blink/public/mojom/page/page.mojom index d18c66114870de83c7eef21578e9e2b8d5606a8b..e1defb3992289427df85963f44a705e3d9257342 100644 --- a/third_party/blink/public/mojom/page/page.mojom @@ -60,14 +72,14 @@ index d18c66114870de83c7eef21578e9e2b8d5606a8b..e1defb3992289427df85963f44a705e3 + SetSchedulerThrottling(bool allowed); }; diff --git a/third_party/blink/public/web/web_view.h b/third_party/blink/public/web/web_view.h -index 8a18ecf567cd3a6a2fb1627083a5544a93198bf4..8b6436f3ba6c8bfc2cba054e77ab888625ae668d 100644 +index 8a18ecf567cd3a6a2fb1627083a5544a93198bf4..6bb4074e033e045de164bc776f75f152ea7be16f 100644 --- a/third_party/blink/public/web/web_view.h +++ b/third_party/blink/public/web/web_view.h @@ -371,6 +371,7 @@ class BLINK_EXPORT WebView { // Scheduling ----------------------------------------------------------- virtual PageScheduler* Scheduler() const = 0; -+ virtual void SetSchedulerThrottling(bool allowed) = 0; ++ virtual void SetSchedulerThrottling(bool allowed) {} // Visibility ----------------------------------------------------------- diff --git a/patches/chromium/build_only_use_the_mas_build_config_in_the_required_components.patch b/patches/chromium/build_only_use_the_mas_build_config_in_the_required_components.patch index 7656145ef79e..c0931b5ec72f 100644 --- a/patches/chromium/build_only_use_the_mas_build_config_in_the_required_components.patch +++ b/patches/chromium/build_only_use_the_mas_build_config_in_the_required_components.patch @@ -111,6 +111,31 @@ index 34636a58846e2b250e423dde76e4e6ea1f686676..899b75f2be91e86c526f550718e22221 defines = [] public_deps = [ +diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn +index c304b8d9052fe705e22a047546fb6a7eb4977575..b30bf15dba88b47074d951793530b4afc473a442 100644 +--- a/content/test/BUILD.gn ++++ b/content/test/BUILD.gn +@@ -470,6 +470,7 @@ static_library("test_support") { + configs += [ + "//build/config:precompiled_headers", + "//v8:external_startup_data", ++ "//electron/build/config:mas_build", + ] + + public_deps = [ +diff --git a/content/web_test/BUILD.gn b/content/web_test/BUILD.gn +index 9d47887dd255187ffe49f5d9dbd01aff5b1de15e..7cde88462e0fc57f9f19badbf1042153708ed423 100644 +--- a/content/web_test/BUILD.gn ++++ b/content/web_test/BUILD.gn +@@ -143,6 +143,8 @@ static_library("web_test_browser") { + "browser/web_test_tts_platform.h", + ] + ++ configs += ["//electron/build/config:mas_build"] ++ + if (is_apple) { + configs += [ "//build/config/compiler:enable_arc" ] + } diff --git a/device/bluetooth/BUILD.gn b/device/bluetooth/BUILD.gn index 642afd72cc0f98fe2590cef0c470f378eabb939e..894769a5de698767117339cab0fc2942d1a20b90 100644 --- a/device/bluetooth/BUILD.gn @@ -265,7 +290,7 @@ index c7a777df6803678108952185a40b590bbf419859..76303e25a06ed2123bf9ac6b93b8a1e0 if (is_win) { sources += [ diff --git a/ui/views/BUILD.gn b/ui/views/BUILD.gn -index 01bbf457bc079c266e6110f7ad7c1ba701343312..0718cc10706de5e4b12a891eff696c80352fb9cd 100644 +index 01bbf457bc079c266e6110f7ad7c1ba701343312..fefd00a2f13018adf054284e10c1d4169c32c220 100644 --- a/ui/views/BUILD.gn +++ b/ui/views/BUILD.gn @@ -675,6 +675,7 @@ component("views") { @@ -276,6 +301,15 @@ index 01bbf457bc079c266e6110f7ad7c1ba701343312..0718cc10706de5e4b12a891eff696c80 } if (is_win) { +@@ -1089,6 +1090,8 @@ source_set("test_support") { + "//testing/gtest", + ] + ++ configs += ["//electron/build/config:mas_build"] ++ + if (is_win) { + sources += [ + "test/desktop_window_tree_host_win_test_api.cc", diff --git a/ui/views/controls/webview/BUILD.gn b/ui/views/controls/webview/BUILD.gn index f37a5a881ac6ac432a4672c5738b7f49b75b5523..1764117f539c2423ebe8bb4c3fe70afcdd0883e8 100644 --- a/ui/views/controls/webview/BUILD.gn diff --git a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch index 2be8e30de4c4..900a7e2fed2a 100644 --- a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch +++ b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch @@ -526,6 +526,34 @@ index 36673e93a8380d4e6d086fe3029a53fa483ccddb..ad91be73ec89f45c2ce083eaa3a8aba6 // Creating output surface failed. The host can send a new request, possibly // with a different compositing mode. +diff --git a/components/viz/test/test_output_surface_provider.cc b/components/viz/test/test_output_surface_provider.cc +index 59dd80087ada03e57c4b993dc887f75726789188..f42321d0cc1370d2828550c9899112dad5c0a505 100644 +--- a/components/viz/test/test_output_surface_provider.cc ++++ b/components/viz/test/test_output_surface_provider.cc +@@ -30,7 +30,8 @@ std::unique_ptr TestOutputSurfaceProvider::CreateOutputSurface( + mojom::DisplayClient* display_client, + DisplayCompositorMemoryAndTaskController* display_controller, + const RendererSettings& renderer_settings, +- const DebugRendererSettings* debug_settings) { ++ const DebugRendererSettings* debug_settings, ++ bool offscreen) { + if (gpu_compositing) { + return FakeSkiaOutputSurface::Create3d(); + } else { +diff --git a/components/viz/test/test_output_surface_provider.h b/components/viz/test/test_output_surface_provider.h +index cc1ceb263a60b9bd743bd4166def23cd1c01b49f..d2c24bf0b674c5028e48c6b51f23d4a8fdf4d95b 100644 +--- a/components/viz/test/test_output_surface_provider.h ++++ b/components/viz/test/test_output_surface_provider.h +@@ -32,7 +32,8 @@ class TestOutputSurfaceProvider : public OutputSurfaceProvider { + mojom::DisplayClient* display_client, + DisplayCompositorMemoryAndTaskController* display_controller, + const RendererSettings& renderer_settings, +- const DebugRendererSettings* debug_settings) override; ++ const DebugRendererSettings* debug_settings, ++ bool offscreen) override; + }; + + } // namespace viz diff --git a/content/browser/compositor/viz_process_transport_factory.cc b/content/browser/compositor/viz_process_transport_factory.cc index ea2888e6e6ce03dd1918a6183960d5809a15b59c..68c628ecbe2f596c93b6ac0d6b1c68cbb6b0a508 100644 --- a/content/browser/compositor/viz_process_transport_factory.cc