mirror of
https://github.com/electron/electron.git
synced 2026-01-08 23:18:06 -05:00
* chore: bump chromium in DEPS to 123.0.6273.0 * chore: update patches * chore: bump chromium in DEPS to 123.0.6274.0 * chore: update patches * chore: bump chromium in DEPS to 123.0.6276.0 * chore: update patches * WIP: 5239586: Change View::Layout() to take a PassKey. https://chromium-review.googlesource.com/c/chromium/src/+/5239586 * WIP: 5239586: Change View::Layout() to take a PassKey. https://chromium-review.googlesource.com/c/chromium/src/+/5239586 * chore: bump chromium in DEPS to 123.0.6278.0 * chore: bump chromium in DEPS to 123.0.6280.0 * chore: update patches * chore: use net::CanonicalCookie::SecureAttribute() renamed from IsSecure() Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5245913 * refactor: handle multiple requested device ids Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5132210 * refactor: trigger View layouts async with View::InvalidateLayout() Upstream has introduced a PassKey to restrict who can call Layout() directly. I've opted for calling `InvalidateLayout()` which is the approach that upstream recommends. If for some reason this approach doesn't work for us, we could use `DeprecatedLayoutImmediately()` as a stopgap. Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5239586 Xref: https://chromium.googlesource.com/chromium/src/+/main/ui/views/view.h#809 Xref: https://chromium.googlesource.com/chromium/src/+/main/docs/ui/learn/bestpractices/layout.md?pli=1#don_t-invoke-layout_directly * chore: bump chromium in DEPS to 123.0.6282.0 * chore: bump chromium in DEPS to 123.0.6284.0 * chore: update patches * refactor: remove use of blink::MainThreadIsolate() pt 1/3 Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5249640 * refactor: remove use of blink::MainThreadIsolate() pt 2/3 Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5249640 * refactor: remove use of blink::MainThreadIsolate() pt 3/3 Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5249640 * chore: update enum name to ui::AXMode::kPDFPrinting Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5270301 * chore: rebuild filenames.libcxx.gni * chore: sync with upstream rename of PortProvider.TaskForHandle() Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5259103 * chore: bump chromium in DEPS to 123.0.6286.0 * chore: bump chromium in DEPS to 123.0.6288.0 * WebPreferences: Initialize in declaration. Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5277099 * chore: update webview_fullscreen.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5053508 Simple update to fix patch shear * chore: update feat_configure_launch_options_for_service_process.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5254861 Simple update to fix patch shear * chore: add IWC::Delegate::RecordResize() stub to fix FTBFS https://chromium-review.googlesource.com/c/chromium/src/+/5268963 * chore: add FormControlType::kButtonPopover to the FormControlType converter Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5230929 * chore: e patches all * chore: node script/gen-libc++-filenames.js * chore: bump chromium in DEPS to 123.0.6290.0 * chore: bump chromium in DEPS to 123.0.6291.0 * chore: bump chromium in DEPS to 123.0.6292.0 * chore: bump chromium in DEPS to 123.0.6294.0 * chore: update fix_aspect_ratio_with_max_size.patch Xref: fix_aspect_ratio_with_max_size.patch note: simple absl::optional -> std::optional conversion * chore: update feat_filter_out_non-shareable_windows_in_the_current_application_in.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5272337 * chore: update add_maximized_parameter_to_linuxui_getwindowframeprovider.patch No manual changes; just adjusting line patch offsets Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5258688 * chore: update feat_configure_launch_options_for_service_process.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5281322 * chore: update fix_select_The_first_menu_item_when_opened_via_keyboard.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5279376 note: simple absl::optional -> std::optional conversion * chore: update feat_allow_code_cache_in_custom_schemes.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5268792 * chore: script/export_all_patches.py * chore: bump chromium in DEPS to 123.0.6296.0 * chore: update patches * fixup! chore: update feat_allow_code_cache_in_custom_schemes.patch * fix: restore MessagePort close event * spec: fix CORB testing Refs https://chromium-review.googlesource.com/c/chromium/src/+/5231506 * fix: use sync layout when content view changes * fixup! chore: update feat_configure_launch_options_for_service_process.patch * Add remote-cocoa support for context menus. Refs https://chromium-review.googlesource.com/c/chromium/src/+/5259806 * Rename //net/base/mac directory to //net/base/apple (1/n) Refs https://chromium-review.googlesource.com/c/chromium/src/+/5211389 * fixup! Add remote-cocoa support for context menus. * [Clipboard] Don't add meta charset tag for async write() method on Mac. Refs https://chromium-review.googlesource.com/c/chromium/src/+/5187335 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: clavin <clavin@electronjs.org> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: deepak1556 <hop2deep@gmail.com>
178 lines
8.9 KiB
Diff
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 c32059af794851fdea8aae15157f05acdcc60e0a..92340d0aa8d893fc781ed59cc4aa51b5543de6d9 100644
|
|
--- a/content/browser/renderer_host/navigation_controller_impl_unittest.cc
|
|
+++ b/content/browser/renderer_host/navigation_controller_impl_unittest.cc
|
|
@@ -163,6 +163,12 @@ class MockPageBroadcast : public blink::mojom::PageBroadcast {
|
|
(network::mojom::AttributionSupport support),
|
|
(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 78beefbdd4df3e147e1176668211861cfef0f1b2..7de3ed5e3dfce543671de877cc14d6beac798b94 100644
|
|
--- a/content/browser/renderer_host/render_view_host_impl.cc
|
|
+++ b/content/browser/renderer_host/render_view_host_impl.cc
|
|
@@ -712,6 +712,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 a94977d7a76ae9952bbba0efe59a7cb5021a1c84..11c4f890eaeae1329ca5a6634a698aef7a288fb4 100644
|
|
--- a/content/browser/renderer_host/render_view_host_impl.h
|
|
+++ b/content/browser/renderer_host/render_view_host_impl.h
|
|
@@ -139,6 +139,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 b6dfbd7f7c973ed839df9265b4927ee0a29833d4..0a5dd079fec3a6ab05dc394a2facc9e44446d5e2 100644
|
|
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
|
|
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
|
|
@@ -553,8 +553,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 20ca763ff7f55e8176b77349b41917b11e051ae6..a50c122064b5f0092f57e3d508fb19389b72203b 100644
|
|
--- a/content/public/browser/render_view_host.h
|
|
+++ b/content/public/browser/render_view_host.h
|
|
@@ -75,6 +75,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 603798ae0d45836f1bf3e6608761ce1467303310..2d8caa06e418f123d7565b96d40c66fb51617a6d 100644
|
|
--- a/content/test/test_page_broadcast.h
|
|
+++ b/content/test/test_page_broadcast.h
|
|
@@ -50,6 +50,7 @@ class TestPageBroadcast : public blink::mojom::PageBroadcast {
|
|
network::mojom::AttributionSupport support) override;
|
|
void UpdateColorProviders(
|
|
const blink::ColorProviderColorMaps& color_provider_colors) 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 ed73a6fe6d146eac904f0aa0d88facf055df503e..4bbc792068db75739a7ceb8ad01c85f9d3bbd8f6 100644
|
|
--- a/third_party/blink/public/mojom/page/page.mojom
|
|
+++ b/third_party/blink/public/mojom/page/page.mojom
|
|
@@ -173,4 +173,7 @@ interface PageBroadcast {
|
|
// 2. The ColorProvider associated with the WebContents changes as a result
|
|
// of theme changes.
|
|
UpdateColorProviders(ColorProviderColorMaps color_provider_colors);
|
|
+
|
|
+ // 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 d98282b35beea63c2b8206a86533409da06a6e6b..db62c091239e8cf963ce44081516503fc04efa17 100644
|
|
--- a/third_party/blink/public/web/web_view.h
|
|
+++ b/third_party/blink/public/web/web_view.h
|
|
@@ -379,6 +379,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 4791cc7e62875b053a2e4ed1a969ec1962913457..d276871bddca3300ed607c0446193e3632a56a41 100644
|
|
--- a/third_party/blink/renderer/core/exported/web_view_impl.cc
|
|
+++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
|
|
@@ -2427,6 +2427,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 &&
|
|
@@ -3918,10 +3922,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 0435e8bf952f1a7a6dd4efad7e7cfa453a9eaa7e..382cd1b854bdb95a7ec9586fbe79d6597972892d 100644
|
|
--- a/third_party/blink/renderer/core/exported/web_view_impl.h
|
|
+++ b/third_party/blink/renderer/core/exported/web_view_impl.h
|
|
@@ -453,6 +453,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;
|
|
@@ -927,6 +928,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;
|