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

Issue 3848002: Fix regression where high resolution timers could be activated even under... (Closed)

Created:
10 years, 2 months ago by Mike Belshe
Modified:
9 years, 5 months ago
CC:
chromium-reviews, Paweł Hajdan Jr., brettw-cc_chromium.org
Visibility:
Public.

Description

Fix regression where high resolution timers could be activated even under battery power. Add unit test to protect chromium from developers like me in the future. The fix is a one-liner in hi_res_timer_manager_win.cc. The rest of the code change is the mechanics to enable the unit test. BUG=59528 TEST=HiResTimerManagerTest.ToggleOnOff Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=63176

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Total comments: 6

Patch Set 4 : '' #

Patch Set 5 : change from count to boolean for activation of timers #

Patch Set 6 : counter is better #

Total comments: 3

Patch Set 7 : reduce calls to timeBegin/timeEnd by tracking state #

Patch Set 8 : reduce calls to timeBegin/timeEnd by tracking state #

Patch Set 9 : nonono - fix thread safety problem, simplify! #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+99 lines, -8 lines) Patch
M app/app.gyp View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M app/hi_res_timer_manager.h View 1 2 3 1 chunk +3 lines, -0 lines 0 comments Download
A app/hi_res_timer_manager_unittest.cc View 1 2 3 4 5 6 7 8 1 chunk +51 lines, -0 lines 1 comment Download
M app/hi_res_timer_manager_win.cc View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M base/message_loop.cc View 1 2 3 4 5 6 2 chunks +14 lines, -3 lines 1 comment Download
M base/time.h View 1 2 3 4 5 6 7 8 2 chunks +10 lines, -1 line 1 comment Download
M base/time_win.cc View 1 2 3 4 5 6 7 8 2 chunks +19 lines, -4 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
Mike Belshe
10 years, 2 months ago (2010-10-18 01:36:00 UTC) #1
jar (doing other things)
One real sematic/api question, and two nits below. http://codereview.chromium.org/3848002/diff/16001/17002 File app/hi_res_timer_manager.h (right): http://codereview.chromium.org/3848002/diff/16001/17002#newcode22 app/hi_res_timer_manager.h:22: bool ...
10 years, 2 months ago (2010-10-18 06:34:16 UTC) #2
Mike Belshe
http://codereview.chromium.org/3848002/diff/16001/17002 File app/hi_res_timer_manager.h (right): http://codereview.chromium.org/3848002/diff/16001/17002#newcode22 app/hi_res_timer_manager.h:22: bool using_hi_res_clock() { return hi_res_clock_used_; } On 2010/10/18 06:34:17, ...
10 years, 2 months ago (2010-10-18 21:29:12 UTC) #3
jar (doing other things)
http://codereview.chromium.org/3848002/diff/17008/2004 File app/hi_res_timer_manager_unittest.cc (right): http://codereview.chromium.org/3848002/diff/17008/2004#newcode37 app/hi_res_timer_manager_unittest.cc:37: You should have another test where you try to ...
10 years, 2 months ago (2010-10-18 23:35:25 UTC) #4
Mike Belshe
Ok - lots of iterations through the weeds and back to sanity. The message loop ...
10 years, 2 months ago (2010-10-19 22:48:41 UTC) #5
jar (doing other things)
10 years, 2 months ago (2010-10-20 00:37:18 UTC) #6
LGTM (with nits below)

http://codereview.chromium.org/3848002/diff/54001/55003
File app/hi_res_timer_manager_unittest.cc (right):

http://codereview.chromium.org/3848002/diff/54001/55003#newcode28
app/hi_res_timer_manager_unittest.cc:28:
EXPECT_TRUE(manager.using_hi_res_clock());
nit: Suggest rename:

hi_res_clock_allowable

http://codereview.chromium.org/3848002/diff/54001/55005
File base/message_loop.cc (right):

http://codereview.chromium.org/3848002/diff/54001/55005#newcode363
base/message_loop.cc:363: if (base::TimeTicks::Now() >
high_resolution_timer_expiration_) {
This will work.... but for all your effort to avoid taking a lock, Now() will
take a lock :-/. 

It would be better to put this down in the timer event handling code, but that
is a more complex change :-(.  I'm working on such a change (for other
appearances of Now() in the message loop), and that should probably be enhanced
to include this "timer event" (or perhaps we should post a delayed event to
handle this, and let it go down the standard track).

http://codereview.chromium.org/3848002/diff/54001/55006
File base/time.h (right):

http://codereview.chromium.org/3848002/diff/54001/55006#newcode415
base/time.h:415: // in a thread safe way.
Please add to comment:
...and used ONLY by tests which are running single threaded.

Powered by Google App Engine
This is Rietveld 408576698