diff options
-rw-r--r-- | cmake/core-files.cmake | 2 | ||||
-rw-r--r-- | src/mbgl/tile/geometry_tile.hpp | 1 | ||||
-rw-r--r-- | src/mbgl/util/throttler.cpp | 36 | ||||
-rw-r--r-- | src/mbgl/util/throttler.hpp | 22 |
4 files changed, 0 insertions, 61 deletions
diff --git a/cmake/core-files.cmake b/cmake/core-files.cmake index d4fec34bf5..0474de4680 100644 --- a/cmake/core-files.cmake +++ b/cmake/core-files.cmake @@ -748,8 +748,6 @@ set(MBGL_CORE_FILES src/mbgl/util/stopwatch.hpp src/mbgl/util/string.cpp src/mbgl/util/thread_local.hpp - src/mbgl/util/throttler.cpp - src/mbgl/util/throttler.hpp src/mbgl/util/tile_coordinate.hpp src/mbgl/util/tile_cover.cpp src/mbgl/util/tile_cover.hpp diff --git a/src/mbgl/tile/geometry_tile.hpp b/src/mbgl/tile/geometry_tile.hpp index d0490f1009..af122474c2 100644 --- a/src/mbgl/tile/geometry_tile.hpp +++ b/src/mbgl/tile/geometry_tile.hpp @@ -5,7 +5,6 @@ #include <mbgl/renderer/image_manager.hpp> #include <mbgl/text/glyph_manager.hpp> #include <mbgl/util/feature.hpp> -#include <mbgl/util/throttler.hpp> #include <mbgl/actor/actor.hpp> #include <mbgl/geometry/feature_index.hpp> diff --git a/src/mbgl/util/throttler.cpp b/src/mbgl/util/throttler.cpp deleted file mode 100644 index 910810ce2f..0000000000 --- a/src/mbgl/util/throttler.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include <mbgl/util/throttler.hpp> - -namespace mbgl { -namespace util { - -Throttler::Throttler(Duration frequency_, std::function<void()>&& function_) - : frequency(frequency_) - , function(std::move(function_)) - , pendingInvocation(false) - , lastInvocation(TimePoint::min()) -{} - -void Throttler::invoke() { - if (pendingInvocation) { - return; - } - - Duration timeToNextInvocation = lastInvocation == TimePoint::min() - ? Duration::zero() - : (lastInvocation + frequency) - Clock::now(); - - if (timeToNextInvocation <= Duration::zero()) { - lastInvocation = Clock::now(); - function(); - } else { - pendingInvocation = true; - timer.start(timeToNextInvocation, Duration::zero(), [this]{ - pendingInvocation = false; - lastInvocation = Clock::now(); - function(); - }); - } -} - -} // namespace util -} // namespace mbgl diff --git a/src/mbgl/util/throttler.hpp b/src/mbgl/util/throttler.hpp deleted file mode 100644 index 175de7ccaf..0000000000 --- a/src/mbgl/util/throttler.hpp +++ /dev/null @@ -1,22 +0,0 @@ -#include <mbgl/util/chrono.hpp> -#include <mbgl/util/timer.hpp> - -namespace mbgl { -namespace util { - -class Throttler { -public: - Throttler(Duration frequency, std::function<void()>&& function); - - void invoke(); -private: - Duration frequency; - std::function<void()> function; - - Timer timer; - bool pendingInvocation; - TimePoint lastInvocation; -}; - -} // namespace util -} // namespace mbgl |