diff options
Diffstat (limited to 'platform/macos/src/MGLMapView.mm')
-rw-r--r-- | platform/macos/src/MGLMapView.mm | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index e54b0f195d..8b9a5a982f 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -15,6 +15,7 @@ #import "MGLMultiPoint_Private.h" #import "MGLOfflineStorage_Private.h" #import "MGLStyle_Private.h" +#import "MGLStyleLayerRetentionManager_Private.h" #import "MGLShape_Private.h" #import "MGLAccountManager.h" @@ -144,6 +145,7 @@ public: @property (nonatomic, readwrite) NSView *attributionView; @property (nonatomic, readwrite) MGLStyle *style; +@property (nonatomic) MGLStyleLayerRetentionManager* styleLayerRetentionManager; /// Mapping from reusable identifiers to annotation images. @property (nonatomic) NS_MUTABLE_DICTIONARY_OF(NSString *, MGLAnnotationImage *) *annotationImagesByIdentifier; @@ -256,6 +258,8 @@ public: - (void)commonInit { _isTargetingInterfaceBuilder = NSProcessInfo.processInfo.mgl_isInterfaceBuilderDesignablesAgent; + _styleLayerRetentionManager = [[MGLStyleLayerRetentionManager alloc] init]; + // Set up cross-platform controllers and resources. _mbglView = new MGLMapViewImpl(self); @@ -882,7 +886,7 @@ public: return; } - [self.style retainLayersUsedDuringRendering]; + [self.styleLayerRetentionManager updateRetainedLayers:self.style.managedLayers]; if ([self.delegate respondsToSelector:@selector(mapViewWillStartRenderingFrame:)]) { [self.delegate mapViewWillStartRenderingFrame:self]; @@ -898,11 +902,12 @@ public: _isChangingAnnotationLayers = NO; [self.style didChangeValueForKey:@"layers"]; } + + [self.styleLayerRetentionManager decrementLifetimes]; + if ([self.delegate respondsToSelector:@selector(mapViewDidFinishRenderingFrame:fullyRendered:)]) { [self.delegate mapViewDidFinishRenderingFrame:self fullyRendered:fullyRendered]; } - - [self.style releaseLayersUsedDuringRendering]; } - (void)mapViewWillStartRenderingMap { |