mirror of
https://github.com/electron/electron.git
synced 2026-01-09 15:38:08 -05:00
* chore: bump chromium in DEPS to 144.0.7507.0
* chore: bump chromium in DEPS to 144.0.7508.0
* chore: update patches
* 7101838: [pathbuilder] Enforce immutable SkPath APIs globally
https://chromium-review.googlesource.com/c/chromium/src/+/7101838
* chore: update filenames.libcxx.gni
* [pathbuilder] Enforce immutable SkPath APIs globally
https://chromium-review.googlesource.com/c/chromium/src/+/7101838
* Reduce service_worker_info.h includes in headers
https://chromium-review.googlesource.com/c/chromium/src/+/7108401
* chore: bump chromium in DEPS to 144.0.7510.0
* chore: update patches
* Use internal popup menus for tabs in actor-controlled states
https://chromium-review.googlesource.com/c/chromium/src/+/7074751
* [api] Delete deprecated fields on v8::Isolate
https://chromium-review.googlesource.com/c/v8/v8/+/7081397
xref: 98d243aea0
* Fixup Reduce service_worker_info.h includes in headers
* Promote deprecation of v8::Context and v8::Object API methods
https://chromium-review.googlesource.com/c/v8/v8/+/7087956
* fixup Promote deprecation of v8::Context and v8::Object API methods
* chore: bump chromium in DEPS to 144.0.7512.1
* chore: update patches
* fixup [pathbuilder] Enforce immutable SkPath APIs global
* chore: update filenames.hunspell.gni
* fix deprecation of v8::Context and v8::Object API methods for nan
https://chromium-review.googlesource.com/c/v8/v8/+/7087956
* [PDF] Implement PdfHelpBubbleHandlerFactory
https://chromium-review.googlesource.com/c/chromium/src/+/7056325
also: [PDF Ink Signatures] Hook up IPH
https://chromium-review.googlesource.com/c/chromium/src/+/7056207
* Remove base/hash/md5.h
https://chromium-review.googlesource.com/c/chromium/src/+/7113738
* fixup for lint
* Remove deprecated interceptor callback types and AccessControl enum
https://chromium-review.googlesource.com/c/v8/v8/+/7112747
* fixup for lint
* fixup [PDF] Implement PdfHelpBubbleHandlerFactory
* use base::SHA1HashString instead of std::hash
---------
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
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 5765fe8264ecf117d68cdc2c95517f2fcc22715f..37a734f120427571cf5f4f7b6b6eabb881ba59cb 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 357dc106e4c53122e87ea09a780f7976ad37f25e..5209b85dc285f5e177377bd06e36b8b175581cbb 100644
|
|
--- a/content/browser/renderer_host/render_view_host_impl.cc
|
|
+++ b/content/browser/renderer_host/render_view_host_impl.cc
|
|
@@ -767,6 +767,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 7944fe64e0da112fc670358b75506bb199bb5e4a..0e3c16c6af2a078943e9f39808134ab20c115e99 100644
|
|
--- a/content/browser/renderer_host/render_view_host_impl.h
|
|
+++ b/content/browser/renderer_host/render_view_host_impl.h
|
|
@@ -136,6 +136,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 84899b5208f036bd58ba51513820404b6c5a24b9..87fd5aa4fab7ddd0b444a3c8473ae35066c87054 100644
|
|
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
|
|
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
|
|
@@ -632,8 +632,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 7f995dc1fab7a1b5319f6fe9bb4d37b3851dbf87..58c93c5acf9f63eb3391fafe2904b20284381a85 100644
|
|
--- a/third_party/blink/public/web/web_view.h
|
|
+++ b/third_party/blink/public/web/web_view.h
|
|
@@ -361,6 +361,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 48a7bc14663edceaca00a397e528c50a96f7613f..1ba451388e2c8a702a3709d82456c32e6423c9b0 100644
|
|
--- a/third_party/blink/renderer/core/exported/web_view_impl.cc
|
|
+++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
|
|
@@ -2511,6 +2511,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 &&
|
|
@@ -4021,10 +4025,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 973f9acb6186a24aeb6343ac4d868883e98cdf52..a3860649929fc0cff9680191ed9367fc68462fd3 100644
|
|
--- a/third_party/blink/renderer/core/exported/web_view_impl.h
|
|
+++ b/third_party/blink/renderer/core/exported/web_view_impl.h
|
|
@@ -447,6 +447,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;
|
|
@@ -941,6 +942,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;
|