| OLD | NEW |
| 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 #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/task.h" | |
| 14 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
| 15 | 14 |
| 16 WorkerThreadTicker::WorkerThreadTicker(int tick_interval) | 15 WorkerThreadTicker::WorkerThreadTicker(int tick_interval) |
| 17 : timer_thread_("worker_thread_ticker"), | 16 : timer_thread_("worker_thread_ticker"), |
| 18 is_running_(false), | 17 is_running_(false), |
| 19 tick_interval_(tick_interval) { | 18 tick_interval_(tick_interval) { |
| 20 } | 19 } |
| 21 | 20 |
| 22 WorkerThreadTicker::~WorkerThreadTicker() { | 21 WorkerThreadTicker::~WorkerThreadTicker() { |
| 23 Stop(); | 22 Stop(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // So we can do the enumeration safely without a lock | 87 // So we can do the enumeration safely without a lock |
| 89 const TickHandlerListType& handlers = tick_handler_list_; | 88 const TickHandlerListType& handlers = tick_handler_list_; |
| 90 for (TickHandlerListType::const_iterator i = handlers.begin(); | 89 for (TickHandlerListType::const_iterator i = handlers.begin(); |
| 91 i != handlers.end(); ++i) { | 90 i != handlers.end(); ++i) { |
| 92 (*i)->OnTick(); | 91 (*i)->OnTick(); |
| 93 } | 92 } |
| 94 | 93 |
| 95 ScheduleTimerTask(); | 94 ScheduleTimerTask(); |
| 96 } | 95 } |
| 97 | 96 |
| OLD | NEW |