Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1723)

Unified Diff: device/power_save_blocker/power_save_blocker_x11.cc

Issue 2631153003: power save blocker: Don't try to block power saving in headless mode (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« device/power_save_blocker/DEPS ('K') | « device/power_save_blocker/DEPS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/power_save_blocker/power_save_blocker_x11.cc
diff --git a/device/power_save_blocker/power_save_blocker_x11.cc b/device/power_save_blocker/power_save_blocker_x11.cc
index 286e042b9bd588f93515a6820beaecace9ee8532..8a781b758fc8bd5525a019a8572416755eb154fd 100644
--- a/device/power_save_blocker/power_save_blocker_x11.cc
+++ b/device/power_save_blocker/power_save_blocker_x11.cc
@@ -32,6 +32,7 @@
#include "dbus/message.h"
#include "dbus/object_path.h"
#include "dbus/object_proxy.h"
+#include "ui/gfx/switches.h"
#include "ui/gfx/x/x11_types.h"
namespace {
@@ -486,6 +487,8 @@ PowerSaveBlocker::PowerSaveBlocker(
blocking_task_runner)),
ui_task_runner_(ui_task_runner),
blocking_task_runner_(blocking_task_runner) {
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kHeadless))
hashimoto 2017/01/17 02:08:12 1. Instead of adding if to the ctor and the dtor,
Sami 2017/01/17 13:44:29 Good idea, done. (Note that I had to do the same t
+ return;
delegate_->Init();
if (type == kPowerSaveBlockPreventDisplaySleep) {
@@ -497,6 +500,8 @@ PowerSaveBlocker::PowerSaveBlocker(
}
PowerSaveBlocker::~PowerSaveBlocker() {
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kHeadless))
+ return;
delegate_->CleanUp();
if (freedesktop_suspend_delegate_)
freedesktop_suspend_delegate_->CleanUp();
« device/power_save_blocker/DEPS ('K') | « device/power_save_blocker/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698