OLD | NEW |
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 #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 |
11 #include "base/lock.h" | 11 #include "base/lock.h" |
12 #include "base/thread.h" | 12 #include "base/threading/thread.h" |
13 | 13 |
14 // This class provides the following functionality: | 14 // This class provides the following functionality: |
15 // It invokes a set of registered handlers at periodic intervals in | 15 // It invokes a set of registered handlers at periodic intervals in |
16 // the context of an arbitrary worker thread. | 16 // the context of an arbitrary worker thread. |
17 // The timer runs on a separate thread, so it will run even if the current | 17 // The timer runs on a separate thread, so it will run even if the current |
18 // thread is hung. Similarly, the callbacks will be called on a separate | 18 // thread is hung. Similarly, the callbacks will be called on a separate |
19 // thread so they won't block the main thread. | 19 // thread so they won't block the main thread. |
20 class WorkerThreadTicker { | 20 class WorkerThreadTicker { |
21 public: | 21 public: |
22 // This callback interface to be implemented by clients of this | 22 // This callback interface to be implemented by clients of this |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 int 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_ |
OLD | NEW |