summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/platform/default/glfw_view.hpp5
-rw-r--r--include/mbgl/util/timer.hpp29
2 files changed, 34 insertions, 0 deletions
diff --git a/include/mbgl/platform/default/glfw_view.hpp b/include/mbgl/platform/default/glfw_view.hpp
index ae5bf340d5..802f61b0c0 100644
--- a/include/mbgl/platform/default/glfw_view.hpp
+++ b/include/mbgl/platform/default/glfw_view.hpp
@@ -2,6 +2,8 @@
#define MBGL_COMMON_GLFW_VIEW
#include <mbgl/mbgl.hpp>
+#include <mbgl/util/run_loop.hpp>
+#include <mbgl/util/timer.hpp>
#ifdef MBGL_USE_GLES2
#define GLFW_INCLUDE_ES2
@@ -92,6 +94,9 @@ private:
std::function<void()> changeStyleCallback;
+ mbgl::util::RunLoop runLoop;
+ mbgl::util::Timer frameTick;
+
GLFWwindow *window = nullptr;
std::atomic_flag clean = ATOMIC_FLAG_INIT;
};
diff --git a/include/mbgl/util/timer.hpp b/include/mbgl/util/timer.hpp
new file mode 100644
index 0000000000..783241847d
--- /dev/null
+++ b/include/mbgl/util/timer.hpp
@@ -0,0 +1,29 @@
+#ifndef MBGL_UTIL_TIMER
+#define MBGL_UTIL_TIMER
+
+#include <mbgl/util/noncopyable.hpp>
+#include <mbgl/util/chrono.hpp>
+
+#include <memory>
+#include <functional>
+
+namespace mbgl {
+namespace util {
+
+class Timer : private util::noncopyable {
+public:
+ Timer();
+ ~Timer();
+
+ void start(Duration timeout, Duration repeat, std::function<void()>&&);
+ void stop();
+
+private:
+ class Impl;
+ std::unique_ptr<Impl> impl;
+};
+
+} // namespace util
+} // namespace mbgl
+
+#endif