| Index: pdf/timer.cc
|
| diff --git a/pdf/timer.cc b/pdf/timer.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..067b85a057d575f8cc8cc476419c37064cf928a6
|
| --- /dev/null
|
| +++ b/pdf/timer.cc
|
| @@ -0,0 +1,30 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "pdf/timer.h"
|
| +
|
| +#include "ppapi/cpp/core.h"
|
| +#include "ppapi/cpp/module.h"
|
| +
|
| +namespace chrome_pdf {
|
| +
|
| +Timer::Timer(int delay) : delay_(delay), callback_factory_(this) {
|
| + PostCallback();
|
| +}
|
| +
|
| +Timer::~Timer() {
|
| +}
|
| +
|
| +void Timer::PostCallback() {
|
| + pp::CompletionCallback callback =
|
| + callback_factory_.NewCallback(&Timer::TimerProc);
|
| + pp::Module::Get()->core()->CallOnMainThread(delay_, callback, 0);
|
| +}
|
| +
|
| +void Timer::TimerProc(int32_t /*result*/) {
|
| + PostCallback();
|
| + OnTimer();
|
| +}
|
| +
|
| +} // namespace chrome_pdf
|
|
|