12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
- From: Cheng Zhao <[email protected]>
- 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 213b7ec788f59b649f19a702063307ad622ef462..69cce8cadec4ca2e5e5a6a17043df70846aa37bb 100644
- --- a/content/browser/renderer_host/render_widget_host_impl.cc
- +++ b/content/browser/renderer_host/render_widget_host_impl.cc
- @@ -814,6 +814,10 @@ void RenderWidgetHostImpl::WasHidden() {
- return;
- }
-
- + if (disable_hidden_) {
- + return;
- + }
- +
- // Cancel pending pointer lock requests, unless there's an open user prompt.
- // Prompts should remain open and functional across tab switches.
- if (!delegate_->IsWaitingForPointerLockPrompt(this)) {
- diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h
- index ba199dfd6445ebb696a8c2fdda17000ac672b5bf..2d0f23b2347f5d420a31c325002fb0f2d830e42f 100644
- --- a/content/browser/renderer_host/render_widget_host_impl.h
- +++ b/content/browser/renderer_host/render_widget_host_impl.h
- @@ -1013,6 +1013,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl
- // Requests a commit and forced redraw in the renderer compositor.
- void ForceRedrawForTesting();
-
- + // 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 eaf23665d72fccbf3cfb368d88418181aaa07285..e2d7bfcc45c6450de38a1dd1a743ac3de61f3d35 100644
- --- a/content/browser/renderer_host/render_widget_host_view_aura.cc
- +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
- @@ -643,7 +643,7 @@ void RenderWidgetHostViewAura::HideImpl() {
- CHECK(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();
|