summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Rex <julian.rex@mapbox.com>2019-04-02 20:49:12 -0400
committerJulian Rex <julian.rex@mapbox.com>2019-04-02 20:49:12 -0400
commitda1c4de10ba2026f08217a590d3d453b4a1cf41d (patch)
tree05868b5eb3f4cf4e2142853b57fccd3abdecd12d
parentcfeaad39117a6898476ada052feaa287f32ad99b (diff)
downloadqtlocation-mapboxgl-da1c4de10ba2026f08217a590d3d453b4a1cf41d.tar.gz
Update with PR feedback
-rw-r--r--platform/ios/CHANGELOG.md2
-rw-r--r--platform/ios/src/MGLMapView.mm12
2 files changed, 9 insertions, 5 deletions
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md
index cf14c50acc..2e2d74407d 100644
--- a/platform/ios/CHANGELOG.md
+++ b/platform/ios/CHANGELOG.md
@@ -24,7 +24,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
* Added `MGLOrnamentPosition` enum and margin properties to customize scale bar, compass, logo, and attribution position within the map view. ([#13911](https://github.com/mapbox/mapbox-gl-native/pull/13911))
* Added an `MGLMapView.prefetchesTiles` property to configure lower-resolution tile prefetching behavior. ([#14031](https://github.com/mapbox/mapbox-gl-native/pull/14031))
-* Fixed a performance issue seen on iOS 12.2, when an `MGLMapView` is repeatedly removed and re-added in a view hierarchy. ([#14264](https://github.com/mapbox/mapbox-gl-native/pull/14264))
+* Speculatively fixed a performance issue seen on iOS 12.2, when an `MGLMapView` is repeatedly removed and re-added in a view hierarchy. ([#14264](https://github.com/mapbox/mapbox-gl-native/pull/14264))
## 4.9.0 - February 27, 2019
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 52e1febe15..2ec47b0bcd 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -156,6 +156,8 @@ const CGFloat MGLAnnotationImagePaddingForCallout = 1;
const CGSize MGLAnnotationAccessibilityElementMinimumSize = CGSizeMake(10, 10);
+/// The number of view annotations (excluding the user location view) that must
+/// be descendents of `MGLMapView` before presentsWithTransaction is enabled.
static const NSUInteger MGLPresentsWithTransactionAnnotationCount = 3;
/// An indication that the requested annotation was not found or is nonexistent.
@@ -331,6 +333,9 @@ public:
CFTimeInterval _frameCounterStartTime;
NSInteger _frameCount;
CFTimeInterval _frameDurations;
+
+ BOOL _atLeastiOS_12_2_0;
+
}
#pragma mark - Setup & Teardown -
@@ -444,6 +449,7 @@ public:
{
_isTargetingInterfaceBuilder = NSProcessInfo.processInfo.mgl_isInterfaceBuilderDesignablesAgent;
_opaque = NO;
+ _atLeastiOS_12_2_0 = [NSProcessInfo.processInfo isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){12,2,0}];
BOOL background = [UIApplication sharedApplication].applicationState == UIApplicationStateBackground;
if (!background)
@@ -1123,13 +1129,12 @@ public:
[self updateUserLocationAnnotationView];
[self updateAnnotationViews];
[self updateCalloutView];
-
+
#ifdef MGL_RECREATE_GL_IN_AN_EMERGENCY
-#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 120200)
// 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.
- if (self.enablePresentsWithTransaction)
+ if (self.enablePresentsWithTransaction && _atLeastiOS_12_2_0)
{
CFTimeInterval before = CACurrentMediaTime();
[self.glView display];
@@ -1143,7 +1148,6 @@ public:
}
else
#endif
-#endif
{
[self.glView display];
}