Remove lock tradeoff when get fetchFrame
This commit is contained in:
parent
6d85cd9061
commit
759b7322c9
|
@ -689,8 +689,10 @@ static NSUInteger SDDeviceFreeMemory() {
|
|||
|
||||
// Update the current frame
|
||||
UIImage *currentFrame;
|
||||
UIImage *fetchFrame;
|
||||
LOCKBLOCK({
|
||||
currentFrame = self.frameBuffer[@(currentFrameIndex)];
|
||||
fetchFrame = currentFrame ? self.frameBuffer[@(nextFrameIndex)] : nil;
|
||||
});
|
||||
BOOL bufferFull = NO;
|
||||
if (currentFrame) {
|
||||
|
@ -744,11 +746,6 @@ static NSUInteger SDDeviceFreeMemory() {
|
|||
fetchFrameIndex = nextFrameIndex;
|
||||
}
|
||||
|
||||
UIImage *fetchFrame;
|
||||
LOCKBLOCK({
|
||||
fetchFrame = self.frameBuffer[@(fetchFrameIndex)];
|
||||
});
|
||||
|
||||
if (!fetchFrame && !bufferFull && self.fetchQueue.operationCount == 0) {
|
||||
// Prefetch next frame in background queue
|
||||
UIImage<SDAnimatedImage> *animatedImage = self.animatedImage;
|
||||
|
|
Loading…
Reference in New Issue