Skip to content

Commit

Permalink
Only initialize framework once, avoid multiple across tests (TextureG…
Browse files Browse the repository at this point in the history
  • Loading branch information
maicki authored and mikezucc committed Nov 7, 2018
1 parent 3d8f013 commit 4a7623e
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions Source/Private/ASInternalHelpers.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,19 @@ BOOL ASDefaultAllowsEdgeAntialiasing()

void ASInitializeFrameworkMainThread(void)
{
ASDisplayNodeCAssertMainThread();
// Ensure these values are cached on the main thread before needed in the background.
if (ASActivateExperimentalFeature(ASExperimentalLayerDefaults)) {
// Nop. We will gather default values on-demand in ASDefaultAllowsGroupOpacity and ASDefaultAllowsEdgeAntialiasing
} else {
CALayer *layer = [[[UIView alloc] init] layer];
allowsGroupOpacityFromUIKitOrNil = @(layer.allowsGroupOpacity);
allowsEdgeAntialiasingFromUIKitOrNil = @(layer.allowsEdgeAntialiasing);
}
ASNotifyInitialized();
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
ASDisplayNodeCAssertMainThread();
// Ensure these values are cached on the main thread before needed in the background.
if (ASActivateExperimentalFeature(ASExperimentalLayerDefaults)) {
// Nop. We will gather default values on-demand in ASDefaultAllowsGroupOpacity and ASDefaultAllowsEdgeAntialiasing
} else {
CALayer *layer = [[[UIView alloc] init] layer];
allowsGroupOpacityFromUIKitOrNil = @(layer.allowsGroupOpacity);
allowsEdgeAntialiasingFromUIKitOrNil = @(layer.allowsEdgeAntialiasing);
}
ASNotifyInitialized();
});
}

BOOL ASSubclassOverridesSelector(Class superclass, Class subclass, SEL selector)
Expand Down

0 comments on commit 4a7623e

Please sign in to comment.