Skip to content

Commit

Permalink
chore: cherry-pick b5950ad76471 from chromium (#22945)
Browse files Browse the repository at this point in the history
  • Loading branch information
nornagon committed Apr 7, 2020
1 parent 2426581 commit 72a7588
Show file tree
Hide file tree
Showing 18 changed files with 199 additions and 100 deletions.
4 changes: 2 additions & 2 deletions patches/chromium/.patches
Expand Up @@ -98,5 +98,5 @@ typemap.patch
allow_restricted_clock_nanosleep_in_linux_sandbox.patch
move_readablestream_requests_onto_the_stack_before_iteration.patch
streams_convert_state_dchecks_to_checks.patch
cherry-pick-fd211b44535c.patch
cherry-pick-db71a0afc1d0.patch
audiocontext_haspendingactivity_unless_it_s_closed.patch
protect_automatic_pull_handlers_with_mutex.patch
@@ -1,7 +1,7 @@
From fd211b44535c09af58353f0799a624f076e98dda Mon Sep 17 00:00:00 2001
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Raymond Toy <rtoy@chromium.org>
Date: Mon, 16 Dec 2019 17:06:28 +0000
Subject: [PATCH] AudioContext HasPendingActivity unless it's closed
Subject: AudioContext HasPendingActivity unless it's closed

An AudioContext is considered to have activity if it's not closed.
Previously, suspended contexts were considered has having no activity,
Expand All @@ -25,15 +25,12 @@ Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1969044
Reviewed-by: Raymond Toy <rtoy@chromium.org>
Cr-Commit-Position: refs/branch-heads/3987@{#158}
Cr-Branched-From: c4e8da9871cc266be74481e212f3a5252972509d-refs/heads/master@{#722274}
---
.../blink/renderer/modules/webaudio/audio_context.cc | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/third_party/blink/renderer/modules/webaudio/audio_context.cc b/third_party/blink/renderer/modules/webaudio/audio_context.cc
index bd76a6a7deca2..063475274c168 100644
index 839d8c83973b979a3382464a05c2368eec8a7bae..990fe75f1ddd4ebf9a526a9e416d2ee865afca86 100644
--- a/third_party/blink/renderer/modules/webaudio/audio_context.cc
+++ b/third_party/blink/renderer/modules/webaudio/audio_context.cc
@@ -551,9 +551,11 @@ void AudioContext::ContextDestroyed(ExecutionContext*) {
@@ -545,9 +545,11 @@ void AudioContext::ContextDestroyed(ExecutionContext*) {
}

bool AudioContext::HasPendingActivity() const {
Expand Down
2 changes: 1 addition & 1 deletion patches/chromium/browser_compositor_mac.patch
Expand Up @@ -29,7 +29,7 @@ diff --git a/content/browser/renderer_host/browser_compositor_view_mac.mm b/cont
index 8ddd790decc43af9820c97121a3b359e7cbb49ee..18019d5794f688ca07b35a665cc9800bb1d3047a 100644
--- a/content/browser/renderer_host/browser_compositor_view_mac.mm
+++ b/content/browser/renderer_host/browser_compositor_view_mac.mm
@@ -80,6 +80,12 @@
@@ -80,6 +80,12 @@ BrowserCompositorMac::~BrowserCompositorMac() {
DCHECK_EQ(1u, num_erased);
}

Expand Down
6 changes: 3 additions & 3 deletions patches/chromium/command-ismediakey.patch
Expand Up @@ -97,7 +97,7 @@ index f4e3126a4efd66f05c4f13e40ba23db10b8cca96..f7e90349ee49f0d79a0443c5a9ec886f
}
return VKEY_UNKNOWN;
}
@@ -193,7 +200,10 @@ static CGEventRef EventTapCallback(CGEventTapProxy proxy,
@@ -193,7 +200,10 @@ CGEventRef MediaKeysListenerImpl::EventTapCallback(CGEventTapProxy proxy,
int key_code = (data1 & 0xFFFF0000) >> 16;
if (key_code != NX_KEYTYPE_PLAY && key_code != NX_KEYTYPE_NEXT &&
key_code != NX_KEYTYPE_PREVIOUS && key_code != NX_KEYTYPE_FAST &&
Expand All @@ -109,15 +109,15 @@ index f4e3126a4efd66f05c4f13e40ba23db10b8cca96..f7e90349ee49f0d79a0443c5a9ec886f
return event;
}

@@ -224,6 +234,7 @@ static CGEventRef EventTapCallback(CGEventTapProxy proxy,
@@ -224,6 +234,7 @@ std::unique_ptr<MediaKeysListener> MediaKeysListener::Create(
// For Mac OS 10.12.2 or later, we want to use MPRemoteCommandCenter for
// getting media keys globally if there is a RemoteCommandCenterDelegate
// available.
+#if !BUILDFLAG(ENABLE_MEDIA_KEY_OVERRIDES)
if (@available(macOS 10.12.2, *)) {
if (scope == Scope::kGlobal &&
now_playing::RemoteCommandCenterDelegate::GetInstance()) {
@@ -233,7 +244,7 @@ static CGEventRef EventTapCallback(CGEventTapProxy proxy,
@@ -233,7 +244,7 @@ std::unique_ptr<MediaKeysListener> MediaKeysListener::Create(
return std::move(listener);
}
}
Expand Down
2 changes: 1 addition & 1 deletion patches/chromium/fix_disabling_compositor_recycling.patch
Expand Up @@ -9,7 +9,7 @@ diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/cont
index 6a9f9c466a45312c190b30e53146b9b303b9f32a..80900b809d7b05a4ab546c6ce0686a261755e82a 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -489,7 +489,11 @@
@@ -489,7 +489,11 @@ void RenderWidgetHostViewMac::WasOccluded() {
return;

host()->WasHidden();
Expand Down
18 changes: 9 additions & 9 deletions patches/chromium/fix_hi-dpi_transitions_on_catalina.patch
Expand Up @@ -48,7 +48,7 @@ diff --git a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
index 3db03e957c0325417747a952f2dffb45b3c81916..ab9caba9ba54a6fbe85b3ca2ffac470d9498900d 100644
--- a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
+++ b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
@@ -313,9 +313,11 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) {
@@ -313,9 +313,11 @@ NativeWidgetNSWindowBridge::NativeWidgetNSWindowBridge(
bridge_mojo_binding_(this) {
DCHECK(GetIdToWidgetImplMap().find(id_) == GetIdToWidgetImplMap().end());
GetIdToWidgetImplMap().insert(std::make_pair(id_, this));
Expand All @@ -60,7 +60,7 @@ index 3db03e957c0325417747a952f2dffb45b3c81916..ab9caba9ba54a6fbe85b3ca2ffac470d
// The delegate should be cleared already. Note this enforces the precondition
// that -[NSWindow close] is invoked on the hosted window before the
// destructor is called.
@@ -1098,7 +1100,17 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) {
@@ -1098,7 +1100,17 @@ DragDropClient* NativeWidgetNSWindowBridge::drag_drop_client() {
}

////////////////////////////////////////////////////////////////////////////////
Expand All @@ -83,7 +83,7 @@ diff --git a/ui/display/mac/screen_mac.mm b/ui/display/mac/screen_mac.mm
index 4e0a2cb6991cafa96c1e2077f38ef315544890fc..9f0d860316d2aabc6f344e47a1c5b4d550b6335e 100644
--- a/ui/display/mac/screen_mac.mm
+++ b/ui/display/mac/screen_mac.mm
@@ -32,8 +32,8 @@
@@ -32,8 +32,8 @@ Boolean CGDisplayUsesForceToGray(void);
namespace display {
namespace {

Expand All @@ -94,7 +94,7 @@ index 4e0a2cb6991cafa96c1e2077f38ef315544890fc..9f0d860316d2aabc6f344e47a1c5b4d5
const int64_t kConfigureDelayMs = 500;

NSScreen* GetMatchingScreen(const gfx::Rect& match_rect) {
@@ -159,20 +159,27 @@ CGFloat GetMinimumDistanceToCorner(const NSPoint& point, NSScreen* screen) {
@@ -159,20 +159,27 @@ class ScreenMac : public Screen {
CGDisplayRegisterReconfigurationCallback(
ScreenMac::DisplayReconfigurationCallBack, this);

Expand Down Expand Up @@ -126,7 +126,7 @@ index 4e0a2cb6991cafa96c1e2077f38ef315544890fc..9f0d860316d2aabc6f344e47a1c5b4d5

CGDisplayRemoveReconfigurationCallback(
ScreenMac::DisplayReconfigurationCallBack, this);
@@ -197,16 +204,18 @@ bool IsWindowUnderCursor(gfx::NativeWindow native_window) override {
@@ -197,16 +204,18 @@ class ScreenMac : public Screen {
int GetNumDisplays() const override { return GetAllDisplays().size(); }

const std::vector<Display>& GetAllDisplays() const override {
Expand All @@ -147,7 +147,7 @@ index 4e0a2cb6991cafa96c1e2077f38ef315544890fc..9f0d860316d2aabc6f344e47a1c5b4d5
if (!window)
return GetPrimaryDisplay();

@@ -279,31 +288,30 @@ void RemoveObserver(DisplayObserver* observer) override {
@@ -279,31 +288,30 @@ class ScreenMac : public Screen {
static void DisplayReconfigurationCallBack(CGDirectDisplayID display,
CGDisplayChangeSummaryFlags flags,
void* userInfo) {
Expand Down Expand Up @@ -189,7 +189,7 @@ index 4e0a2cb6991cafa96c1e2077f38ef315544890fc..9f0d860316d2aabc6f344e47a1c5b4d5
if (displays_require_update_) {
displays_ = BuildDisplaysFromQuartz();
displays_require_update_ = false;
@@ -311,7 +319,7 @@ void EnsureDisplaysValid() const {
@@ -311,7 +319,7 @@ class ScreenMac : public Screen {
}

void ConfigureTimerFired() {
Expand All @@ -198,7 +198,7 @@ index 4e0a2cb6991cafa96c1e2077f38ef315544890fc..9f0d860316d2aabc6f344e47a1c5b4d5
change_notifier_.NotifyDisplaysChanged(old_displays_, displays_);
old_displays_ = displays_;
}
@@ -325,7 +333,7 @@ void ConfigureTimerFired() {
@@ -325,7 +333,7 @@ class ScreenMac : public Screen {
// It would be ridiculous to have this many displays connected, but
// CGDirectDisplayID is just an integer, so supporting up to this many
// doesn't hurt.
Expand All @@ -207,7 +207,7 @@ index 4e0a2cb6991cafa96c1e2077f38ef315544890fc..9f0d860316d2aabc6f344e47a1c5b4d5
CGDisplayCount online_display_count = 0;
if (CGGetOnlineDisplayList(base::size(online_displays), online_displays,
&online_display_count) != kCGErrorSuccess) {
@@ -361,21 +369,32 @@ void ConfigureTimerFired() {
@@ -361,21 +369,32 @@ class ScreenMac : public Screen {
: displays;
}

Expand Down
Expand Up @@ -18,7 +18,7 @@ diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/co
index 9113fb00d144d6cee789f608f8b3761b93ca7ae8..1e92b2b515056235de6277a43be207f79c94dedf 100644
--- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
+++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
@@ -2220,7 +2220,9 @@ - (void)invalidateTouchBar {
@@ -2220,7 +2220,9 @@ extern NSString* NSTextInputReplacementRangeAttributeName;
}

- (NSTouchBar*)makeTouchBar {
Expand Down
6 changes: 3 additions & 3 deletions patches/chromium/mas-cfisobjc.patch
Expand Up @@ -9,15 +9,15 @@ diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm
index 8b20ebc678c39b722bd5b03930ce89847e8cc73a..dca8c939e757003aafc1528ec7bbb739bf971fa6 100644
--- a/base/mac/foundation_util.mm
+++ b/base/mac/foundation_util.mm
@@ -26,7 +26,6 @@
@@ -26,7 +26,6 @@ CFTypeID SecKeyGetTypeID();
#if !defined(OS_IOS)
CFTypeID SecACLGetTypeID();
CFTypeID SecTrustedApplicationGetTypeID();
-Boolean _CFIsObjC(CFTypeID typeID, CFTypeRef obj);
#endif
} // extern "C"

@@ -315,8 +314,7 @@ void SetBaseBundleID(const char* new_base_bundle_id) {
@@ -315,8 +314,7 @@ NSFont* CFToNSCast(CTFontRef cf_val) {
const_cast<NSFont*>(reinterpret_cast<const NSFont*>(cf_val));
DCHECK(!cf_val ||
CTFontGetTypeID() == CFGetTypeID(cf_val) ||
Expand All @@ -27,7 +27,7 @@ index 8b20ebc678c39b722bd5b03930ce89847e8cc73a..dca8c939e757003aafc1528ec7bbb739
return ns_val;
}

@@ -384,9 +382,6 @@ CTFontRef NSToCFCast(NSFont* ns_val) {
@@ -384,9 +382,6 @@ CFCast<CTFontRef>(const CFTypeRef& cf_val) {
return (CTFontRef)(cf_val);
}

Expand Down
6 changes: 3 additions & 3 deletions patches/chromium/mas_blink_no_private_api.patch
Expand Up @@ -18,7 +18,7 @@ index 94afefcee81b87c05bf9b1199d90d3d4b5ea84a6..2ec7f04c71824b47de1ddbf1f0e8625d
extern "C" {

// Kill ring calls. Would be better to use NSKillRing.h, but that's not
@@ -39,38 +40,53 @@
@@ -39,38 +40,53 @@ NSString* _NSYankFromKillRing();
void _NSNewKillRingSequence();
void _NSSetKillRingToYankedState();
}
Expand Down Expand Up @@ -92,7 +92,7 @@ index e94235acb17335fbc78c606ff26036871117bd09..7c4bd19215c67f649636ae69b9a21b5c

namespace blink {

@@ -72,10 +74,12 @@ void _NSDrawCarbonThemeListBox(NSRect frame,
@@ -72,10 +74,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) {
Expand All @@ -105,7 +105,7 @@ index e94235acb17335fbc78c606ff26036871117bd09..7c4bd19215c67f649636ae69b9a21b5c
return false;
}

@@ -161,10 +165,12 @@ void _NSDrawCarbonThemeListBox(NSRect frame,
@@ -161,10 +165,12 @@ bool ThemePainterMac::PaintTextArea(const Node* node,
const PaintInfo& paint_info,
const IntRect& r) {
LocalCurrentGraphicsContext local_context(paint_info.context, r);
Expand Down
16 changes: 8 additions & 8 deletions patches/chromium/mas_disable_custom_window_frame.patch
Expand Up @@ -18,7 +18,7 @@ index 1ffb647e85e00ff60d84234e47f5d7d385f65245..439cc6df5e0cc1ec3732d6f2a2e00d54
@interface NSWindow (PrivateBrowserNativeWidgetAPI)
+ (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle;
@end
@@ -69,10 +70,13 @@ - (NSRect)_draggableFrame NS_DEPRECATED_MAC(10_10, 10_11) {
@@ -69,10 +70,13 @@

@end

Expand All @@ -32,7 +32,7 @@ index 1ffb647e85e00ff60d84234e47f5d7d385f65245..439cc6df5e0cc1ec3732d6f2a2e00d54
+ (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle {
// - NSThemeFrame and its subclasses will be nil if it's missing at runtime.
if ([BrowserWindowFrame class])
@@ -87,6 +91,8 @@ - (BOOL)_usesCustomDrawing {
@@ -87,6 +91,8 @@
return NO;
}

Expand All @@ -54,7 +54,7 @@ index 8416c7c6e052dafb2aad61c0bd3224c36e945d23..cd356beda023ab2409b16d58ca38c70b
@interface NSWindow (PrivateAPI)
+ (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle;
@end
@@ -18,8 +20,12 @@ - (CGFloat)_titlebarHeight {
@@ -18,8 +20,12 @@
}
@end

Expand All @@ -67,7 +67,7 @@ index 8416c7c6e052dafb2aad61c0bd3224c36e945d23..cd356beda023ab2409b16d58ca38c70b
+ (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle {
if ([NativeWidgetMacFramelessNSWindowFrame class]) {
return [NativeWidgetMacFramelessNSWindowFrame class];
@@ -27,4 +33,6 @@ + (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle {
@@ -27,4 +33,6 @@
return [super frameViewClassForStyleMask:windowStyle];
}

Expand Down Expand Up @@ -108,7 +108,7 @@ index bf4cd6d246358c568cbe192c48748099a3c1de20..6955d39751832815ddec1fec32d791fc
- (BOOL)hasKeyAppearance;
- (long long)_resizeDirectionForMouseLocation:(CGPoint)location;

@@ -56,6 +58,8 @@ - (void)cr_mouseDownOnFrameView:(NSEvent*)event {
@@ -56,6 +58,8 @@
}
@end

Expand All @@ -117,7 +117,7 @@ index bf4cd6d246358c568cbe192c48748099a3c1de20..6955d39751832815ddec1fec32d791fc
@implementation NativeWidgetMacNSWindowTitledFrame
- (void)mouseDown:(NSEvent*)event {
if (self.window.isMovable)
@@ -77,6 +81,8 @@ - (BOOL)usesCustomDrawing {
@@ -77,6 +81,8 @@
}
@end

Expand All @@ -126,7 +126,7 @@ index bf4cd6d246358c568cbe192c48748099a3c1de20..6955d39751832815ddec1fec32d791fc
@implementation NativeWidgetMacNSWindow {
@private
base::scoped_nsobject<CommandDispatcher> commandDispatcher_;
@@ -154,6 +160,8 @@ - (BOOL)hasViewsMenuActive {
@@ -154,6 +160,8 @@

// NSWindow overrides.

Expand All @@ -135,7 +135,7 @@ index bf4cd6d246358c568cbe192c48748099a3c1de20..6955d39751832815ddec1fec32d791fc
+ (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle {
if (windowStyle & NSWindowStyleMaskTitled) {
if (Class customFrame = [NativeWidgetMacNSWindowTitledFrame class])
@@ -165,6 +173,8 @@ + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle {
@@ -165,6 +173,8 @@
return [super frameViewClassForStyleMask:windowStyle];
}

Expand Down

0 comments on commit 72a7588

Please sign in to comment.