summaryrefslogtreecommitdiffstats
path: root/base/hi_res_timer_manager_win.cc
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-04 19:33:56 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-04 19:33:56 +0000
commitb3aabd34198e0e62cd1ca2134200c6a948560ca6 (patch)
tree19744277f82538d11c45001b31ab3d20420f8f69 /base/hi_res_timer_manager_win.cc
parent3167bd4f7389abfc5ff4010f09c4b6045b8e8311 (diff)
downloadchromium_src-b3aabd34198e0e62cd1ca2134200c6a948560ca6.zip
chromium_src-b3aabd34198e0e62cd1ca2134200c6a948560ca6.tar.gz
chromium_src-b3aabd34198e0e62cd1ca2134200c6a948560ca6.tar.bz2
Tighten up DEPS some more. NaCl/service process code are including internal content files. Fix the instances other sandbox stuff, which I'll do in a followup.
BUG=98716 Review URL: https://chromiumcodereview.appspot.com/10512010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140346 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/hi_res_timer_manager_win.cc')
-rw-r--r--base/hi_res_timer_manager_win.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/base/hi_res_timer_manager_win.cc b/base/hi_res_timer_manager_win.cc
new file mode 100644
index 0000000..1a92394
--- /dev/null
+++ b/base/hi_res_timer_manager_win.cc
@@ -0,0 +1,30 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/hi_res_timer_manager.h"
+
+#include "base/time.h"
+
+HighResolutionTimerManager::HighResolutionTimerManager()
+ : hi_res_clock_available_(false) {
+ base::SystemMonitor* system_monitor = base::SystemMonitor::Get();
+ system_monitor->AddPowerObserver(this);
+ UseHiResClock(!system_monitor->BatteryPower());
+}
+
+HighResolutionTimerManager::~HighResolutionTimerManager() {
+ base::SystemMonitor::Get()->RemovePowerObserver(this);
+ UseHiResClock(false);
+}
+
+void HighResolutionTimerManager::OnPowerStateChange(bool on_battery_power) {
+ UseHiResClock(!on_battery_power);
+}
+
+void HighResolutionTimerManager::UseHiResClock(bool use) {
+ if (use == hi_res_clock_available_)
+ return;
+ hi_res_clock_available_ = use;
+ base::Time::EnableHighResolutionTimer(use);
+}