74 Commits

Author SHA1 Message Date
appleguy
0a5c1f43a8 [ASRunLoopQueue - Performance] Add ASDeallocQueue for efficient object teardown. (#2399)
* [ASRunLoopQueue - Performance] Add ASDeallocQueue for efficient object teardown.

This measurably reduces block overhead and context switching.  In the layout benchmark,
it increases ops/s while actually reducing CPU utilization.  This suggests that we are
now at a lock-bounded local maximum, at least for tri-core devices.

* [ASDeallocQueue] Update convenience helper method and adopt in ASImageNode etc.

* [ASDeallocQueue] Reimplement the queue using a timer-based runloop.

* [Debugging] Re-enable ASDisplayNode Event Log.

* [ASDeallocQueue] Final refinements, comments, code minimization.

* [ASDeallocQueue] Fix for lock release needed in early return (refactoring typo from last commit)
2016-10-17 12:24:11 -07:00
Adlai Holler
0ed8ecb677 Test and improve the ASNetworkImageNode progress block handling (#2386) 2016-10-15 17:50:16 -07:00
Michael Schneider
3f11c67c82 Return CGSizeZero in case a ASNetworkImageNode is asked for the size and the image did not load yet (#2378) 2016-10-13 14:03:15 -07:00
appleguy
3f1f5667c3 [ASDisplayNode] Add -displayWillStartAsynchronously: method to allow skipping synchronous image cache check. (#2344) 2016-10-05 12:48:54 -04:00
Garrett Moon
5205ef6840 [API] Remove old deprecated methods. (#2312)
* Remove old deprecated methods. Will restore ones that were removed recently based on PR.

* Update example to use non-deprecated method.

* Don't remove locking / unlocking, insets or willDisplayNode deprecated methods yet.
2016-10-03 14:57:01 -04:00
Adlai Holler
33a680255c [ASDisplayNode] Add Convenience Interface State Accessors (#2168)
* Finish renaming fetchData range, add convenience accessors

* Update example

* Update new tests
2016-09-01 16:44:16 -07:00
Garrett Moon
645aa6f24b [ASDisplayNode] Renamed range update callbacks (#2130)
* Renamed range update callbacks

We finally settled on

didEnter/ExitDisplayState
didEnter/ExitPreloadState
didEnter/ExitVisibleState

This change is meant to unify the range update methods to relate to each
other and hopefully be a bit more self explanatory.

* Guarantee interface callbacks happen on main.

* move fetchData / clearFetchedData to default implementations

* Move deprecated methods to new deprecated category

* Don't bring in cocoapod change.

* Nits

* Capetalize
2016-08-26 20:18:38 -07:00
Garrett Moon
e6e5c346de I wrote a bunch of code with the Mutex::Unlocker and didn't understand it. (#2150) 2016-08-26 14:07:18 -07:00
appleguy
74bf376b2f [ASDisplayNode] Rename _propertyLock to __instanceLock__ to avoid subclass naming collisions. (#1941) 2016-07-16 15:32:13 -07:00
Hannah Troisi
f39c2ce7e3 [ASTextNode, ASImageNode, ASVideoNode] Use ASDisplayNode base class lock for subclass property synchronization (#1877)
* [ASTextNode, ASVideoNode] Use ASDisplayNode base class lock for subclass property synchronization

* fix headers to match master

* address @appleguy, @maicki comments

* import header

* Swap lock in ASNetworkImageNode as well

* remove invalid comment

* more cleanup of locks
2016-07-09 22:08:34 -07:00
Flo
131dd25de3 [ASNetworkImageNode] Check that data is not nil before loading the animated image. (#1849) 2016-07-09 21:19:57 -07:00
appleguy
3b2af7eb6d [Build] Remove Unused Imports across all of AsyncDisplayKit. This uses a feature of AppCode. (#1875)
Details on the tool are here: https://www.jetbrains.com/help/idea/2016.1/optimizing-imports.html
2016-07-09 17:20:59 -07:00
Michael Schneider
9501299eed Use flags to cache instead of instance variables for caching respond to selector calls 2016-07-01 16:02:58 -07:00
Michael Schneider
2c6e810e26 Fix not handling imageNode:didLoadImage: from ASNetworkImageNodeDelegate as optional 2016-06-20 07:50:40 -07:00
Michael Schneider
aa5d730eab Deallocate objects on a serial queue specific for deallocation (#1737)
[Performance] Prevent GCD thread explosion due to object deallocation workloads (serial deallocation queue).
2016-06-16 18:18:43 -07:00
Hannah Troisi
c857e809f4 Clean up header comments (for consistent Facebook licensing info) (#1741)
[Licensing] Clean up header comments (for consistent Facebook licensing info)
2016-06-11 23:31:39 -07:00
appleguy
a7128cd213 Merge pull request #1605 from lappp9/override-callback-for-display-range
[ASDisplayNode] Added callbacks for entering and exiting fetch data and display ranges
2016-06-11 22:21:20 -07:00
Eric Jensen
91e6df0af9 Add a way to check if data is in a format supported by a class implementing ASAnimatedImageProtocol 2016-06-09 10:36:18 -07:00
Eric Jensen
1fb3ffc6f8 Replace usage of imageWithData: with imageWithContentsOfFile: 2016-06-09 10:01:59 -07:00
Eric Jensen
7de82b0b5b Support loading animated images from the local filesystem 2016-06-08 11:34:56 -07:00
Luke Parham
fc5467b110 fixed typo and added backwards compatibility for 'visibilityDidChange' 2016-06-06 02:02:23 -05:00
Luke Parham
e510120031 changed '-visibilityDidChange:' to '-visiblieStateDidChange:' to match the others 2016-06-06 00:56:21 -05:00
Scott Goodson
783011bc0e [ASVideoNode] Added a couple comments for clarity and to identify future improvement areas. 2016-06-04 21:38:05 -07:00
Garrett Moon
c0eb6cac09 Add support for disabling progressive image rendering
Differential Revision: https://phabricator.pinadmin.com/D89742
2016-05-09 15:01:05 -07:00
Wendy
fd4d18259e Use dispatch_async for setting currentImageQuality to ensure current order 2016-04-29 22:30:56 -07:00
Wendy
492d0d7ad6 [ASNetworkImageNode] Fix threading issue in current image quality
Summary:
Because we trampoline to main when setting _currentImageQuality, there would be situations where displayWillStart was called, we get a cached image and set currentImageQuality to 1.0, and then a background thread calling setDefaultImage would enqueue an operation that sets currentImageQuality to 0 and overwrites the correct value
2016-04-28 14:52:31 -07:00
Wendy
fe5c4caf90 Lock properly when setting currentImageQuality 2016-04-26 18:35:03 -07:00
Wendy
0b55df9649 Add the ability for ASNetworkImageNodes to keep track of their progressive image quality 2016-04-26 18:33:59 -07:00
Michael Schneider
ce6e11c6d2 Fix deadlock in ASNetworkImageNode
Calling _updateProgressImageBlockOnDownloaderIfNeeded should be called without _lock held. We will lock super to read our interface state and it's best to avoid acquiring both locks.
2016-04-25 13:15:11 -07:00
Adlai Holler
05b22531e6 Include necessary header 2016-04-22 19:12:38 -05:00
Adlai Holler
a216b17b01 Merge branch 'master' into ImageNodeImprovements
Conflicts:
	AsyncDisplayKit/ASNetworkImageNode.mm
2016-04-22 12:36:58 -05:00
Adlai Holler
bc8a2b19ef [ASNetworkImageNode] Carry recent progress image block changes over from multiplex image node 2016-04-22 12:34:13 -05:00
Garrett Moon
0fc39d1ccd Follow up to animated GIF PR 2016-04-19 13:43:41 -07:00
Garrett Moon
b56e20853b Prevent retain cycle, clear out animatedImage on _clearImage. 2016-04-13 14:23:02 -07:00
Garrett Moon
f4b526a8db Fix non example build 2016-04-13 14:23:02 -07:00
Garrett Moon
1b316217ef Downstream ASAnimatedImage 2016-04-13 14:23:02 -07:00
Garrett Moon
3bcbfb149d Add support for animated GIFs
Summary:
Use NSData as key

Add chunking of files

Add support for Animated Images

This adds support for GIF playback in ASDK. It's not currently ready
for merging to public ASDK – for one the GIF decompression may make
more sense in PINRemoteImage.

Removed duration as it wasn't used

Make cover image lazily loaded

Differential Revision: https://phabricator.pinadmin.com/D82033
2016-04-13 14:23:02 -07:00
Adlai Holler
faf29dd978 Fix indentation 2016-04-12 17:45:40 -07:00
Adlai Holler
0022cad000 [ASMultiplexImageNode] Copy recent changes made to ASNetworkImageNode for progress image handling 2016-04-12 14:34:11 -07:00
Adlai Holler
362c41ae80 [ASNetworkImageNode] Attach progress image handler even if download starts while already visible 2016-04-12 14:17:41 -07:00
Adlai Holler
37c7f6f849 [ASNetworkImageNode] Remove retain 2016-04-12 14:17:41 -07:00
Adlai Holler
11461f415f [ASNetworkImageNode] Improve readability, resolve self retain, reduce locking 2016-04-12 14:17:41 -07:00
Scott Goodson
c5c7abb1d6 [ASDisplayNode] Placeholders should always be recreated if returning to past nodes.
If previously-displayed contents is gone (e.g. clearContents), and is not finished displaying
by the time the node is onscreen, recreate the placeholder immediately.
2016-03-18 21:13:26 -07:00
Scott Goodson
a966b7b6a6 [ASImageNode] -setDefaultImage: should release lock before calling -setImage:
This allows -setImage: to fully unlock before it calls -invalidateCalculatedSize.
2016-03-16 20:55:08 -07:00
Garrett Moon
3a7d150680 Remove extraneous brackets, check _imageLoaded before doing work 2016-03-11 21:58:49 -08:00
Garrett Moon
af61645faf Add support for attempting to get image synchronously 2016-03-11 21:58:49 -08:00
Scott Goodson
cdd1bd1e39 [ASRangeController] Ensure that visibilityDidChange: is always called on app launch for all initial cells. 2016-03-11 17:18:32 -08:00
Eric Jensen
c2f85397ce Mark depreciated protocols with deprivation attribute 2016-03-08 11:56:58 -08:00
Michael Schneider
3c32c48be0 Add clear image to ASMultiplexImageNode 2016-03-02 06:14:35 -08:00
Michael Schneider
6e69c312d6 Dispatch deallocation of UIImage on background thread
Destruction of bigger images in ASNetworkImageNode on the main thread can be expensive and can take some time, so we dispatch onto a background queue to actually dealloc.
2016-03-01 17:04:38 -08:00