Skip to content

Commit

Permalink
Add interface coalescing disable API
Browse files Browse the repository at this point in the history
This makes it easier for conforming UI updates within tests.
  • Loading branch information
maicki committed Oct 16, 2018
1 parent 7cdfacc commit e35db3b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Source/ASRunLoopQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ AS_SUBCLASSING_RESTRICTED

@property (readonly, getter=isEnabled) BOOL enabled;

- (void)disable;

/**
* The queue to run on main run loop before CATransaction commit.
*
Expand Down
9 changes: 8 additions & 1 deletion Source/ASRunLoopQueue.mm
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ @interface ASCATransactionQueue () {

// In order to not pollute the top-level activities, each queue has 1 root activity.
os_activity_t _rootActivity;
BOOL _disabled;

#if ASRunLoopQueueLoggingEnabled
NSTimer *_runloopQueueLoggingTimer;
Expand Down Expand Up @@ -363,6 +364,7 @@ - (instancetype)init
_runLoop = CFRunLoopGetMain();
NSPointerFunctionsOptions options = NSPointerFunctionsStrongMemory;
_internalQueue = [[NSPointerArray alloc] initWithOptions:options];
_disabled = NO;

// We don't want to pollute the top-level app activities with run loop batches, so we create one top-level
// activity per queue, and each batch activity joins that one instead.
Expand Down Expand Up @@ -535,7 +537,12 @@ - (BOOL)isEmpty

- (BOOL)isEnabled
{
return ASActivateExperimentalFeature(ASExperimentalInterfaceStateCoalescing);
return ASActivateExperimentalFeature(ASExperimentalInterfaceStateCoalescing) && !_disabled;
}

- (void)disable
{
_disabled = YES;
}

@end

0 comments on commit e35db3b

Please sign in to comment.