48 lines
2.3 KiB
Diff
48 lines
2.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Cheng Zhao <zcbenz@gmail.com>
|
|
Date: Thu, 20 Sep 2018 17:45:47 -0700
|
|
Subject: disable_hidden.patch
|
|
|
|
Electron uses this to disable background throttling for hidden windows.
|
|
|
|
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
|
|
index 9a9cb5c87829d15b480e9a396ad8d3d1bfb6cd90..f03c14c1aa614b7efc93a627863c3aa03b0e5d45 100644
|
|
--- a/content/browser/renderer_host/render_widget_host_impl.cc
|
|
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
|
|
@@ -754,6 +754,9 @@ void RenderWidgetHostImpl::WasHidden() {
|
|
if (is_hidden_)
|
|
return;
|
|
|
|
+ if (disable_hidden_)
|
|
+ return;
|
|
+
|
|
RejectMouseLockOrUnlockIfNecessary(
|
|
blink::mojom::PointerLockResult::kWrongDocument);
|
|
|
|
diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h
|
|
index bdba3cf07542d494c45ef9167642898b196f06cc..db5eb3b795ab2442058dbf16375f5f132a80a61f 100644
|
|
--- a/content/browser/renderer_host/render_widget_host_impl.h
|
|
+++ b/content/browser/renderer_host/render_widget_host_impl.h
|
|
@@ -855,6 +855,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl
|
|
mojom::CreateFrameWidgetParamsPtr
|
|
BindAndGenerateCreateFrameWidgetParamsForNewWindow();
|
|
|
|
+ // Electron: Prevents the widget from getting hidden.
|
|
+ bool disable_hidden_ = false;
|
|
+
|
|
protected:
|
|
// |routing_id| must not be MSG_ROUTING_NONE.
|
|
// If this object outlives |delegate|, DetachDelegate() must be called when
|
|
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 150b03e368ec3ae0d9b3c8c6eb61e5ca830c1fbc..65cead03331f7680cde35333e7c316fced8a9056 100644
|
|
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
|
|
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
|
|
@@ -594,7 +594,7 @@ void RenderWidgetHostViewAura::HideImpl() {
|
|
DCHECK(visibility_ == Visibility::HIDDEN ||
|
|
visibility_ == Visibility::OCCLUDED);
|
|
|
|
- if (!host()->is_hidden()) {
|
|
+ if (!host()->is_hidden() && !host()->disable_hidden_) {
|
|
host()->WasHidden();
|
|
aura::WindowTreeHost* host = window_->GetHost();
|
|
aura::Window* parent = window_->parent();
|