Add async asserts
This commit is contained in:
@@ -479,7 +479,7 @@ void NativeMapView::start() {
|
||||
LOG_ASSERT(display != EGL_NO_DISPLAY);
|
||||
LOG_ASSERT(context != EGL_NO_CONTEXT);
|
||||
|
||||
map->start();
|
||||
map->start(true);
|
||||
}
|
||||
|
||||
void NativeMapView::loadExtensions() {
|
||||
|
||||
@@ -401,7 +401,6 @@ public class MapView extends SurfaceView {
|
||||
// Must be called from Activity onStart
|
||||
public void onStart() {
|
||||
Log.v(TAG, "onStart");
|
||||
mNativeMapView.pause();
|
||||
mNativeMapView.start();
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
~Map();
|
||||
|
||||
// Start the map render thread. It is asynchronous.
|
||||
void start();
|
||||
void start(bool start_paused = 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.
|
||||
@@ -46,7 +46,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();
|
||||
void pause(bool wait_for_pause = false);
|
||||
|
||||
// Resumes a paused render thread
|
||||
void resume();
|
||||
|
||||
@@ -78,7 +78,7 @@ uv::worker &Map::getWorker() {
|
||||
return *workers;
|
||||
}
|
||||
|
||||
void Map::start() { // TODO add pause arg
|
||||
void Map::start(bool start_paused) {
|
||||
assert(uv_thread_self() == main_thread);
|
||||
assert(!async);
|
||||
|
||||
@@ -89,6 +89,11 @@ void Map::start() { // TODO add pause arg
|
||||
// Reset the flag.
|
||||
is_stopped = false;
|
||||
|
||||
// Do we need to pause first?
|
||||
if (start_paused) {
|
||||
pause();
|
||||
}
|
||||
|
||||
// Setup async notifications
|
||||
|
||||
// Iron out the differences between libuv 0.10 and 0.11
|
||||
@@ -159,8 +164,9 @@ void Map::stop(stop_callback cb, void *data) {
|
||||
async = false;
|
||||
}
|
||||
|
||||
void Map::pause() {
|
||||
void Map::pause(bool wait_for_pause) {
|
||||
assert(uv_thread_self() == main_thread);
|
||||
assert(async);
|
||||
Log::Info(Event::General, "Map::pause() start");
|
||||
|
||||
// TODO wait until paused before return
|
||||
@@ -182,6 +188,7 @@ void Map::pause() {
|
||||
|
||||
void Map::resume() {
|
||||
assert(uv_thread_self() == main_thread);
|
||||
assert(async);
|
||||
Log::Info(Event::General, "Map::resume() start");
|
||||
|
||||
Log::Info(Event::General, "Map::resume() locking");
|
||||
|
||||
Reference in New Issue
Block a user