summaryrefslogtreecommitdiff
path: root/platform/qt
diff options
context:
space:
mode:
Diffstat (limited to 'platform/qt')
-rw-r--r--platform/qt/src/number_format.cpp (renamed from platform/qt/src/format_number.cpp)0
-rw-r--r--platform/qt/src/qmapboxgl_scheduler.cpp10
-rw-r--r--platform/qt/src/qmapboxgl_scheduler.hpp7
-rw-r--r--platform/qt/src/qt_geojson.cpp2
-rw-r--r--platform/qt/src/qt_geojson.hpp2
5 files changed, 11 insertions, 10 deletions
diff --git a/platform/qt/src/format_number.cpp b/platform/qt/src/number_format.cpp
index b6fe3558e6..b6fe3558e6 100644
--- a/platform/qt/src/format_number.cpp
+++ b/platform/qt/src/number_format.cpp
diff --git a/platform/qt/src/qmapboxgl_scheduler.cpp b/platform/qt/src/qmapboxgl_scheduler.cpp
index e2d39703ee..5fc3ab13de 100644
--- a/platform/qt/src/qmapboxgl_scheduler.cpp
+++ b/platform/qt/src/qmapboxgl_scheduler.cpp
@@ -13,10 +13,9 @@ QMapboxGLScheduler::~QMapboxGLScheduler()
MBGL_VERIFY_THREAD(tid);
}
-void QMapboxGLScheduler::schedule(std::weak_ptr<mbgl::Mailbox> mailbox)
-{
+void QMapboxGLScheduler::schedule(std::function<void()> function) {
std::lock_guard<std::mutex> lock(m_taskQueueMutex);
- m_taskQueue.push(mailbox);
+ m_taskQueue.push(std::move(function));
// Need to force the main thread to wake
// up this thread and process the events.
@@ -25,14 +24,15 @@ void QMapboxGLScheduler::schedule(std::weak_ptr<mbgl::Mailbox> mailbox)
void QMapboxGLScheduler::processEvents()
{
- std::queue<std::weak_ptr<mbgl::Mailbox>> taskQueue;
+ std::queue<std::function<void()>> taskQueue;
{
std::unique_lock<std::mutex> lock(m_taskQueueMutex);
std::swap(taskQueue, m_taskQueue);
}
while (!taskQueue.empty()) {
- mbgl::Mailbox::maybeReceive(taskQueue.front());
+ auto& function = taskQueue.front();
+ if (function) function();
taskQueue.pop();
}
}
diff --git a/platform/qt/src/qmapboxgl_scheduler.hpp b/platform/qt/src/qmapboxgl_scheduler.hpp
index 68636d0d11..0b000b9fcc 100644
--- a/platform/qt/src/qmapboxgl_scheduler.hpp
+++ b/platform/qt/src/qmapboxgl_scheduler.hpp
@@ -1,6 +1,5 @@
#pragma once
-#include <mbgl/actor/mailbox.hpp>
#include <mbgl/actor/scheduler.hpp>
#include <mbgl/util/util.hpp>
@@ -19,7 +18,8 @@ public:
virtual ~QMapboxGLScheduler();
// mbgl::Scheduler implementation.
- void schedule(std::weak_ptr<mbgl::Mailbox> scheduled) final;
+ void schedule(std::function<void()> scheduled) final;
+ mapbox::base::WeakPtr<Scheduler> makeWeakPtr() override { return weakFactory.makeWeakPtr(); }
void processEvents();
@@ -30,5 +30,6 @@ private:
MBGL_STORE_THREAD(tid);
std::mutex m_taskQueueMutex;
- std::queue<std::weak_ptr<mbgl::Mailbox>> m_taskQueue;
+ std::queue<std::function<void()>> m_taskQueue;
+ mapbox::base::WeakPtrFactory<Scheduler> weakFactory{this};
};
diff --git a/platform/qt/src/qt_geojson.cpp b/platform/qt/src/qt_geojson.cpp
index 48d78abfe0..3b775685b1 100644
--- a/platform/qt/src/qt_geojson.cpp
+++ b/platform/qt/src/qt_geojson.cpp
@@ -121,7 +121,7 @@ mbgl::FeatureIdentifier asMapboxGLFeatureIdentifier(const QVariant &id) {
}
}
-mbgl::Feature asMapboxGLFeature(const QMapbox::Feature &feature) {
+mbgl::GeoJSONFeature asMapboxGLFeature(const QMapbox::Feature &feature) {
mbgl::PropertyMap properties;
properties.reserve(feature.properties.size());
for (auto it = feature.properties.constBegin(); it != feature.properties.constEnd(); ++it) {
diff --git a/platform/qt/src/qt_geojson.hpp b/platform/qt/src/qt_geojson.hpp
index a9c10272ab..a7db3ba644 100644
--- a/platform/qt/src/qt_geojson.hpp
+++ b/platform/qt/src/qt_geojson.hpp
@@ -22,6 +22,6 @@ mbgl::Polygon<double> asMapboxGLPolygon(const QMapbox::CoordinatesCollection &po
mbgl::MultiPolygon<double> asMapboxGLMultiPolygon(const QMapbox::CoordinatesCollections &multiPolygon);
mbgl::Value asMapboxGLPropertyValue(const QVariant &value);
mbgl::FeatureIdentifier asMapboxGLFeatureIdentifier(const QVariant &id);
-mbgl::Feature asMapboxGLFeature(const QMapbox::Feature &feature);
+mbgl::GeoJSONFeature asMapboxGLFeature(const QMapbox::Feature &feature);
} // namespace QMapbox