diff options
author | Chris Loer <chris.loer@gmail.com> | 2018-04-30 15:27:28 -0700 |
---|---|---|
committer | Chris Loer <chris.loer@mapbox.com> | 2018-04-30 17:08:09 -0700 |
commit | b820ca4686b923785f359d4e7054a2c47b5faff8 (patch) | |
tree | 9c7d2054f515c7615c1a6a18080f3c148d79367d /src/mbgl | |
parent | 9a4b806fa84bd3d2d1adb57eae4f9fdb5f79d9f9 (diff) | |
download | qtlocation-mapboxgl-b820ca4686b923785f359d4e7054a2c47b5faff8.tar.gz |
[core] Remove unused 'Throttler' class.
Throttler was previously used to control how frequently background placement ran.
Diffstat (limited to 'src/mbgl')
-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 |
3 files changed, 0 insertions, 59 deletions
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 |