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 #include "pdf/timer.h" | |
6 | |
7 #include "ppapi/cpp/core.h" | |
8 #include "ppapi/cpp/module.h" | |
9 | |
10 namespace chrome_pdf { | |
11 | |
12 Timer::Timer(int delay_in_milliseconds) | |
13 : delay_(delay_in_milliseconds), callback_factory_(this) { | |
14 PostCallback(); | |
15 } | |
16 | |
17 Timer::~Timer() { | |
18 } | |
19 | |
20 void Timer::PostCallback() { | |
21 pp::CompletionCallback callback = | |
22 callback_factory_.NewCallback(&Timer::TimerProc); | |
23 pp::Module::Get()->core()->CallOnMainThread(delay_, callback, 0); | |
24 } | |
25 | |
26 void Timer::TimerProc(int32_t /*result*/) { | |
27 PostCallback(); | |
28 OnTimer(); | |
29 } | |
30 | |
31 } // namespace chrome_pdf | |
OLD | NEW |