diff options
Diffstat (limited to 'platform/ios/src/MGLMapView+OpenGL.mm')
-rw-r--r-- | platform/ios/src/MGLMapView+OpenGL.mm | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/platform/ios/src/MGLMapView+OpenGL.mm b/platform/ios/src/MGLMapView+OpenGL.mm index e599024e26..ad30b608e5 100644 --- a/platform/ios/src/MGLMapView+OpenGL.mm +++ b/platform/ios/src/MGLMapView+OpenGL.mm @@ -2,6 +2,11 @@ #import "MGLLoggingConfiguration_Private.h" #import "MGLMapView+OpenGL.h" +#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR +#import "MMEConstants.h" +#import "MGLMapboxEvents.h" +#endif + #include <mbgl/gl/renderable_resource.hpp> #import <GLKit/GLKit.h> @@ -96,7 +101,7 @@ void MGLMapViewOpenGLImpl::setPresentsWithTransaction(const bool value) { void MGLMapViewOpenGLImpl::display() { auto& resource = getResource<MGLMapViewOpenGLRenderableResource>(); -#ifdef MGL_RECREATE_GL_IN_AN_EMERGENCY + // See https://github.com/mapbox/mapbox-gl-native/issues/14232 // glClear can be blocked for 1 second. This code is an "escape hatch", // an attempt to detect this situation and rebuild the GL views. @@ -106,14 +111,22 @@ void MGLMapViewOpenGLImpl::display() { CFTimeInterval after = CACurrentMediaTime(); if (after - before >= 1.0) { +#ifdef MGL_RECREATE_GL_IN_AN_EMERGENCY dispatch_async(dispatch_get_main_queue(), ^{ emergencyRecreateGL(); }); - } - } - else +#else + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + NSError *error = [NSError errorWithDomain:MGLErrorDomain + code:MGLErrorCodeRenderingError + userInfo:@{ NSLocalizedFailureReasonErrorKey : + @"https://github.com/mapbox/mapbox-gl-native/issues/14232" }]; + [[MMEEventsManager sharedManager] reportError:error]; + }); #endif - { + } + } else { [resource.glView display]; } } |