Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef PDF_TIMER_H_ | |
| 6 #define PDF_TIMER_H_ | |
| 7 | |
| 8 #include <set> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "ppapi/utility/completion_callback_factory.h" | |
| 12 | |
| 13 namespace chrome_pdf { | |
| 14 | |
| 15 class Timer { | |
|
Lei Zhang
2016/10/05 07:18:08
I only see one class inherit from Timer. Is it goi
snake
2016/10/05 14:14:10
I want reuse it in next CLs for PDF plugin.
| |
| 16 public: | |
| 17 explicit Timer(int delay); | |
| 18 virtual ~Timer(); | |
| 19 | |
| 20 virtual void OnTimer() = 0; | |
| 21 | |
| 22 private: | |
| 23 friend class TestTimerRunner; | |
| 24 void PostCallback(); | |
| 25 void TimerProc(int32_t result); | |
| 26 | |
| 27 int delay_; | |
| 28 pp::CompletionCallbackFactory<Timer> callback_factory_; | |
| 29 | |
| 30 DISALLOW_COPY_AND_ASSIGN(Timer); | |
| 31 }; | |
| 32 | |
| 33 class TestTimerRunner { | |
| 34 public: | |
| 35 TestTimerRunner(); | |
|
Lei Zhang
2016/10/05 07:18:08
I don't see this class getting instantiated anywhe
snake
2016/10/05 14:14:10
This will be needs for tests in next CLs.
Lei Zhang
2016/10/21 09:33:08
So can you add this in the next CL, when it is nee
| |
| 36 virtual ~TestTimerRunner(); | |
| 37 | |
| 38 void RunUntilIdle(); | |
| 39 void RunScheduled(); | |
| 40 int scheduled_count() const; | |
| 41 void RegisterTimer(Timer* timer); | |
| 42 void UnregisterTimer(Timer* timer); | |
| 43 | |
| 44 private: | |
| 45 std::set<Timer*> scheduled_timers_; | |
| 46 | |
| 47 DISALLOW_COPY_AND_ASSIGN(TestTimerRunner); | |
| 48 }; | |
| 49 | |
| 50 } // namespace chrome_pdf | |
| 51 | |
| 52 #endif // PDF_TIMER_H_ | |
| OLD | NEW |