From aefd99ec7fcbef8d8013c0e451fb5b4552fbf3b5 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 3 Aug 2016 10:40:12 +0900 Subject: [PATCH] Only enable kEnableBeginFrameScheduling for offscreen It has effects on performance and only gets turned on after Chrome 54. --- atom/browser/web_contents_preferences.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/atom/browser/web_contents_preferences.cc b/atom/browser/web_contents_preferences.cc index fb28a79dd37..49a42a3ee12 100644 --- a/atom/browser/web_contents_preferences.cc +++ b/atom/browser/web_contents_preferences.cc @@ -187,7 +187,11 @@ void WebContentsPreferences::AppendExtraCommandLineSwitches( command_line->AppendSwitch("hidden-page"); } - command_line->AppendSwitch(cc::switches::kEnableBeginFrameScheduling); + // Use frame scheduling for offscreen renderers. + // TODO(zcbenz): Remove this after Chrome 54, on which it becomes default. + bool offscreen; + if (web_preferences.Get("offscreen", &offscreen) && offscreen) + command_line->AppendSwitch(cc::switches::kEnableBeginFrameScheduling); } // static