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

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

Issue 9185026: Convert use of int ms to TimeDelta in files owned by brettw. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Explicitly include base/time.h in header file. 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
« no previous file with comments | « chrome/common/service_process_util_unittest.cc ('k') | chrome/common/worker_thread_ticker.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) 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 #ifndef CHROME_COMMON_WORKER_THREAD_TICKER_H_ 5 #ifndef CHROME_COMMON_WORKER_THREAD_TICKER_H_
6 #define CHROME_COMMON_WORKER_THREAD_TICKER_H_ 6 #define CHROME_COMMON_WORKER_THREAD_TICKER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // Stops the ticker and waits for all callbacks. to be done. This method 51 // Stops the ticker and waits for all callbacks. to be done. This method
52 // does not provide a way to stop without waiting for the callbacks to be 52 // does not provide a way to stop without waiting for the callbacks to be
53 // done because this is inherently risky. 53 // done because this is inherently risky.
54 // Returns false is the ticker is not running 54 // Returns false is the ticker is not running
55 bool Stop(); 55 bool Stop();
56 bool IsRunning() const { 56 bool IsRunning() const {
57 return is_running_; 57 return is_running_;
58 } 58 }
59 59
60 void set_tick_interval(int tick_interval) { 60 void set_tick_interval(int tick_interval) {
61 tick_interval_ = tick_interval; 61 tick_interval_ = base::TimeDelta::FromMilliseconds(tick_interval);
62 } 62 }
63 63
64 int tick_interval() const { 64 int tick_interval() const {
65 return tick_interval_; 65 return tick_interval_.InMilliseconds();
66 } 66 }
67 67
68 private: 68 private:
69 void ScheduleTimerTask(); 69 void ScheduleTimerTask();
70 70
71 void TimerTask(); 71 void TimerTask();
72 72
73 // A list type that holds all registered callback interfaces 73 // A list type that holds all registered callback interfaces
74 typedef std::vector<Callback*> TickHandlerListType; 74 typedef std::vector<Callback*> TickHandlerListType;
75 75
76 // Lock to protect is_running_ and tick_handler_list_ 76 // Lock to protect is_running_ and tick_handler_list_
77 base::Lock lock_; 77 base::Lock lock_;
78 78
79 base::Thread timer_thread_; 79 base::Thread timer_thread_;
80 bool is_running_; 80 bool is_running_;
81 81
82 // The interval at which the callbacks are to be invoked 82 // The interval at which the callbacks are to be invoked
83 int tick_interval_; 83 base::TimeDelta tick_interval_;
84 84
85 // A list that holds all registered callback interfaces 85 // A list that holds all registered callback interfaces
86 TickHandlerListType tick_handler_list_; 86 TickHandlerListType tick_handler_list_;
87 87
88 DISALLOW_COPY_AND_ASSIGN(WorkerThreadTicker); 88 DISALLOW_COPY_AND_ASSIGN(WorkerThreadTicker);
89 }; 89 };
90 90
91 #endif // CHROME_COMMON_WORKER_THREAD_TICKER_H_ 91 #endif // CHROME_COMMON_WORKER_THREAD_TICKER_H_
OLDNEW
« no previous file with comments | « chrome/common/service_process_util_unittest.cc ('k') | chrome/common/worker_thread_ticker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698