mirror of
https://github.com/electron/electron.git
synced 2026-01-06 22:24:03 -05:00
* chore: bump chromium in DEPS to 117.0.5929.0 * chore: bump chromium in DEPS to 117.0.5931.0 * chore: bump chromium in DEPS to 117.0.5932.0 * chore: update patches * 4728317: Prevent PrintRenderFrameHelper from printing when already printing | https://chromium-review.googlesource.com/c/chromium/src/+/4728317 * 4739501: Use base::SequenceBound to manage SerialPortManagerImpl | https://chromium-review.googlesource.com/c/chromium/src/+/4739501 * 4702051: Allow overriding source in install-sysroot.py | https://chromium-review.googlesource.com/c/chromium/src/+/4702051 * chore: update filenames.libcxx.gni * 4727002: Rename "enable_arc2" to "enable_arc" | https://chromium-review.googlesource.com/c/chromium/src/+/4727002 * chore: bump chromium in DEPS to 117.0.5934.0 * 4736873: Rename ColorSpaces methods on display::Display | https://chromium-review.googlesource.com/c/chromium/src/+/4736873 * 4727203: Replace bool with an enum in as suggested in DevtoolsManagerDelegate. | https://chromium-review.googlesource.com/c/chromium/src/+/4727203 * 4744479: [DevTools] Add 'generateTaggedPDF' option to DevTools Page.printToPDF | https://chromium-review.googlesource.com/c/chromium/src/+/4744479 * 4735893: Don't share WebUSB permissions with webviews | https://chromium-review.googlesource.com/c/chromium/src/+/4735893 * revert: update filenames.libcxx.gni * chore: bump chromium in DEPS to 117.0.5936.0 * chore: update patches * 4746465: SAA: Query for embargoed StorageAccess permissions | https://chromium-review.googlesource.com/c/chromium/src/+/4746465 * 4666325: Move buildtools/third_party/lib*/trunk source paths to third_party/lib*/src. | https://chromium-review.googlesource.com/c/chromium/src/+/4666325 * chore: bump chromium in DEPS to 117.0.5938.0 * chore: bump chromium in DEPS to 118.0.5939.0 * chore: update patches * Send line bounds through CursorAnchorInfo on requestCursorUpdate https://chromium-review.googlesource.com/c/chromium/src/+/4394588 * Fixup lint for Move buildtools/third_party/lib*/trunk source paths to third_party/lib*/src * 4700305: [mac] Fix override of CHILD_PROCESS_EXE https://chromium-review.googlesource.com/c/chromium/src/+/4700305 Needed because of 4729689: Reland "Remove redundant existence check in PathService" | https://chromium-review.googlesource.com/c/chromium/src/+/4729689 * 4753759: More consistent icon handling for menus. https://chromium-review.googlesource.com/c/chromium/src/+/4753759 * chore: bump chromium in DEPS to 118.0.5941.0 * chore: update patches * chore: bump chromium in DEPS to 117.0.5938.0 * test: update nan-spec-runner cflags * build: fix isystem include path in nan-spec-runner * fixup! 4666325: Move buildtools/third_party/lib*/trunk source paths to third_party/lib*/src. | https://chromium-review.googlesource.com/c/chromium/src/+/4666325 fix a few more instances of the old path libc++.a and libc++abi.a are still in buildtools/ --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: VerteDinde <vertedinde@electronjs.org> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: Charles Kerr <charles@charleskerr.com>
176 lines
8.7 KiB
Diff
176 lines
8.7 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/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
|
|
index 830307d5113f28027c8e99befb8eb47a19b37b7f..063d6a1af7d4cc516d9a5ece9fd178b5c5bd3df6 100644
|
|
--- a/content/browser/renderer_host/render_view_host_impl.cc
|
|
+++ b/content/browser/renderer_host/render_view_host_impl.cc
|
|
@@ -710,6 +710,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 d44652650891eff7cd6111bc6d6454a009942cb6..16522609163ba6bc422fc30a8d145a25877c407e 100644
|
|
--- a/content/browser/renderer_host/render_view_host_impl.h
|
|
+++ b/content/browser/renderer_host/render_view_host_impl.h
|
|
@@ -140,6 +140,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 8fa040071ba1e70890f7dcf8193e83e147679ed7..3cc38ccd2793b801f5debd3d2815c367ce036e6b 100644
|
|
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
|
|
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
|
|
@@ -565,8 +565,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.
|
|
- DCHECK(host_->is_hidden() || visibility_ == Visibility::VISIBLE);
|
|
- OnShowWithPageVisibility(page_visibility);
|
|
+ if (host_->is_hidden() || visibility_ == Visibility::VISIBLE)
|
|
+ OnShowWithPageVisibility(page_visibility);
|
|
}
|
|
|
|
void RenderWidgetHostViewAura::NotifyHostAndDelegateOnWasShown(
|
|
diff --git a/content/public/browser/render_view_host.h b/content/public/browser/render_view_host.h
|
|
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 {
|
|
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 73c0f64aa84061381a98ba60906835258f881468..41bdf7e231eca4617dbe53737a3925039bf77c4f 100644
|
|
--- a/content/test/test_page_broadcast.h
|
|
+++ b/content/test/test_page_broadcast.h
|
|
@@ -45,6 +45,7 @@ class TestPageBroadcast : public blink::mojom::PageBroadcast {
|
|
override;
|
|
void UpdatePageBrowsingContextGroup(const blink::BrowsingContextGroupInfo&
|
|
browsing_context_group_info) 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 d3877e946b1d65eba5bb45efe786fbcc7925ca6e..73bd5056baf7e4278b7260e550e2b8516be72f20 100644
|
|
--- a/third_party/blink/public/mojom/page/page.mojom
|
|
+++ b/third_party/blink/public/mojom/page/page.mojom
|
|
@@ -155,4 +155,7 @@ interface PageBroadcast {
|
|
// in `browsing_context_group_info`.
|
|
UpdatePageBrowsingContextGroup(
|
|
blink.mojom.BrowsingContextGroupInfo browsing_context_group_info);
|
|
+
|
|
+ // 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 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) {}
|
|
|
|
// 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 f4bd3d4fa8d85220557b3a2608f8ee5b808468d8..c724ee69385ae9817161a72f82a14c4ac9b5f835 100644
|
|
--- a/third_party/blink/renderer/core/exported/web_view_impl.cc
|
|
+++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
|
|
@@ -2406,6 +2406,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 &&
|
|
@@ -3870,17 +3874,31 @@ 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) : true);
|
|
+}
|
|
+
|
|
void WebViewImpl::SetVisibilityState(
|
|
mojom::blink::PageVisibilityState visibility_state,
|
|
bool is_initial_state) {
|
|
DCHECK(GetPage());
|
|
- GetPage()->SetVisibilityState(visibility_state, is_initial_state);
|
|
- GetPage()->GetPageScheduler()->SetPageVisible(
|
|
- visibility_state == mojom::blink::PageVisibilityState::kVisible);
|
|
- // Notify observers of the change.
|
|
- if (!is_initial_state) {
|
|
- for (auto& observer : observers_)
|
|
- observer.OnPageVisibilityChanged(visibility_state);
|
|
+
|
|
+ // If backgroundThrottling is disabled, the page is always visible.
|
|
+ if (!scheduler_throttling_allowed_) {
|
|
+ GetPage()->SetVisibilityState(mojom::blink::PageVisibilityState::kVisible, is_initial_state);
|
|
+ GetPage()->GetPageScheduler()->SetPageVisible(true);
|
|
+ } else {
|
|
+ bool is_visible = visibility_state == mojom::blink::PageVisibilityState::kVisible;
|
|
+ GetPage()->SetVisibilityState(visibility_state, is_initial_state);
|
|
+ GetPage()->GetPageScheduler()->SetPageVisible(is_visible);
|
|
+ // Notify observers of the change.
|
|
+ if (!is_initial_state) {
|
|
+ for (auto& observer : observers_)
|
|
+ observer.OnPageVisibilityChanged(visibility_state);
|
|
+ }
|
|
}
|
|
}
|
|
|
|
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 6a180620e00c77d0f4be346d1296f62feb714abb..c0ccf14faa52ab190c5848e8e9b597bcf637d4c0 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;
|
|
@@ -909,6 +910,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;
|