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 "base/macros.h" | |
9 #include "ppapi/utility/completion_callback_factory.h" | |
10 | |
11 namespace chrome_pdf { | |
12 | |
13 // Timer implementation for pepper plugins, based on pp::Core::CallOnMainThread. | |
14 // We can not use base::Timer for plugins, because they have no | |
15 // base::MessageLoop, on which it is based. | |
16 class Timer { | |
17 public: | |
18 explicit Timer(int delay_in_milliseconds); | |
19 virtual ~Timer(); | |
20 | |
21 virtual void OnTimer() = 0; | |
22 | |
23 private: | |
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 } // namespace chrome_pdf | |
34 | |
35 #endif // PDF_TIMER_H_ | |
OLD | NEW |