Skip to content

Commit ee9af64

Browse files
committed
SDWebImageDownloaderQueueMode type renamed. Fixed typo. Added description for renamed type. Type renamed because "queue" notion is a FIFO only, but LIFO is a stack, and if we give the type a neutral name, we can avoid logical inconsistencies.
1 parent 6284e40 commit ee9af64

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

Examples/SDWebImage Demo/MasterViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
333333
nil];
334334
}
335335
[SDWebImageManager.sharedManager.imageDownloader setValue:@"SDWebImage Demo" forHTTPHeaderField:@"AppName"];
336-
SDWebImageManager.sharedManager.imageDownloader.queueMode = SDWebImageDownloaderLIFOQueueMode;
336+
SDWebImageManager.sharedManager.imageDownloader.executionOrder = SDWebImageDownloaderLIFOExecutionOrder;
337337
return self;
338338
}
339339

SDWebImage/SDWebImageDownloader.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,15 @@ typedef enum
2828

2929
typedef enum
3030
{
31-
SDWebImageDownloaderFILOQueueMode,
32-
SDWebImageDownloaderLIFOQueueMode
33-
} SDWebImageDownloaderQueueMode;
31+
SDWebImageDownloaderFIFOExecutionOrder,
32+
/**
33+
* Default value. All download operations will execute in queue style (first-in-first-out).
34+
*/
35+
SDWebImageDownloaderLIFOExecutionOrder
36+
/**
37+
* All download operations will execute in stack style (last-in-first-out).
38+
*/
39+
} SDWebImageDownloaderExecutionOrder;
3440

3541
extern NSString *const SDWebImageDownloadStartNotification;
3642
extern NSString *const SDWebImageDownloadStopNotification;
@@ -46,9 +52,9 @@ typedef void(^SDWebImageDownloaderCompletedBlock)(UIImage *image, NSData *data,
4652
@property (assign, nonatomic) NSInteger maxConcurrentDownloads;
4753

4854
/**
49-
* Changes download operations unqueue mode. Default value is `SDWebImageDownloaderFILOQueueMode`.
55+
* Changes download operations execution order. Default value is `SDWebImageDownloaderFIFOExecutionOrder`.
5056
*/
51-
@property (assign, nonatomic) SDWebImageDownloaderQueueMode queueMode;
57+
@property (assign, nonatomic) SDWebImageDownloaderExecutionOrder executionOrder;
5258

5359
+ (SDWebImageDownloader *)sharedDownloader;
5460

SDWebImage/SDWebImageDownloader.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ - (id)init
6767
{
6868
if ((self = [super init]))
6969
{
70-
_queueMode = SDWebImageDownloaderFILOQueueMode;
70+
_executionOrder = SDWebImageDownloaderFIFOExecutionOrder;
7171
_downloadQueue = NSOperationQueue.new;
7272
_downloadQueue.maxConcurrentOperationCount = 2;
7373
_URLCallbacks = NSMutableDictionary.new;
@@ -158,9 +158,9 @@ - (NSInteger)maxConcurrentDownloads
158158
[sself removeCallbacksForURL:url];
159159
}];
160160
[wself.downloadQueue addOperation:operation];
161-
if (wself.queueMode == SDWebImageDownloaderLIFOQueueMode)
161+
if (wself.executionOrder == SDWebImageDownloaderLIFOExecutionOrder)
162162
{
163-
// Emulate LIFO queue mode by systematically adding new operations as last operation's dependency
163+
// Emulate LIFO execution order by systematically adding new operations as last operation's dependency
164164
[wself.lastAddedOperation addDependency:operation];
165165
wself.lastAddedOperation = operation;
166166
}

0 commit comments

Comments
 (0)