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

Side by Side Diff: base/timer/hi_res_timer_manager_win.cc

Issue 18063004: Move timing files into base/time, install forwarding headers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ios Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/timer/hi_res_timer_manager_unittest.cc ('k') | base/timer/timer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/hi_res_timer_manager.h" 5 #include "base/timer/hi_res_timer_manager.h"
6 6
7 #include "base/power_monitor/power_monitor.h" 7 #include "base/power_monitor/power_monitor.h"
8 #include "base/time.h" 8 #include "base/time/time.h"
9
10 namespace base {
9 11
10 HighResolutionTimerManager::HighResolutionTimerManager() 12 HighResolutionTimerManager::HighResolutionTimerManager()
11 : hi_res_clock_available_(false) { 13 : hi_res_clock_available_(false) {
12 base::PowerMonitor* power_monitor = base::PowerMonitor::Get(); 14 base::PowerMonitor* power_monitor = base::PowerMonitor::Get();
13 power_monitor->AddObserver(this); 15 power_monitor->AddObserver(this);
14 UseHiResClock(!power_monitor->BatteryPower()); 16 UseHiResClock(!power_monitor->BatteryPower());
15 } 17 }
16 18
17 HighResolutionTimerManager::~HighResolutionTimerManager() { 19 HighResolutionTimerManager::~HighResolutionTimerManager() {
18 base::PowerMonitor::Get()->RemoveObserver(this); 20 base::PowerMonitor::Get()->RemoveObserver(this);
19 UseHiResClock(false); 21 UseHiResClock(false);
20 } 22 }
21 23
22 void HighResolutionTimerManager::OnPowerStateChange(bool on_battery_power) { 24 void HighResolutionTimerManager::OnPowerStateChange(bool on_battery_power) {
23 UseHiResClock(!on_battery_power); 25 UseHiResClock(!on_battery_power);
24 } 26 }
25 27
26 void HighResolutionTimerManager::UseHiResClock(bool use) { 28 void HighResolutionTimerManager::UseHiResClock(bool use) {
27 if (use == hi_res_clock_available_) 29 if (use == hi_res_clock_available_)
28 return; 30 return;
29 hi_res_clock_available_ = use; 31 hi_res_clock_available_ = use;
30 base::Time::EnableHighResolutionTimer(use); 32 base::Time::EnableHighResolutionTimer(use);
31 } 33 }
34
35 } // namespace base
OLDNEW
« no previous file with comments | « base/timer/hi_res_timer_manager_unittest.cc ('k') | base/timer/timer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698