Files
electron/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch
electron-roller[bot] 809ab09b6f chore: bump chromium to 145.0.7596.0 (main) (#49224)
* chore: bump chromium in DEPS to 145.0.7588.0

* fix(patch-conflict): update scroll_bounce_flag for split overscroll methods

Chromium split IsElasticOverscrollEnabled() into two methods:
IsElasticOverscrollEnabledOnRoot() and IsElasticOverscrollSupported().
Updated patch to apply the scroll-bounce command-line switch to both
methods.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7233733

* fix(patch-conflict): update exclusive_access patch context

Upstream refactored the profile variable declaration. Updated patch to
match new surrounding context with brace-style if statement.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7239252

* fix(patch-conflict): update screen capture kit non-shareable filter

Upstream refactored PiP window exclusion to use GetWindowsToExclude()
helper function. Updated patch to combine non-shareable window filtering
with the new helper's output.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7274596

* fix(patch-conflict): update corner smoothing CSS property id position

Upstream added new internal overscroll CSS properties. Updated patch to
add kElectronCornerSmoothing after the new entries.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7234051

* fix(patch-conflict): update permission patches for new permission types

Upstream added new permission types: LOCAL_NETWORK, LOOPBACK_NETWORK,
and GEOLOCATION_APPROXIMATE. Updated Electron permission patches to
include these new types and renumber Electron-specific permissions.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7231952

* fix(patch-conflict): update memory query fallback for new function signature

Upstream added AmountOfTotalPhysicalMemory() with PCHECK. Updated patch
to maintain fallback logic with correct ByteSize return type.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7254886

* chore: update patch hunk headers

* fix(patch): update reclient-configs patch to use new file mode

The fix_add_python_remote_wrapper patch was using 'copy from' mode
which caused inconsistent behavior between local and CI git versions.
Changed to 'new file' mode for consistent patch application.

* fix(patch-conflict): remove duplicate GEOLOCATION_APPROXIMATE case

Upstream moved GEOLOCATION_APPROXIMATE earlier in the switch statement
in GetPermissionString(). The 3-way merge kept both the old and new
positions, causing a duplicate case error.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/6397637

* chore: update libcxx filenames for new headers

* chore: bump chromium in DEPS to 145.0.7590.0

* chore: update patch hunk headers

* fix(patch): update memory fallback return type to ByteSize

Upstream changed the return type from ByteCount to ByteSize.

* fix: suppress nodiscard warning in node_file.cc

libc++ added [[nodiscard]] to std::filesystem::copy_options operator|=
which causes build failures with -Werror.

* 7229082: update CopyFromSurface to use CopyFromSurfaceResult

Upstream changed CopyFromSurface callback to return
base::expected<viz::CopyOutputBitmapWithMetadata, std::string>
instead of SkBitmap, enabling better error handling.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7229082

* 7254070: add ip_address_space param to OnLocalNetworkAccessPermissionRequired

Upstream added IPAddressSpace parameter to check address space for
proper permission handling in Local Network Access.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7254070

* 7136679: add spelling_markers param to RequestCheckingOfText

Upstream added spelling_markers parameter to report misspelling
ranges from Blink to Spellcheck to IME.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7136679

* 7240487: remove second param from RegisterWebSafeIsolatedScheme

Upstream removed the schemes_okay_to_appear_as_origin_headers_ parameter.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7240487

* 7254577: use explicit WebElement constructor

WebElement default constructor now requires explicit construction
rather than brace initialization.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7254577

* 7256335: remove override from CreateGlobalFeaturesForTesting

Upstream removed BrowserProcess::CreateGlobalFeaturesForTesting virtual
method so the override specifier is no longer valid.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7256335

* chore: add missing SingleThreadTaskRunner include

A transitive include of SingleThreadTaskRunner was removed upstream,
requiring an explicit include.

Ref: Unable to locate specific CL (transitive include change)

* 7260483: add LOCAL_NETWORK, LOOPBACK_NETWORK permission type cases

Upstream added new permission types for Local Network Access split
permissions.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7260483

* chore: update patch hunk headers

* 7264893: update postMessage tests for file: origin serialization change

Chromium now serializes file: origins as 'null' in MessageEvent per spec.
This is a security improvement aligning with the HTML spec behavior.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7264893

* fix: add paths to custom scheme URLs in protocol tests

Custom scheme URLs without paths (e.g. test-scheme://foo) cause a
DCHECK crash in ASAN builds when CorsURLLoader tries to log the
request via GenerateRequestLine -> PathForRequest, which asserts
that the path is non-empty.

Adding trailing slashes ensures URLs have valid paths.

* chore: bump chromium in DEPS to 145.0.7592.0

* chore: update patches (trivial only)

* chore: bump chromium in DEPS to 145.0.7594.0

* chore: bump chromium in DEPS to 145.0.7596.0

* chore: update accelerator.patch

no manual changes; patch applied with fuzz 2 (offset 1 line)

* chore: update patches (trivial only)

* chore: node ./script/gen-libc++-filenames.js

---------

Co-authored-by: Alice Zhao <alicelovescake@anthropic.com>
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-12-25 17:15:53 -06:00

178 lines
8.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: deepak1556 <hop2deep@gmail.com>
Date: Mon, 18 May 2020 11:12:26 -0700
Subject: allow disabling blink scheduler throttling per RenderView
This allows us to disable throttling for hidden windows.
diff --git a/content/browser/renderer_host/navigation_controller_impl_unittest.cc b/content/browser/renderer_host/navigation_controller_impl_unittest.cc
index 1390ff8785644a5e2c9d057124bf364972db53cc..8fcb52f033e175703f6695197ae61cd97bc15002 100644
--- a/content/browser/renderer_host/navigation_controller_impl_unittest.cc
+++ b/content/browser/renderer_host/navigation_controller_impl_unittest.cc
@@ -168,6 +168,12 @@ class MockPageBroadcast : public blink::mojom::PageBroadcast {
(bool supports_draggable_regions),
(override));
+ MOCK_METHOD(
+ void,
+ SetSchedulerThrottling,
+ (bool allowed),
+ (override));
+
mojo::PendingAssociatedRemote<blink::mojom::PageBroadcast> GetRemote() {
return receiver_.BindNewEndpointAndPassDedicatedRemote();
}
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index 7a7f78fc15114f6303f8413e7330c8f59fd79e07..8685048a717e8af489804748550b898051d83b3c 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -759,6 +759,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) {
GetWidget()->GetAssociatedFrameWidget()->SetBackgroundOpaque(opaque);
}
+void RenderViewHostImpl::SetSchedulerThrottling(bool allowed) {
+ if (auto& broadcast = GetAssociatedPageBroadcast())
+ broadcast->SetSchedulerThrottling(allowed);
+}
+
bool RenderViewHostImpl::IsMainFrameActive() {
return is_active();
}
diff --git a/content/browser/renderer_host/render_view_host_impl.h b/content/browser/renderer_host/render_view_host_impl.h
index c8d6592a2d73bb132c7bdaa6532086da10a4512a..99479aed4911e134914db226094933c311002164 100644
--- a/content/browser/renderer_host/render_view_host_impl.h
+++ b/content/browser/renderer_host/render_view_host_impl.h
@@ -134,6 +134,7 @@ class CONTENT_EXPORT RenderViewHostImpl
void EnablePreferredSizeMode() override;
void WriteIntoTrace(perfetto::TracedProto<TraceProto> context) const override;
+ void SetSchedulerThrottling(bool allowed) override;
void SendWebPreferencesToRenderer();
void SendRendererPreferencesToRenderer(
const blink::RendererPreferences& preferences);
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 4df91cea76224362565bb968852d05c1a4f865f9..b9b7426d6234ab4b269c154feedadf16943212f8 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -646,8 +646,8 @@ void RenderWidgetHostViewAura::ShowImpl(PageVisibilityState page_visibility) {
// OnShowWithPageVisibility will not call NotifyHostAndDelegateOnWasShown,
// which updates `visibility_`, unless the host is hidden. Make sure no update
// is needed.
- CHECK(host_->IsHidden() || visibility_ == Visibility::VISIBLE);
- OnShowWithPageVisibility(page_visibility);
+ if (host_->IsHidden() || visibility_ == Visibility::VISIBLE)
+ OnShowWithPageVisibility(page_visibility);
}
void RenderWidgetHostViewAura::EnsurePlatformVisibility(
diff --git a/content/public/browser/render_view_host.h b/content/public/browser/render_view_host.h
index 782bed0fdc08d57eceb059f398f253fab9233b1b..f1ab5b981ea68af1b11313e67f2c5060f0a640b1 100644
--- a/content/public/browser/render_view_host.h
+++ b/content/public/browser/render_view_host.h
@@ -73,6 +73,9 @@ class CONTENT_EXPORT RenderViewHost {
virtual void WriteIntoTrace(
perfetto::TracedProto<TraceProto> context) const = 0;
+ // Disable/Enable scheduler throttling.
+ 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 4c8d44cdb2fde8e174b78aee7defb980651da18e..f8bf421b5b32af4cd197cbf23f4bd281c3a12514 100644
--- a/content/test/test_page_broadcast.h
+++ b/content/test/test_page_broadcast.h
@@ -52,6 +52,7 @@ class TestPageBroadcast : public blink::mojom::PageBroadcast {
void UpdateColorProviders(
const blink::ColorProviderColorMaps& color_provider_colors) override;
void SetSupportsDraggableRegions(bool supports_draggable_regions) override;
+ void SetSchedulerThrottling(bool allowed) override {}
mojo::AssociatedReceiver<blink::mojom::PageBroadcast> receiver_;
};
diff --git a/third_party/blink/public/mojom/page/page.mojom b/third_party/blink/public/mojom/page/page.mojom
index b00bc8a8a5044fbf46f627f9db56cea7f09d7ef6..114c3a4522d11c1348f681af500c487ccd97eea9 100644
--- a/third_party/blink/public/mojom/page/page.mojom
+++ b/third_party/blink/public/mojom/page/page.mojom
@@ -180,4 +180,7 @@ interface PageBroadcast {
// Indicates that the page's main frame should collect draggable regions set
// using the app-region CSS property.
SetSupportsDraggableRegions(bool supports_draggable_regions);
+
+ // Whether to enable the Renderer scheduler background throttling.
+ SetSchedulerThrottling(bool allowed);
};
diff --git a/third_party/blink/public/web/web_view.h b/third_party/blink/public/web/web_view.h
index 932658273154ef2e022358e493a8e7c00c86e732..57bbfb5cde62c9496c351c861880a18918e22c05 100644
--- a/third_party/blink/public/web/web_view.h
+++ b/third_party/blink/public/web/web_view.h
@@ -355,6 +355,7 @@ class BLINK_EXPORT WebView {
// Scheduling -----------------------------------------------------------
virtual PageScheduler* Scheduler() const = 0;
+ virtual void SetSchedulerThrottling(bool allowed) {}
// Visibility -----------------------------------------------------------
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc
index 32c9c2773d076e08bd7e4bf9f6b4723de746f79d..26dedfbeb8fa650271fbea7ae46c7e075d29da54 100644
--- a/third_party/blink/renderer/core/exported/web_view_impl.cc
+++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
@@ -2498,6 +2498,10 @@ void WebViewImpl::SetPageLifecycleStateInternal(
TRACE_EVENT2("navigation", "WebViewImpl::SetPageLifecycleStateInternal",
"old_state", old_state, "new_state", new_state);
+ // If backgroundThrottling is disabled, the page is always visible.
+ if (!scheduler_throttling_allowed_)
+ new_state->visibility = mojom::blink::PageVisibilityState::kVisible;
+
bool storing_in_bfcache = new_state->is_in_back_forward_cache &&
!old_state->is_in_back_forward_cache;
bool restoring_from_bfcache = !new_state->is_in_back_forward_cache &&
@@ -4116,10 +4120,23 @@ PageScheduler* WebViewImpl::Scheduler() const {
return GetPage()->GetPageScheduler();
}
+void WebViewImpl::SetSchedulerThrottling(bool allowed) {
+ DCHECK(GetPage());
+ scheduler_throttling_allowed_ = allowed;
+ GetPage()->GetPageScheduler()->SetPageVisible(!allowed || GetVisibilityState() == mojom::blink::PageVisibilityState::kVisible);
+}
+
void WebViewImpl::SetVisibilityState(
mojom::blink::PageVisibilityState visibility_state,
bool is_initial_state) {
DCHECK(GetPage());
+
+ if (!scheduler_throttling_allowed_) {
+ GetPage()->SetVisibilityState(mojom::blink::PageVisibilityState::kVisible, is_initial_state);
+ GetPage()->GetPageScheduler()->SetPageVisible(true);
+ return;
+ }
+
GetPage()->SetVisibilityState(visibility_state, is_initial_state);
// Do not throttle if the page should be painting.
bool is_visible =
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.h b/third_party/blink/renderer/core/exported/web_view_impl.h
index 3e3c1783f8dfdbfdaacb1dfc34e4babb13ad7427..68c3a7a7324165cd140fb7dd5bd1d69f08537987 100644
--- a/third_party/blink/renderer/core/exported/web_view_impl.h
+++ b/third_party/blink/renderer/core/exported/web_view_impl.h
@@ -445,6 +445,7 @@ class CORE_EXPORT WebViewImpl final : public WebView,
LocalDOMWindow* PagePopupWindow() const;
PageScheduler* Scheduler() const override;
+ void SetSchedulerThrottling(bool allowed) override;
void SetVisibilityState(mojom::blink::PageVisibilityState visibility_state,
bool is_initial_state) override;
mojom::blink::PageVisibilityState GetVisibilityState() override;
@@ -940,6 +941,8 @@ class CORE_EXPORT WebViewImpl final : public WebView,
// If true, we send IPC messages when |preferred_size_| changes.
bool send_preferred_size_changes_ = false;
+ bool scheduler_throttling_allowed_ = true;
+
// Whether the preferred size may have changed and |UpdatePreferredSize| needs
// to be called.
bool needs_preferred_size_update_ = true;