Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Launches switching ASNetworkImageNode callbacks to global queue." #1382

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Schemas/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"exp_interface_state_coalesce",
"exp_unfair_lock",
"exp_infer_layer_defaults",
"exp_network_image_queue",
"exp_collection_teardown",
"exp_framesetter_cache",
"exp_skip_clear_data",
Expand Down
17 changes: 9 additions & 8 deletions Source/ASExperimentalFeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ typedef NS_OPTIONS(NSUInteger, ASExperimentalFeatures) {
ASExperimentalInterfaceStateCoalescing = 1 << 2, // exp_interface_state_coalesce
ASExperimentalUnfairLock = 1 << 3, // exp_unfair_lock
ASExperimentalLayerDefaults = 1 << 4, // exp_infer_layer_defaults
ASExperimentalCollectionTeardown = 1 << 5, // exp_collection_teardown
ASExperimentalFramesetterCache = 1 << 6, // exp_framesetter_cache
ASExperimentalSkipClearData = 1 << 7, // exp_skip_clear_data
ASExperimentalDidEnterPreloadSkipASMLayout = 1 << 8, // exp_did_enter_preload_skip_asm_layout
ASExperimentalDisableAccessibilityCache = 1 << 9, // exp_disable_a11y_cache
ASExperimentalSkipAccessibilityWait = 1 << 10, // exp_skip_a11y_wait
ASExperimentalNewDefaultCellLayoutMode = 1 << 11, // exp_new_default_cell_layout_mode
ASExperimentalDispatchApply = 1 << 12, // exp_dispatch_apply
ASExperimentalNetworkImageQueue = 1 << 5, // exp_network_image_queue
ASExperimentalCollectionTeardown = 1 << 6, // exp_collection_teardown
ASExperimentalFramesetterCache = 1 << 7, // exp_framesetter_cache
ASExperimentalSkipClearData = 1 << 8, // exp_skip_clear_data
ASExperimentalDidEnterPreloadSkipASMLayout = 1 << 9, // exp_did_enter_preload_skip_asm_layout
ASExperimentalDisableAccessibilityCache = 1 << 10, // exp_disable_a11y_cache
ASExperimentalSkipAccessibilityWait = 1 << 11, // exp_skip_a11y_wait
ASExperimentalNewDefaultCellLayoutMode = 1 << 12, // exp_new_default_cell_layout_mode
ASExperimentalDispatchApply = 1 << 13, // exp_dispatch_apply
ASExperimentalFeatureAll = 0xFFFFFFFF
};

Expand Down
1 change: 1 addition & 0 deletions Source/ASExperimentalFeatures.mm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
@"exp_interface_state_coalesce",
@"exp_unfair_lock",
@"exp_infer_layer_defaults",
@"exp_network_image_queue",
@"exp_collection_teardown",
@"exp_framesetter_cache",
@"exp_skip_clear_data",
Expand Down
11 changes: 10 additions & 1 deletion Source/ASNetworkImageNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,16 @@ - (void)dealloc

- (dispatch_queue_t)callbackQueue
{
return dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
static dispatch_once_t onceToken;
static dispatch_queue_t callbackQueue;
dispatch_once(&onceToken, ^{
if (ASActivateExperimentalFeature(ASExperimentalNetworkImageQueue)) {
callbackQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
} else {
callbackQueue = dispatch_get_main_queue();
}
});
return callbackQueue;
}

#pragma mark - Public methods -- must lock
Expand Down
2 changes: 2 additions & 0 deletions Tests/ASConfigurationTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
ASExperimentalInterfaceStateCoalescing,
ASExperimentalUnfairLock,
ASExperimentalLayerDefaults,
ASExperimentalNetworkImageQueue,
ASExperimentalCollectionTeardown,
ASExperimentalFramesetterCache,
ASExperimentalSkipClearData,
Expand All @@ -48,6 +49,7 @@ + (NSArray *)names {
@"exp_interface_state_coalesce",
@"exp_unfair_lock",
@"exp_infer_layer_defaults",
@"exp_network_image_queue",
@"exp_collection_teardown",
@"exp_framesetter_cache",
@"exp_skip_clear_data",
Expand Down
1 change: 1 addition & 0 deletions Tests/ASNetworkImageNodeTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ @implementation ASTestImageCache

- (void)cachedImageWithURL:(NSURL *)URL callbackQueue:(dispatch_queue_t)callbackQueue completion:(ASImageCacherCompletion)completion
{
ASDisplayNodeAssert(callbackQueue == dispatch_get_main_queue(), @"ASTestImageCache expects main queue for callback.");
completion(nil);
}

Expand Down