OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 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 { | |
snake
2016/10/25 13:57:34
base::Timer is not working in pepper plugins. We h
| |
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 { | |
snake
2016/10/25 13:57:34
Ok, I will add this in next CL. :(
| |
34 public: | |
35 TestTimerRunner(); | |
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 |