Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(612)

Unified Diff: pdf/timer.h

Issue 2349753003: Improve linearized pdf load/show time. (Closed)
Patch Set: fix review issues. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pdf/timer.h
diff --git a/pdf/timer.h b/pdf/timer.h
new file mode 100644
index 0000000000000000000000000000000000000000..a1db2dd1873aab16686537580b0630277b2c1f77
--- /dev/null
+++ b/pdf/timer.h
@@ -0,0 +1,52 @@
+// 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.
+
+#ifndef PDF_TIMER_H_
+#define PDF_TIMER_H_
+
+#include <set>
+
+#include "base/macros.h"
+#include "ppapi/utility/completion_callback_factory.h"
+
+namespace chrome_pdf {
+
+class Timer {
snake 2016/10/25 13:57:34 base::Timer is not working in pepper plugins. We h
+ public:
+ explicit Timer(int delay);
+ virtual ~Timer();
+
+ virtual void OnTimer() = 0;
+
+ private:
+ friend class TestTimerRunner;
+ void PostCallback();
+ void TimerProc(int32_t result);
+
+ int delay_;
+ pp::CompletionCallbackFactory<Timer> callback_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(Timer);
+};
+
+class TestTimerRunner {
snake 2016/10/25 13:57:34 Ok, I will add this in next CL. :(
+ public:
+ TestTimerRunner();
+ virtual ~TestTimerRunner();
+
+ void RunUntilIdle();
+ void RunScheduled();
+ int scheduled_count() const;
+ void RegisterTimer(Timer* timer);
+ void UnregisterTimer(Timer* timer);
+
+ private:
+ std::set<Timer*> scheduled_timers_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestTimerRunner);
+};
+
+} // namespace chrome_pdf
+
+#endif // PDF_TIMER_H_

Powered by Google App Engine
This is Rietveld 408576698