Closed zhongwuzw closed 5 years ago
Please add tests.
Hmm, I'm not sure this will work. If the UUIDs are stored in a weak hash table, PINRemoteImageManager will 'lose' references to requests that the caller doesn't strongly retain the UUID toβ¦
@garrettmoon π€ Emm, PINRemoteImageTask
would retain UUID
by _callbackBlocks
.
@garrettmoon And I may have a thought to optimize _locked_taskForUUID:key:
of PINRemoteManager
by add a weak to weak NSMapTable
(uuid to task) and exposure key
of PINRemoteImageTask
, what do you think? π€
@garrettmoon π€ Emm,
PINRemoteImageTask
would retainUUID
by_callbackBlocks
.
You're right! Would you mind adding a comment to the code saying as much?
@garrettmoon And I may have a thought to optimize
_locked_taskForUUID:key:
ofPINRemoteManager
by add a weak to weakNSMapTable
(uuid to task) and exposurekey
ofPINRemoteImageTask
, what do you think? π€
Seems like a good optimization because it will also make the code clearer I think!
@garrettmoon And I may have a thought to optimize
_locked_taskForUUID:key:
ofPINRemoteManager
by add a weak to weakNSMapTable
(uuid to task) and exposurekey
ofPINRemoteImageTask
, what do you think? π€Seems like a good optimization because it will also make the code clearer I think!
π I'll make a PR later~
Add cancel all tasks for
PINRemoteImageManager
, it's the convenience method for user to call all tasks one shot, don't need to maintain uuids by themself.