mirror of
https://github.com/electron/electron.git
synced 2026-10-28 11:44:46 +08:00
chore: enable ThrottleResizeIpc instead of patching NotifyScreenInfoChanged (#53668)
* chore: enable ThrottleResizeIpc instead of patching NotifyScreenInfoChanged Chromium added kThrottleResizeIpc (crrev.com/c/7807475) so that a plain window resize on macOS calls NotifyScreenInfoChanged with ignore_ack=false and respects the pending-ack throttle, which is what fix_restore_original_resize_performance_on_macos.patch was for. The patch had since been rebased on top of that change and dropped the ignore_ack parameter entirely, so display and scale-factor changes were throttled too. Enable the feature from feature_list_mac.mm and delete the patch. * build: assert kThrottleResizeIpc still exists upstream The feature is defined in render_widget_host_view_mac.mm with internal linkage, so Electron can only enable it by name. Check for its definition at gn gen time on macOS so a Chromium roll that removes or renames it fails instead of silently building without the throttle.
This commit is contained in:
1 parent
8cc20cf659
commit
b1be0e0d8c
5 files changed
+24
-48
No files matched your search
@@ -53,6 +53,16 @@ if (is_mac) {
|
||||
assert(
|
||||
mac_deployment_target == "13.0",
|
||||
"Chromium has updated the mac_deployment_target, please update this assert and flag this as a breaking change (docs/breaking-changes.md)")
|
||||
|
||||
# shell/browser/feature_list_mac.mm enables this unexported content feature
|
||||
# by name; fail here rather than silently if a Chromium roll removes it.
|
||||
assert(
|
||||
filter_include(
|
||||
read_file(
|
||||
"//content/browser/renderer_host/render_widget_host_view_mac.mm",
|
||||
"list lines"),
|
||||
[ "BASE_FEATURE(kThrottleResizeIpc,*" ]) != [],
|
||||
"kThrottleResizeIpc is gone from render_widget_host_view_mac.mm; update shell/browser/feature_list_mac.mm")
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
|
||||
@@ -93,7 +93,6 @@ fix_move_autopipsettingshelper_behind_branding_buildflag.patch
|
||||
revert_remove_the_allowaggressivethrottlingwithwebsocket_feature.patch
|
||||
feat_allow_passing_of_objecttemplate_to_objecttemplatebuilder.patch
|
||||
chore_remove_check_is_test_on_script_injection_tracker.patch
|
||||
fix_restore_original_resize_performance_on_macos.patch
|
||||
feat_allow_code_cache_in_custom_schemes.patch
|
||||
build_run_reclient_cfg_generator_after_chrome.patch
|
||||
refactor_expose_file_system_access_blocklist.patch
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Attard <marshallofsound@electronjs.org>
|
||||
Date: Tue, 21 Nov 2023 15:03:21 -0800
|
||||
Subject: fix: restore original resize performance on macOS
|
||||
|
||||
Reverts https://chromium-review.googlesource.com/c/chromium/src/+/3118293 which
|
||||
fixed a android only regression but in the process regressed electron window
|
||||
resize perf wildly on macOS.
|
||||
|
||||
This patch should be upstreamed as a conditional revert of the logic in desktop
|
||||
vs mobile runtimes. i.e. restore the old logic only on desktop platforms
|
||||
|
||||
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
|
||||
index 94a3ee40f5594ce2aebe6aed5a1e4794008ecfa2..c1220bb3bc575ffa7c0e207cef7ee0cf3ed4d2b3 100644
|
||||
--- a/content/browser/renderer_host/render_widget_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
|
||||
@@ -2260,14 +2260,8 @@ RenderWidgetHostImpl::GetWidgetInputHandler() {
|
||||
void RenderWidgetHostImpl::NotifyScreenInfoChanged(bool ignore_ack) {
|
||||
// The resize message (which may not happen immediately) will carry with it
|
||||
// the screen info as well as the new size (if the screen has changed scale
|
||||
- // factor). Force sending the new visual properties even if there is one in
|
||||
- // flight to ensure proper IPC ordering for features like the Fullscreen API
|
||||
- // if ignore_ack is true. Otherwise, respect the pending ACK throttle.
|
||||
- if (ignore_ack) {
|
||||
- SynchronizeVisualPropertiesIgnoringPendingAck();
|
||||
- } else {
|
||||
- SynchronizeVisualProperties();
|
||||
- }
|
||||
+ // factor).
|
||||
+ SynchronizeVisualProperties();
|
||||
|
||||
// The device scale factor will be same for all the views contained by the
|
||||
// primary main frame, so just set it once.
|
||||
@@ -39,7 +39,7 @@ index 44b99ecb47eda44247b345951602f60067de08d2..305e46bbd12767e7d2b091165f1dee3e
|
||||
// event before sending it to the renderer. See enum for details on return
|
||||
// value.
|
||||
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
|
||||
index c1220bb3bc575ffa7c0e207cef7ee0cf3ed4d2b3..a2e58eb7de4561c9d2623ca1c13e7479d883c538 100644
|
||||
index 94a3ee40f5594ce2aebe6aed5a1e4794008ecfa2..283aef5ca56f86b9d4772ed868f36078d13deb63 100644
|
||||
--- a/content/browser/renderer_host/render_widget_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
|
||||
@@ -1633,6 +1633,10 @@ void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo(
|
||||
|
||||
@@ -11,24 +11,24 @@
|
||||
namespace electron {
|
||||
|
||||
std::string EnablePlatformSpecificFeatures() {
|
||||
// None of these flags are exported, so they are referenced by name.
|
||||
|
||||
// Throttle visual-property IPCs during live resize (kThrottleResizeIpc in
|
||||
// content/browser/renderer_host/render_widget_host_view_mac.mm).
|
||||
std::string features = "ThrottleResizeIpc";
|
||||
if (@available(macOS 14.4, *)) {
|
||||
// These flags aren't exported so reference them by name directly, they are
|
||||
// used to ensure that screen and window capture exclusive use
|
||||
// ScreenCaptureKit APIs to avoid warning dialogs on macOS 14.4 and higher.
|
||||
// kScreenCaptureKitPickerScreen,
|
||||
// chrome/browser/media/webrtc/thumbnail_capturer_mac.mm
|
||||
// kScreenCaptureKitStreamPickerSonoma,
|
||||
// chrome/browser/media/webrtc/thumbnail_capturer_mac.mm
|
||||
// Make screen and window capture use ScreenCaptureKit APIs exclusively to
|
||||
// avoid warning dialogs on macOS 14.4 and higher.
|
||||
// kScreenCaptureKitPickerScreen, kScreenCaptureKitStreamPickerSonoma,
|
||||
// kThumbnailCapturerMac,
|
||||
// chrome/browser/media/webrtc/thumbnail_capturer_mac.mm
|
||||
#if DCHECK_IS_ON()
|
||||
return "ScreenCaptureKitPickerScreen,ScreenCaptureKitStreamPickerSonoma";
|
||||
#else
|
||||
return "ScreenCaptureKitPickerScreen,ScreenCaptureKitStreamPickerSonoma,"
|
||||
"ThumbnailCapturerMac:capture_mode/sc_screenshot_manager";
|
||||
features +=
|
||||
",ScreenCaptureKitPickerScreen,ScreenCaptureKitStreamPickerSonoma";
|
||||
#if !DCHECK_IS_ON()
|
||||
features += ",ThumbnailCapturerMac:capture_mode/sc_screenshot_manager";
|
||||
#endif
|
||||
}
|
||||
return "";
|
||||
return features;
|
||||
}
|
||||
|
||||
std::string DisablePlatformSpecificFeatures() {
|
||||
|
||||
Reference in new issue
Block a user