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) : delay_(delay), callback_factory_(this) { |
| 13 PostCallback(); |
| 14 } |
| 15 |
| 16 Timer::~Timer() { |
| 17 } |
| 18 |
| 19 void Timer::PostCallback() { |
| 20 pp::CompletionCallback callback = |
| 21 callback_factory_.NewCallback(&Timer::TimerProc); |
| 22 pp::Module::Get()->core()->CallOnMainThread(delay_, callback, 0); |
| 23 } |
| 24 |
| 25 void Timer::TimerProc(int32_t /*result*/) { |
| 26 PostCallback(); |
| 27 OnTimer(); |
| 28 } |
| 29 |
| 30 } // namespace chrome_pdf |
OLD | NEW |