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

Side by Side Diff: chrome/common/worker_thread_ticker.cc

Issue 9215005: Revert 117824 - Convert use of int ms to TimeDelta in files owned by brettw. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/worker_thread_ticker.h ('k') | chrome/common/worker_thread_ticker_unittest.cc » ('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) 2012 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 "chrome/common/worker_thread_ticker.h" 5 #include "chrome/common/worker_thread_ticker.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/threading/thread.h" 13 #include "base/threading/thread.h"
14 14
15 WorkerThreadTicker::WorkerThreadTicker(int tick_interval) 15 WorkerThreadTicker::WorkerThreadTicker(int tick_interval)
16 : timer_thread_("worker_thread_ticker"), 16 : timer_thread_("worker_thread_ticker"),
17 is_running_(false), 17 is_running_(false),
18 tick_interval_(base::TimeDelta::FromMilliseconds(tick_interval)) { 18 tick_interval_(tick_interval) {
19 } 19 }
20 20
21 WorkerThreadTicker::~WorkerThreadTicker() { 21 WorkerThreadTicker::~WorkerThreadTicker() {
22 Stop(); 22 Stop();
23 } 23 }
24 24
25 bool WorkerThreadTicker::RegisterTickHandler(Callback *tick_handler) { 25 bool WorkerThreadTicker::RegisterTickHandler(Callback *tick_handler) {
26 DCHECK(tick_handler); 26 DCHECK(tick_handler);
27 base::AutoLock lock(lock_); 27 base::AutoLock lock(lock_);
28 // You cannot change the list of handlers when the timer is running. 28 // You cannot change the list of handlers when the timer is running.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // So we can do the enumeration safely without a lock 87 // So we can do the enumeration safely without a lock
88 const TickHandlerListType& handlers = tick_handler_list_; 88 const TickHandlerListType& handlers = tick_handler_list_;
89 for (TickHandlerListType::const_iterator i = handlers.begin(); 89 for (TickHandlerListType::const_iterator i = handlers.begin();
90 i != handlers.end(); ++i) { 90 i != handlers.end(); ++i) {
91 (*i)->OnTick(); 91 (*i)->OnTick();
92 } 92 }
93 93
94 ScheduleTimerTask(); 94 ScheduleTimerTask();
95 } 95 }
96 96
OLDNEW
« no previous file with comments | « chrome/common/worker_thread_ticker.h ('k') | chrome/common/worker_thread_ticker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698