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

Side by Side Diff: app/hi_res_timer_manager_win.cc

Issue 2822035: Change chrome from statically enabling high resolution timers on windows... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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 | « no previous file | base/message_loop.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "app/hi_res_timer_manager.h" 5 #include "app/hi_res_timer_manager.h"
6 6
7 #include "base/time.h" 7 #include "base/time.h"
8 8
9 HighResolutionTimerManager::HighResolutionTimerManager() 9 HighResolutionTimerManager::HighResolutionTimerManager()
10 : hi_res_clock_used_(false) { 10 : hi_res_clock_used_(false) {
11 SystemMonitor* system_monitor = SystemMonitor::Get(); 11 SystemMonitor* system_monitor = SystemMonitor::Get();
12 system_monitor->AddObserver(this); 12 system_monitor->AddObserver(this);
13 UseHiResClock(!system_monitor->BatteryPower()); 13 UseHiResClock(!system_monitor->BatteryPower());
14 } 14 }
15 15
16 HighResolutionTimerManager::~HighResolutionTimerManager() { 16 HighResolutionTimerManager::~HighResolutionTimerManager() {
17 SystemMonitor::Get()->RemoveObserver(this); 17 SystemMonitor::Get()->RemoveObserver(this);
18 UseHiResClock(false); 18 UseHiResClock(false);
19 } 19 }
20 20
21 void HighResolutionTimerManager::OnPowerStateChange(bool on_battery_power) { 21 void HighResolutionTimerManager::OnPowerStateChange(bool on_battery_power) {
22 UseHiResClock(!on_battery_power); 22 UseHiResClock(!on_battery_power);
23 } 23 }
24 24
25 void HighResolutionTimerManager::UseHiResClock(bool use) { 25 void HighResolutionTimerManager::UseHiResClock(bool use) {
26 if (use == hi_res_clock_used_) 26 if (use == hi_res_clock_used_)
27 return; 27 return;
28 bool result = base::Time::UseHighResolutionTimer(use); 28 base::Time::EnableHighResolutionTimer(use);
29 DCHECK(result);
30 hi_res_clock_used_ = use;
31 } 29 }
OLDNEW
« no previous file with comments | « no previous file | base/message_loop.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698