From 16d23bbda55059cbbcbb14f3ca995e4407c1cd8e Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 7 Jan 2016 12:28:20 +0800 Subject: [PATCH] Remove pageVisibility option The original purpose of this option is not working anymore, also adds docs on the current way to disable process backgrounding. --- atom/browser/web_contents_preferences.cc | 2 -- atom/common/options_switches.cc | 4 ---- atom/common/options_switches.h | 2 -- atom/renderer/atom_renderer_client.cc | 13 ------------- atom/renderer/atom_renderer_client.h | 3 --- docs/api/browser-window.md | 4 ---- docs/api/chrome-command-line-switches.md | 20 +++++++++++++++----- 7 files changed, 15 insertions(+), 33 deletions(-) diff --git a/atom/browser/web_contents_preferences.cc b/atom/browser/web_contents_preferences.cc index 0c20551..92b89de 100644 --- a/atom/browser/web_contents_preferences.cc +++ b/atom/browser/web_contents_preferences.cc @@ -34,8 +34,6 @@ FeaturePair kWebRuntimeFeatures[] = { switches::kExperimentalFeatures }, { options::kExperimentalCanvasFeatures, switches::kExperimentalCanvasFeatures }, - { options::kPageVisibility, - switches::kPageVisibility }, }; } // namespace diff --git a/atom/common/options_switches.cc b/atom/common/options_switches.cc index b87f10a..776113c 100644 --- a/atom/common/options_switches.cc +++ b/atom/common/options_switches.cc @@ -85,9 +85,6 @@ const char kNodeIntegration[] = "nodeIntegration"; // Instancd ID of guest WebContents. const char kGuestInstanceID[] = "guestInstanceId"; -// Set page visiblity to always visible. -const char kPageVisibility[] = "pageVisibility"; - // Enable DirectWrite on Windows. const char kDirectWrite[] = "directWrite"; @@ -141,7 +138,6 @@ const char kNodeIntegration[] = "node-integration"; const char kGuestInstanceID[] = "guest-instance-id"; const char kExperimentalFeatures[] = "experimental-features"; const char kExperimentalCanvasFeatures[] = "experimental-canvas-features"; -const char kPageVisibility[] = "page-visiblity"; const char kOpenerID[] = "opener-id"; // Widevine options diff --git a/atom/common/options_switches.h b/atom/common/options_switches.h index 7052acb..f22d35d 100644 --- a/atom/common/options_switches.h +++ b/atom/common/options_switches.h @@ -49,7 +49,6 @@ extern const char kNodeIntegration[]; extern const char kGuestInstanceID[]; extern const char kExperimentalFeatures[]; extern const char kExperimentalCanvasFeatures[]; -extern const char kPageVisibility[]; extern const char kOpenerID[]; } // namespace options @@ -77,7 +76,6 @@ extern const char kNodeIntegration[]; extern const char kGuestInstanceID[]; extern const char kExperimentalFeatures[]; extern const char kExperimentalCanvasFeatures[]; -extern const char kPageVisibility[]; extern const char kOpenerID[]; extern const char kWidevineCdmPath[]; diff --git a/atom/renderer/atom_renderer_client.cc b/atom/renderer/atom_renderer_client.cc index bae49bf..31336f3 100644 --- a/atom/renderer/atom_renderer_client.cc +++ b/atom/renderer/atom_renderer_client.cc @@ -210,19 +210,6 @@ content::BrowserPluginDelegate* AtomRendererClient::CreateBrowserPluginDelegate( } } -bool AtomRendererClient::ShouldOverridePageVisibilityState( - const content::RenderFrame* render_frame, - blink::WebPageVisibilityState* override_state) { - base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - - if (IsSwitchEnabled(command_line, switches::kPageVisibility)) { - *override_state = blink::WebPageVisibilityStateVisible; - return true; - } - - return false; -} - void AtomRendererClient::EnableWebRuntimeFeatures() { base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); diff --git a/atom/renderer/atom_renderer_client.h b/atom/renderer/atom_renderer_client.h index ee082e9..d99e83f 100644 --- a/atom/renderer/atom_renderer_client.h +++ b/atom/renderer/atom_renderer_client.h @@ -56,9 +56,6 @@ class AtomRendererClient : public content::ContentRendererClient, content::RenderFrame* render_frame, const std::string& mime_type, const GURL& original_url) override; - bool ShouldOverridePageVisibilityState( - const content::RenderFrame* render_frame, - blink::WebPageVisibilityState* override_state) override; void AddKeySystems(std::vector* key_systems) override; void EnableWebRuntimeFeatures(); diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index b6a4631..6dc5257 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -138,10 +138,6 @@ It creates a new `BrowserWindow` with native properties as set by the `options`. canvas features. Default is `false`. * `directWrite` Boolean - Enables DirectWrite font rendering system on Windows. Default is `true`. - * `pageVisibility` Boolean - Page would be forced to be always in visible - or hidden state once set, instead of reflecting current window's - visibility. Users can set it to `true` to prevent throttling of DOM - timers. Default is `false`. ## Events diff --git a/docs/api/chrome-command-line-switches.md b/docs/api/chrome-command-line-switches.md index 798d756..65f096e 100644 --- a/docs/api/chrome-command-line-switches.md +++ b/docs/api/chrome-command-line-switches.md @@ -94,10 +94,6 @@ connection, and the endpoint host in a `SOCKS` proxy connection). Like `--host-rules` but these `rules` only apply to the host resolver. -[app]: app.md -[append-switch]: app.md#appcommandlineappendswitchswitch-value -[ready]: app.md#event-ready - ## --ignore-certificate-errors Ignores certificate related errors. @@ -121,7 +117,16 @@ fallback will accept. ## --cipher-suite-blacklist=`cipher_suites` -Specify comma-separated list of SSL cipher suites to disable. +Specifies comma-separated list of SSL cipher suites to disable. + +## --disable-renderer-backgrounding + +Prevents Chromium from lowering the priority of invisible pages' renderer +processes. + +This flag is global to all renderer processes, if you only want to disable +throttling in one window, you can take the hack of +[playing silent audio][play-silent-audio]. ## --enable-logging @@ -149,3 +154,8 @@ whole pathname and not just the module. E.g. `*/foo/bar/*=2` would change the logging level for all code in the source files under a `foo/bar` directory. This switch only works when `--enable-logging` is also passed. + +[app]: app.md +[append-switch]: app.md#appcommandlineappendswitchswitch-value +[ready]: app.md#event-ready +[play-silent-audio]: https://github.com/atom/atom/pull/9485/files -- 2.7.4