diff options
-rw-r--r-- | include/mbgl/map/map.hpp | 18 | ||||
-rw-r--r-- | src/map/map.cpp | 56 |
2 files changed, 37 insertions, 37 deletions
diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index 25cbf8bde1..2f81a2bd81 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -38,7 +38,7 @@ public: ~Map(); // Start the map render thread. It is asynchronous. - void start(bool start_paused = false); + void start(bool startPaused = false); // Stop the map render thread. This call will block until the map rendering thread stopped. // The optional callback function will be invoked repeatedly until the map thread is stopped. @@ -48,7 +48,7 @@ public: void stop(stop_callback cb = nullptr, void *data = nullptr); // Pauses the render thread. The render thread will stop running but will not be terminated and will not lose state until resumed. - void pause(bool wait_for_pause = false); + void pause(bool waitForPause = false); // Resumes a paused render thread void resume(); @@ -76,7 +76,7 @@ public: // Size void resize(uint16_t width, uint16_t height, float ratio = 1); - void resize(uint16_t width, uint16_t height, float ratio, uint16_t fb_width, uint16_t fb_height); + void resize(uint16_t width, uint16_t height, float ratio, uint16_t fbWidth, uint16_t fbHeight); // Styling void setAppliedClasses(const std::vector<std::string> &classes); @@ -140,7 +140,7 @@ private: uv::worker& getWorker(); // Checks if render thread needs to pause - void check_for_pause(); + void checkForPause(); // Setup void setup(); @@ -166,11 +166,11 @@ private: bool terminating = false; bool pausing = false; - bool is_paused = false; - std::mutex mutex_run; - std::condition_variable cond_run; - std::mutex mutex_pause; - std::condition_variable cond_pause; + bool isPaused = false; + std::mutex mutexRun; + std::condition_variable condRun; + std::mutex mutexPause; + std::condition_variable condPause; // If cleared, the next time the render thread attempts to render the map, it will *actually* // render the map. diff --git a/src/map/map.cpp b/src/map/map.cpp index 1d81234ce8..686a9100b3 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -132,7 +132,7 @@ uv::worker &Map::getWorker() { return *workers; } -void Map::start(bool start_paused) { +void Map::start(bool startPaused) { assert(uv_thread_self() == mainThread); assert(!async); @@ -186,7 +186,7 @@ void Map::start(bool start_paused) { }); // Do we need to pause first? - if (start_paused) { + if (startPaused) { pause(); } @@ -239,32 +239,32 @@ void Map::stop(stop_callback cb, void *data) { async = false; } -void Map::pause(bool wait_for_pause) { - assert(uv_thread_self() == main_thread); +void Map::pause(bool waitForPause) { + assert(uv_thread_self() == mainThread); assert(async); - mutex_run.lock(); + mutexRun.lock(); pausing = true; - mutex_run.unlock(); + mutexRun.unlock(); uv_stop(**loop); rerender(); // Needed to ensure uv_stop is seen and uv_run exits, otherwise we deadlock on wait_for_pause - if (wait_for_pause) { - std::unique_lock<std::mutex> lock_pause (mutex_pause); - while (!is_paused) { - cond_pause.wait(lock_pause); + if (waitForPause) { + std::unique_lock<std::mutex> lockPause (mutexPause); + while (!isPaused) { + condPause.wait(lockPause); } } } void Map::resume() { - assert(uv_thread_self() == main_thread); + assert(uv_thread_self() == mainThread); assert(async); - mutex_run.lock(); + mutexRun.lock(); pausing = false; - cond_run.notify_all(); - mutex_run.unlock(); + condRun.notify_all(); + mutexRun.unlock(); } void Map::run() { @@ -280,7 +280,7 @@ void Map::run() { assert(uv_thread_self() == mapThread); if (async) { - check_for_pause(); + checkForPause(); } setup(); @@ -290,7 +290,7 @@ void Map::run() { terminating = false; while(!terminating) { uv_run(**loop, UV_RUN_DEFAULT); - check_for_pause(); + checkForPause(); } } else { uv_run(**loop, UV_RUN_DEFAULT); @@ -315,24 +315,24 @@ void Map::run() { #endif } -void Map::check_for_pause() { - std::unique_lock<std::mutex> lock_run (mutex_run); +void Map::checkForPause() { + std::unique_lock<std::mutex> lockRun (mutexRun); while (pausing) { view.make_inactive(); - mutex_pause.lock(); - is_paused = true; - cond_pause.notify_all(); - mutex_pause.unlock(); + mutexPause.lock(); + isPaused = true; + condPause.notify_all(); + mutexPause.unlock(); - cond_run.wait(lock_run); + condRun.wait(lockRun); view.make_active(); } - mutex_pause.lock(); - is_paused = false; - mutex_pause.unlock(); + mutexPause.lock(); + isPaused = false; + mutexPause.unlock(); } void Map::rerender() { @@ -460,8 +460,8 @@ void Map::resize(uint16_t width, uint16_t height, float ratio) { resize(width, height, ratio, width * ratio, height * ratio); } -void Map::resize(uint16_t width, uint16_t height, float ratio, uint16_t fb_width, uint16_t fb_height) { - if (transform.resize(width, height, ratio, fb_width, fb_height)) { +void Map::resize(uint16_t width, uint16_t height, float ratio, uint16_t fbWidth, uint16_t fbHeight) { + if (transform.resize(width, height, ratio, fbWidth, fbHeight)) { update(); } } |