Skip to content

Commit

Permalink
fixup! ref: centralize SentryBinaryImageCache singleton in SentryDepe…
Browse files Browse the repository at this point in the history
…ndencyContainer
  • Loading branch information
armcknight committed Aug 19, 2023
1 parent f290fce commit dc34713
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions Sources/Sentry/SentryBinaryImageCache.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#import "SentryBinaryImageCache.h"
#import "SentryCrashBinaryImageCache.h"
#import "SentryDependencyContainer.h"

static void binaryImageWasAdded(const SentryCrashBinaryImage *image);

Expand All @@ -17,14 +18,6 @@ - (void)binaryImageRemoved:(const SentryCrashBinaryImage *)image;

@implementation SentryBinaryImageCache

+ (SentryBinaryImageCache *)shared
{
static SentryBinaryImageCache *instance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{ instance = [[self alloc] init]; });
return instance;
}

- (void)start
{
_cache = [NSMutableArray array];
Expand Down Expand Up @@ -111,11 +104,11 @@ - (NSInteger)indexOfImage:(uint64_t)address
static void
binaryImageWasAdded(const SentryCrashBinaryImage *image)
{
[SentryBinaryImageCache.shared binaryImageAdded:image];
[SentryDependencyContainer.sharedInstance.binaryImageCache binaryImageAdded:image];
}

static void
binaryImageWasRemoved(const SentryCrashBinaryImage *image)
{
[SentryBinaryImageCache.shared binaryImageRemoved:image];
[SentryDependencyContainer.sharedInstance.binaryImageCache binaryImageRemoved:image];
}

0 comments on commit dc34713

Please sign in to comment.