diff options
Diffstat (limited to 'platform/default/include/mbgl/util')
3 files changed, 66 insertions, 0 deletions
diff --git a/platform/default/include/mbgl/util/default_styles.hpp b/platform/default/include/mbgl/util/default_styles.hpp new file mode 100644 index 0000000000..13f08252a7 --- /dev/null +++ b/platform/default/include/mbgl/util/default_styles.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include <vector> +#include <string> + +namespace mbgl { +namespace util { +namespace default_styles { + +struct DefaultStyle { + const char* url; + const char* name; + const unsigned currentVersion; +}; + +constexpr const DefaultStyle streets = { "mapbox://styles/mapbox/streets-v10", "Streets", 10 }; +constexpr const DefaultStyle outdoors = { "mapbox://styles/mapbox/outdoors-v10", "Outdoors", 10 }; +constexpr const DefaultStyle light = { "mapbox://styles/mapbox/light-v9", "Light", 9 }; +constexpr const DefaultStyle dark = { "mapbox://styles/mapbox/dark-v9", "Dark", 9 }; +constexpr const DefaultStyle satellite = { "mapbox://styles/mapbox/satellite-v9", "Satellite", 9 }; +constexpr const DefaultStyle satelliteStreets = { "mapbox://styles/mapbox/satellite-streets-v10", "Satellite Streets", 10 }; + +const DefaultStyle orderedStyles[] = { + streets, outdoors, light, dark, satellite, satelliteStreets, +}; +const size_t numOrderedStyles = sizeof(orderedStyles) / sizeof(DefaultStyle); + +} // end namespace default_styles +} // end namespace util +} // end namespace mbgl diff --git a/platform/default/include/mbgl/util/default_thread_pool.hpp b/platform/default/include/mbgl/util/default_thread_pool.hpp new file mode 100644 index 0000000000..a14d16d771 --- /dev/null +++ b/platform/default/include/mbgl/util/default_thread_pool.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include <mbgl/actor/scheduler.hpp> + +#include <condition_variable> +#include <mutex> +#include <queue> +#include <thread> + +namespace mbgl { + +class ThreadPool : public Scheduler { +public: + ThreadPool(std::size_t count); + ~ThreadPool() override; + + void schedule(std::weak_ptr<Mailbox>) override; + +private: + std::vector<std::thread> threads; + std::queue<std::weak_ptr<Mailbox>> queue; + std::mutex mutex; + std::condition_variable cv; + bool terminate { false }; +}; + +} // namespace mbgl diff --git a/platform/default/include/mbgl/util/shared_thread_pool.hpp b/platform/default/include/mbgl/util/shared_thread_pool.hpp new file mode 100644 index 0000000000..04a3cb58d5 --- /dev/null +++ b/platform/default/include/mbgl/util/shared_thread_pool.hpp @@ -0,0 +1,9 @@ +#pragma once + +#include <mbgl/util/default_thread_pool.hpp> + +namespace mbgl { + +std::shared_ptr<ThreadPool> sharedThreadPool(); + +} // namespace mbgl |