mirror of
https://github.com/electron/electron.git
synced 2026-01-08 23:18:06 -05:00
* chore: bump chromium in DEPS to 136.0.7076.0 * chore: bump chromium in DEPS to 136.0.7077.0 * 6368856: Migrate absl variant.h and utility.h in content (part 2/2) | https://chromium-review.googlesource.com/c/chromium/src/+/6368856 * 6356528: Clean up LegacyRenderWidgetHostHWND code | https://chromium-review.googlesource.com/c/chromium/src/+/6356528 * chore: export patches * 6339113: [Viewport Segments] Add CDP commands to override Viewport Segments without overriding other device properties. | https://chromium-review.googlesource.com/c/chromium/src/+/6339113 * 6352169: [DevTools][MultiInstance] Support new tab in another window on Android | https://chromium-review.googlesource.com/c/chromium/src/+/6352169 * 6368856: Migrate absl variant.h and utility.h in content (part 2/2) | https://chromium-review.googlesource.com/c/chromium/src/+/6368856 * 6360858:Clickiness: Wire response from URLLoader to DB, add e2e tests| https://chromium-review.googlesource.com/c/chromium/src/+/6360858 * chore: bump chromium in DEPS to 136.0.7079.0 * chore: export patches * chore: bump chromium in DEPS to 136.0.7081.0 * chore: export patches * chore: bump chromium in DEPS to 136.0.7083.0 * 6361987: Remove double-declaration with gfx::NativeView and gfx::NativeWindow | https://chromium-review.googlesource.com/c/chromium/src/+/6361987 * chore: export patches * chore: bump chromium in DEPS to 136.0.7087.0 * chore: export patches * fix: include node patch for missing AtomicsWaitEvent https://chromium-review.googlesource.com/c/chromium/src/+/6385540 * build: add depot_tools python to path * fix: cppgc init and unregistering v8 isolate https://chromium-review.googlesource.com/c/v8/v8/+/6333562 CppGc is now initialized earlier so Node can skip reinitializing it. Additionally, gin::IsolateHandle was attempting to destruct an already destructed v8::Isolate upon electron::JavaScriptEnvironment destruction. By removing the call to NodePlatform::UnregisterIsolate, this fixes the crash on app shutdown. * fix: unregister isolate after destruction See code comment. * chore: bump chromium in DEPS to 136.0.7095.0 * chore: sync patches * fix: add script_parsing::ContentScriptType parameter https://chromium-review.googlesource.com/c/chromium/src/+/6298395 * fix: migrate content::BrowserAccessibilityState methods https://chromium-review.googlesource.com/c/chromium/src/+/6401437 https://chromium-review.googlesource.com/c/chromium/src/+/6383275 * feat: enableHappyEyeballs option for host resolver https://chromium-review.googlesource.com/c/chromium/src/+/6332599 * fix: add new cookie exclusion reason https://chromium-review.googlesource.com/c/chromium/src/+/6343479 * fix: add new url loader method https://chromium-review.googlesource.com/c/chromium/src/+/6337340 * fix: add new cppgc header file for electron_node headers https://chromium-review.googlesource.com/c/v8/v8/+/6348644 * fix: disable CREL on Linux ARM64 https://chromium-review.googlesource.com/q/I3a62f02f564f07be63173b0773b4ecaffbe939b9 * fixup! fix: add new cppgc header file for electron_node headers https://chromium-review.googlesource.com/c/v8/v8/+/6348644 * chore: update corner smoothing patch * fixup! chore: update corner smoothing patch * chore: disable NAN weak tests These two tests are incompatible with a V8 change that disallows running JS code from a weak finalizer callback. Ref: https://chromium-review.googlesource.com/c/v8/v8/+/4733273 * test: fix task starvation in node test A V8 change makes these contexts get collected in a task that is posted and run asynchronously. The tests were synchronously GC'ing in an infinite loop, preventing the task loop from running the task that would GC these contexts. This change should be upstreamed in some way. Ref: https://chromium-review.googlesource.com/c/v8/v8/+/4733273 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: alice <alice@makenotion.com> Co-authored-by: Samuel Maddock <smaddock@slack-corp.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: clavin <clavin@electronjs.org>
268 lines
10 KiB
Diff
268 lines
10 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: David Sanders <dsanders11@ucsbalum.com>
|
|
Date: Wed, 8 Jan 2025 23:53:27 -0800
|
|
Subject: Revert "Code Health: Clean up stale MacWebContentsOcclusion"
|
|
|
|
Chrome has removed this WebContentsOcclusion feature flag upstream,
|
|
which is now causing our visibility tests to break. This patch
|
|
restores the legacy occlusion behavior to ensure the roll can continue
|
|
while we debug the issue.
|
|
|
|
This patch can be removed when the root cause because the visibility
|
|
specs failing on MacOS only is debugged and fixed. It should be removed
|
|
before Electron 35's stable date.
|
|
|
|
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/6078344
|
|
|
|
This partially (leaves the removal of the feature flag) reverts
|
|
ef865130abd5539e7bce12308659b19980368f12.
|
|
|
|
diff --git a/content/app_shim_remote_cocoa/web_contents_occlusion_checker_mac.h b/content/app_shim_remote_cocoa/web_contents_occlusion_checker_mac.h
|
|
index 428902f90950b2e9434c8a624a313268ebb80cd4..afcc3bc481be6a16119f7e2af647276cb0dafa1e 100644
|
|
--- a/content/app_shim_remote_cocoa/web_contents_occlusion_checker_mac.h
|
|
+++ b/content/app_shim_remote_cocoa/web_contents_occlusion_checker_mac.h
|
|
@@ -12,6 +12,8 @@
|
|
#import "content/app_shim_remote_cocoa/web_contents_view_cocoa.h"
|
|
#include "content/common/web_contents_ns_view_bridge.mojom.h"
|
|
|
|
+extern CONTENT_EXPORT const base::FeatureParam<bool>
|
|
+ kEnhancedWindowOcclusionDetection;
|
|
extern CONTENT_EXPORT const base::FeatureParam<bool>
|
|
kDisplaySleepAndAppHideDetection;
|
|
|
|
diff --git a/content/app_shim_remote_cocoa/web_contents_occlusion_checker_mac.mm b/content/app_shim_remote_cocoa/web_contents_occlusion_checker_mac.mm
|
|
index 32523e6a6f800de3917d18825f94c66ef4ea4388..634d68b9a2840d7c9e7c3b5e23d8b1b8ac02456b 100644
|
|
--- a/content/app_shim_remote_cocoa/web_contents_occlusion_checker_mac.mm
|
|
+++ b/content/app_shim_remote_cocoa/web_contents_occlusion_checker_mac.mm
|
|
@@ -19,6 +19,12 @@
|
|
#include "content/public/browser/content_browser_client.h"
|
|
#include "content/public/common/content_client.h"
|
|
|
|
+using features::kMacWebContentsOcclusion;
|
|
+
|
|
+// Experiment features.
|
|
+const base::FeatureParam<bool> kEnhancedWindowOcclusionDetection{
|
|
+ &kMacWebContentsOcclusion, "EnhancedWindowOcclusionDetection", false};
|
|
+
|
|
namespace {
|
|
|
|
NSString* const kWindowDidChangePositionInWindowList =
|
|
@@ -127,7 +133,8 @@ - (void)dealloc {
|
|
|
|
- (BOOL)isManualOcclusionDetectionEnabled {
|
|
return [WebContentsOcclusionCheckerMac
|
|
- manualOcclusionDetectionSupportedForCurrentMacOSVersion];
|
|
+ manualOcclusionDetectionSupportedForCurrentMacOSVersion] &&
|
|
+ kEnhancedWindowOcclusionDetection.Get();
|
|
}
|
|
|
|
// Alternative implementation of orderWindow:relativeTo:. Replaces
|
|
diff --git a/content/app_shim_remote_cocoa/web_contents_view_cocoa.mm b/content/app_shim_remote_cocoa/web_contents_view_cocoa.mm
|
|
index 2991489fae8a4eecad97b1ecb2271f096d9a9229..93b7aa620ad1da250ac06e3383ca689732de12cd 100644
|
|
--- a/content/app_shim_remote_cocoa/web_contents_view_cocoa.mm
|
|
+++ b/content/app_shim_remote_cocoa/web_contents_view_cocoa.mm
|
|
@@ -29,6 +29,7 @@
|
|
#include "ui/resources/grit/ui_resources.h"
|
|
|
|
using content::DropData;
|
|
+using features::kMacWebContentsOcclusion;
|
|
using remote_cocoa::mojom::DraggingInfo;
|
|
using remote_cocoa::mojom::SelectionDirection;
|
|
|
|
@@ -126,12 +127,15 @@ @implementation WebContentsViewCocoa {
|
|
|
|
gfx::Rect _windowControlsOverlayRect;
|
|
|
|
+ BOOL _inFullScreenTransition;
|
|
BOOL _willSetWebContentsOccludedAfterDelay;
|
|
}
|
|
|
|
+ (void)initialize {
|
|
- // Create the WebContentsOcclusionCheckerMac shared instance.
|
|
- [WebContentsOcclusionCheckerMac sharedInstance];
|
|
+ if (base::FeatureList::IsEnabled(kMacWebContentsOcclusion)) {
|
|
+ // Create the WebContentsOcclusionCheckerMac shared instance.
|
|
+ [WebContentsOcclusionCheckerMac sharedInstance];
|
|
+ }
|
|
}
|
|
|
|
- (instancetype)initWithViewsHostableView:(ui::ViewsHostableView*)v {
|
|
@@ -442,6 +446,7 @@ - (void)updateWebContentsVisibility:
|
|
(remote_cocoa::mojom::Visibility)visibility {
|
|
using remote_cocoa::mojom::Visibility;
|
|
|
|
+ DCHECK(base::FeatureList::IsEnabled(kMacWebContentsOcclusion));
|
|
if (!_host)
|
|
return;
|
|
|
|
@@ -487,6 +492,20 @@ - (void)updateWebContentsVisibility {
|
|
[self updateWebContentsVisibility:visibility];
|
|
}
|
|
|
|
+- (void)legacyUpdateWebContentsVisibility {
|
|
+ using remote_cocoa::mojom::Visibility;
|
|
+ if (!_host || _inFullScreenTransition)
|
|
+ return;
|
|
+ Visibility visibility = Visibility::kVisible;
|
|
+ if ([self isHiddenOrHasHiddenAncestor] || ![self window])
|
|
+ visibility = Visibility::kHidden;
|
|
+ else if ([[self window] occlusionState] & NSWindowOcclusionStateVisible)
|
|
+ visibility = Visibility::kVisible;
|
|
+ else
|
|
+ visibility = Visibility::kOccluded;
|
|
+ _host->OnWindowVisibilityChanged(visibility);
|
|
+}
|
|
+
|
|
- (void)resizeSubviewsWithOldSize:(NSSize)oldBoundsSize {
|
|
// Subviews do not participate in auto layout unless the the size this view
|
|
// changes. This allows RenderWidgetHostViewMac::SetBounds(..) to select a
|
|
@@ -509,11 +528,39 @@ - (void)viewWillMoveToWindow:(NSWindow*)newWindow {
|
|
|
|
NSWindow* oldWindow = [self window];
|
|
|
|
+ if (base::FeatureList::IsEnabled(kMacWebContentsOcclusion)) {
|
|
+ if (oldWindow) {
|
|
+ [notificationCenter
|
|
+ removeObserver:self
|
|
+ name:NSWindowDidChangeOcclusionStateNotification
|
|
+ object:oldWindow];
|
|
+ }
|
|
+
|
|
+ if (newWindow) {
|
|
+ [notificationCenter
|
|
+ addObserver:self
|
|
+ selector:@selector(windowChangedOcclusionState:)
|
|
+ name:NSWindowDidChangeOcclusionStateNotification
|
|
+ object:newWindow];
|
|
+ }
|
|
+
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ _inFullScreenTransition = NO;
|
|
if (oldWindow) {
|
|
- [notificationCenter
|
|
- removeObserver:self
|
|
- name:NSWindowDidChangeOcclusionStateNotification
|
|
- object:oldWindow];
|
|
+ NSArray* notificationsToRemove = @[
|
|
+ NSWindowDidChangeOcclusionStateNotification,
|
|
+ NSWindowWillEnterFullScreenNotification,
|
|
+ NSWindowDidEnterFullScreenNotification,
|
|
+ NSWindowWillExitFullScreenNotification,
|
|
+ NSWindowDidExitFullScreenNotification
|
|
+ ];
|
|
+ for (NSString* notificationName in notificationsToRemove) {
|
|
+ [notificationCenter removeObserver:self
|
|
+ name:notificationName
|
|
+ object:oldWindow];
|
|
+ }
|
|
}
|
|
|
|
if (newWindow) {
|
|
@@ -521,26 +568,66 @@ - (void)viewWillMoveToWindow:(NSWindow*)newWindow {
|
|
selector:@selector(windowChangedOcclusionState:)
|
|
name:NSWindowDidChangeOcclusionStateNotification
|
|
object:newWindow];
|
|
+ // The fullscreen transition causes spurious occlusion notifications.
|
|
+ // See https://crbug.com/1081229
|
|
+ [notificationCenter addObserver:self
|
|
+ selector:@selector(fullscreenTransitionStarted:)
|
|
+ name:NSWindowWillEnterFullScreenNotification
|
|
+ object:newWindow];
|
|
+ [notificationCenter addObserver:self
|
|
+ selector:@selector(fullscreenTransitionComplete:)
|
|
+ name:NSWindowDidEnterFullScreenNotification
|
|
+ object:newWindow];
|
|
+ [notificationCenter addObserver:self
|
|
+ selector:@selector(fullscreenTransitionStarted:)
|
|
+ name:NSWindowWillExitFullScreenNotification
|
|
+ object:newWindow];
|
|
+ [notificationCenter addObserver:self
|
|
+ selector:@selector(fullscreenTransitionComplete:)
|
|
+ name:NSWindowDidExitFullScreenNotification
|
|
+ object:newWindow];
|
|
}
|
|
}
|
|
|
|
- (void)windowChangedOcclusionState:(NSNotification*)aNotification {
|
|
- // Only respond to occlusion notifications sent by the occlusion checker.
|
|
- NSDictionary* userInfo = [aNotification userInfo];
|
|
- NSString* occlusionCheckerKey = [WebContentsOcclusionCheckerMac className];
|
|
- if (userInfo[occlusionCheckerKey] != nil)
|
|
- [self updateWebContentsVisibility];
|
|
+ if (!base::FeatureList::IsEnabled(kMacWebContentsOcclusion)) {
|
|
+ [self legacyUpdateWebContentsVisibility];
|
|
+ return;
|
|
+ }
|
|
+}
|
|
+
|
|
+- (void)fullscreenTransitionStarted:(NSNotification*)notification {
|
|
+ _inFullScreenTransition = YES;
|
|
+}
|
|
+
|
|
+- (void)fullscreenTransitionComplete:(NSNotification*)notification {
|
|
+ _inFullScreenTransition = NO;
|
|
}
|
|
|
|
- (void)viewDidMoveToWindow {
|
|
+ if (!base::FeatureList::IsEnabled(kMacWebContentsOcclusion)) {
|
|
+ [self legacyUpdateWebContentsVisibility];
|
|
+ return;
|
|
+ }
|
|
+
|
|
[self updateWebContentsVisibility];
|
|
}
|
|
|
|
- (void)viewDidHide {
|
|
+ if (!base::FeatureList::IsEnabled(kMacWebContentsOcclusion)) {
|
|
+ [self legacyUpdateWebContentsVisibility];
|
|
+ return;
|
|
+ }
|
|
+
|
|
[self updateWebContentsVisibility];
|
|
}
|
|
|
|
- (void)viewDidUnhide {
|
|
+ if (!base::FeatureList::IsEnabled(kMacWebContentsOcclusion)) {
|
|
+ [self legacyUpdateWebContentsVisibility];
|
|
+ return;
|
|
+ }
|
|
+
|
|
[self updateWebContentsVisibility];
|
|
}
|
|
|
|
diff --git a/content/common/features.cc b/content/common/features.cc
|
|
index 136290cb51f7b44cc6f8754c49203a7bad1634e8..d11fd0742b10e6318a0d3740759f474b41675ce6 100644
|
|
--- a/content/common/features.cc
|
|
+++ b/content/common/features.cc
|
|
@@ -261,6 +261,14 @@ BASE_FEATURE(kIOSurfaceCapturer,
|
|
base::FEATURE_ENABLED_BY_DEFAULT);
|
|
#endif
|
|
|
|
+// Feature that controls whether WebContentsOcclusionChecker should handle
|
|
+// occlusion notifications.
|
|
+#if BUILDFLAG(IS_MAC)
|
|
+BASE_FEATURE(kMacWebContentsOcclusion,
|
|
+ "MacWebContentsOcclusion",
|
|
+ base::FEATURE_ENABLED_BY_DEFAULT);
|
|
+#endif
|
|
+
|
|
// If this feature is enabled, media-device enumerations use a cache that is
|
|
// invalidated upon notifications sent by base::SystemMonitor. If disabled, the
|
|
// cache is considered invalid on every enumeration request.
|
|
diff --git a/content/common/features.h b/content/common/features.h
|
|
index dc481abb8ef01c8e5a23d0f683a59c2ee6420826..7f61079290ba740cdad7b74feeb94143bdcc6bd4 100644
|
|
--- a/content/common/features.h
|
|
+++ b/content/common/features.h
|
|
@@ -68,6 +68,9 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kInterestGroupUpdateIfOlderThan);
|
|
#if BUILDFLAG(IS_MAC)
|
|
CONTENT_EXPORT BASE_DECLARE_FEATURE(kIOSurfaceCapturer);
|
|
#endif
|
|
+#if BUILDFLAG(IS_MAC)
|
|
+CONTENT_EXPORT BASE_DECLARE_FEATURE(kMacWebContentsOcclusion);
|
|
+#endif
|
|
CONTENT_EXPORT BASE_DECLARE_FEATURE(kMediaDevicesSystemMonitorCache);
|
|
CONTENT_EXPORT BASE_DECLARE_FEATURE(kMediaStreamTrackTransfer);
|
|
CONTENT_EXPORT BASE_DECLARE_FEATURE(kMojoDedicatedThread);
|