summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2017-08-22 12:57:11 +0300
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2017-08-22 12:57:11 +0300
commit1c633072fcea7ad153ab6f8ec40dd72d83541ead (patch)
treefa90c930a58672fa48bf46840f6b88ec645864f0 /platform
parentc53896caefc96a8c18ab746026330ddc4fc0338e (diff)
downloadqtlocation-mapboxgl-1c633072fcea7ad153ab6f8ec40dd72d83541ead.tar.gz
Bump Mapbox GL Native
mapbox-gl-native @ bd15e273dce767458d335aeb1f50aa081390d593
Diffstat (limited to 'platform')
-rw-r--r--platform/default/mbgl/gl/headless_backend.cpp6
-rw-r--r--platform/default/mbgl/storage/offline_database.cpp2
-rw-r--r--platform/default/online_file_source.cpp2
-rw-r--r--platform/default/run_loop.cpp13
-rw-r--r--platform/default/thread_local.cpp2
-rw-r--r--platform/qt/src/run_loop.cpp16
-rw-r--r--platform/qt/src/thread_local.cpp4
7 files changed, 19 insertions, 26 deletions
diff --git a/platform/default/mbgl/gl/headless_backend.cpp b/platform/default/mbgl/gl/headless_backend.cpp
index a854fe9731..fe77b80985 100644
--- a/platform/default/mbgl/gl/headless_backend.cpp
+++ b/platform/default/mbgl/gl/headless_backend.cpp
@@ -11,9 +11,9 @@ namespace mbgl {
class HeadlessBackend::View {
public:
- View(gl::Context& context, Size size)
- : color(context.createRenderbuffer<gl::RenderbufferType::RGBA>(size)),
- depthStencil(context.createRenderbuffer<gl::RenderbufferType::DepthStencil>(size)),
+ View(gl::Context& context, Size size_)
+ : color(context.createRenderbuffer<gl::RenderbufferType::RGBA>(size_)),
+ depthStencil(context.createRenderbuffer<gl::RenderbufferType::DepthStencil>(size_)),
framebuffer(context.createFramebuffer(color, depthStencil)) {
}
diff --git a/platform/default/mbgl/storage/offline_database.cpp b/platform/default/mbgl/storage/offline_database.cpp
index d38f0c9108..65c2097182 100644
--- a/platform/default/mbgl/storage/offline_database.cpp
+++ b/platform/default/mbgl/storage/offline_database.cpp
@@ -51,7 +51,7 @@ void OfflineDatabase::ensureSchema() {
case 4: migrateToVersion5(); // fall through
case 5: migrateToVersion6(); // fall through
case 6: return;
- default: throw std::runtime_error("unknown schema version");
+ default: break; // downgrade, delete the database
}
removeExisting();
diff --git a/platform/default/online_file_source.cpp b/platform/default/online_file_source.cpp
index 08011f5ac1..1c594f87a0 100644
--- a/platform/default/online_file_source.cpp
+++ b/platform/default/online_file_source.cpp
@@ -383,7 +383,7 @@ ActorRef<OnlineFileRequest> OnlineFileRequest::actor() {
if (!mailbox) {
// Lazy constructed because this can be costly and
// the ResourceTransform is not used by many apps.
- mailbox = std::make_shared<Mailbox>(*util::RunLoop::Get());
+ mailbox = std::make_shared<Mailbox>(*Scheduler::GetCurrent());
}
return ActorRef<OnlineFileRequest>(*this, mailbox);
diff --git a/platform/default/run_loop.cpp b/platform/default/run_loop.cpp
index 98d1badcb5..6375dba78e 100644
--- a/platform/default/run_loop.cpp
+++ b/platform/default/run_loop.cpp
@@ -1,6 +1,7 @@
#include <mbgl/util/run_loop.hpp>
#include <mbgl/util/async_task.hpp>
#include <mbgl/util/thread_local.hpp>
+#include <mbgl/actor/scheduler.hpp>
#include <uv.h>
@@ -10,9 +11,6 @@
namespace {
-using namespace mbgl::util;
-static ThreadLocal<RunLoop>& current = *new ThreadLocal<RunLoop>;
-
void dummyCallback(uv_async_t*) {}
} // namespace
@@ -53,7 +51,8 @@ struct Watch {
};
RunLoop* RunLoop::Get() {
- return current.get();
+ assert(static_cast<RunLoop*>(Scheduler::GetCurrent()));
+ return static_cast<RunLoop*>(Scheduler::GetCurrent());
}
class RunLoop::Impl {
@@ -98,12 +97,12 @@ RunLoop::RunLoop(Type type) : impl(std::make_unique<Impl>()) {
impl->type = type;
- current.set(this);
+ Scheduler::SetCurrent(this);
impl->async = std::make_unique<AsyncTask>(std::bind(&RunLoop::process, this));
}
RunLoop::~RunLoop() {
- current.set(nullptr);
+ Scheduler::SetCurrent(nullptr);
// Close the dummy handle that we have
// just to keep the main loop alive.
@@ -127,7 +126,7 @@ RunLoop::~RunLoop() {
}
LOOP_HANDLE RunLoop::getLoopHandle() {
- return current.get()->impl->loop;
+ return Get()->impl->loop;
}
void RunLoop::push(std::shared_ptr<WorkTask> task) {
diff --git a/platform/default/thread_local.cpp b/platform/default/thread_local.cpp
index 7abbaa0146..db70773c12 100644
--- a/platform/default/thread_local.cpp
+++ b/platform/default/thread_local.cpp
@@ -58,8 +58,8 @@ void ThreadLocal<T>::set(T* ptr) {
}
}
-template class ThreadLocal<RunLoop>;
template class ThreadLocal<BackendScope>;
+template class ThreadLocal<Scheduler>;
template class ThreadLocal<int>; // For unit tests
} // namespace util
diff --git a/platform/qt/src/run_loop.cpp b/platform/qt/src/run_loop.cpp
index c44f284852..71ea19032a 100644
--- a/platform/qt/src/run_loop.cpp
+++ b/platform/qt/src/run_loop.cpp
@@ -1,6 +1,6 @@
#include "run_loop_impl.hpp"
-#include <mbgl/util/thread_local.hpp>
+#include <mbgl/actor/scheduler.hpp>
#include <QCoreApplication>
@@ -8,13 +8,6 @@
#include <functional>
#include <utility>
-namespace {
-
-using namespace mbgl::util;
-static ThreadLocal<RunLoop>& current = *new ThreadLocal<RunLoop>;
-
-}
-
namespace mbgl {
namespace util {
@@ -27,7 +20,8 @@ void RunLoop::Impl::onWriteEvent(int fd) {
}
RunLoop* RunLoop::Get() {
- return current.get();
+ assert(static_cast<RunLoop*>(Scheduler::GetCurrent()));
+ return static_cast<RunLoop*>(Scheduler::GetCurrent());
}
RunLoop::RunLoop(Type type) : impl(std::make_unique<Impl>()) {
@@ -42,14 +36,14 @@ RunLoop::RunLoop(Type type) : impl(std::make_unique<Impl>()) {
impl->type = type;
- current.set(this);
+ Scheduler::SetCurrent(this);
impl->async = std::make_unique<AsyncTask>(std::bind(&RunLoop::process, this));
}
RunLoop::~RunLoop() {
MBGL_VERIFY_THREAD(tid);
- current.set(nullptr);
+ Scheduler::SetCurrent(nullptr);
}
LOOP_HANDLE RunLoop::getLoopHandle() {
diff --git a/platform/qt/src/thread_local.cpp b/platform/qt/src/thread_local.cpp
index bf2103c98f..467bfb0d05 100644
--- a/platform/qt/src/thread_local.cpp
+++ b/platform/qt/src/thread_local.cpp
@@ -1,6 +1,6 @@
#include <mbgl/util/thread_local.hpp>
-#include <mbgl/util/run_loop.hpp>
+#include <mbgl/actor/scheduler.hpp>
#include <mbgl/renderer/backend_scope.hpp>
#include <array>
@@ -41,7 +41,7 @@ void ThreadLocal<T>::set(T* ptr) {
impl->local.localData()[0] = ptr;
}
-template class ThreadLocal<RunLoop>;
+template class ThreadLocal<Scheduler>;
template class ThreadLocal<BackendScope>;
template class ThreadLocal<int>; // For unit tests