Garrett Moon
938ecd9b6f
Fix deadlock when laying out on multiple threads
...
Summary:
We observed a deadlock which occurred when two threads were laying out the same set of nodes.
On one thread, layout would occur on a leaf node. It would lock and as part of this layout
process, ASDK walks up the node tree and calls __setNeedsLayout on its supernode until it
reaches the supernode with no supernode. When the supernode gets its call to __setNeedsLayout
it also locks. So leaf node locks and then awaits supernode lock.
On another thread, we're doing a layout pass on the supernode in the above thread. This locks
the supernode and attempts to lock the leaf node. This deadlocks (remember the above thread
is holding onto the leaf lock and awaiting the supernode lock. This thread is holding onto
the supernode lock and awaiting the leaf lock).
This is all exacerbated by the use of recursive locks.
2016-05-03 15:56:38 -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
79e5337948
Fix setter override for setLayoutSpecBlock:
2016-04-22 11:22:01 -07:00
Michael Schneider
fde8f1af0e
Change layoutSpecBlock against NULL
2016-04-22 11:21:42 -07:00
Michael Schneider
5afce83241
Adjust indention of comment
2016-04-21 07:07:17 -07:00
Michael Schneider
87a37a283e
Add a block API to provide an ASLayoutSpec without having to subclass ASDisplayNode
2016-04-20 19:16:54 -07:00
appleguy
dd4853bf3a
Merge pull request #1273 from aaronschubert0/tvOS
...
[tvOS] Add default focus states to ASControlNode & ASImageNode.
2016-04-20 13:29:31 -07:00
Michael Schneider
42174210c5
Follow up for ASCollectionNode and ASTableNode background color fix
2016-04-19 16:07:42 -07:00
Michael Schneider
3793dc024e
Improve setting special properties for certain classes directly to the UIView
...
- Remove duplicated code in ASCollectionNode and ASTableNode
- Fix setting the pending state to the view if applying the pending state to the view
2016-04-19 10:50:22 -07:00
Aaron Schubert
21abe8f899
Fix merge conflicts
2016-04-19 09:02:07 +01:00
appleguy
30a0c471ca
Merge pull request #1528 from ejensen/instancetype
...
[Refactoring] Replace id with instancetype in initializers
2016-04-16 20:53:41 -07:00
Huy Nguyen
5a677915ba
ASDisplayNode should bail early if a scheduled transition was invalidated before its block executes
...
- Idea borrowed from _enqueueAsyncSizingWithSentinel
2016-04-15 22:08:48 +03:00
Huy Nguyen
a35647b200
Remove unused _enqueueAsyncSizingWithSentinel and asyncSizingQueue methods of ASDisplayNode
2016-04-15 22:08:21 +03:00
Eric Jensen
527397ba7e
Replace id with instancetype in initializers
2016-04-13 11:20:05 -07:00
Scott Goodson
8ccef1e99f
[ASEnvironment] Fix incomplete gating of upward propagation of layout properties (disabled for now).
2016-04-11 20:34:24 -07:00
Scott Goodson
ccddb36ed9
[ASDisplayNode] Ensure that Visible interfaceState is cleared on removal from hierarchy for rasterized elements.
2016-04-07 14:10:34 -07:00
Hannah Troisi
dbad1c38e5
[ASEnvironment - Layout] Fixes to upward propagation of ASLayoutable properties.
2016-04-02 15:03:43 -07:00
Michael Schneider
20ee9bca8d
Rename ASEnvironmentStateCreate to ASEnvironmentStateMakeDefault
2016-03-31 20:43:20 -07:00
Michael Schneider
f46f5640ff
Add improvements
...
- Remove defaults for ASEnvironmentLayoutOptionsState and ASEnvironmentHierarchyState
- Add locking for ASEnvironmentLayoutExtensibilityForwarding
- Other smaller improvements
2016-03-31 20:43:20 -07:00
Michael Schneider
4e757f0969
General improvements
...
- Refactor naming of ASEnvironmentCollection to ASEnvironmentState
- Remove struct pointers
- Move ASEnvironmentStatePropagation to a enum class
- Move merge functions to pure functions
- Move ASLayoutOptionsForwarding and ASLayoutableExtensibility into ASLayoutSpec and ASDisplayNode
- Remove ASLayoutableSetValuesForLayoutable and move into explicit classes (ASDisplayNode, ASTextNode)
2016-03-31 20:43:20 -07:00
Michael Schneider
65b4961802
Add extensibility support for ASEnvironmentLayoutOptionsState
2016-03-31 20:43:20 -07:00
Michael Schneider
96df35e41a
Initial commit for ASEnvironment
2016-03-31 20:43:20 -07:00
Huy Nguyen
387f3bf634
Properly lock layoutableContextMap
...
Signed-off-by: Huy Nguyen <huy@pinterest.com>
2016-03-29 13:40:57 -07:00
Scott Goodson
1ea1560694
[ASDisplayNode] Rasterized subnodes require special handling for __exitHierarchy.
2016-03-28 17:58:35 -07:00
Adlai Holler
f205a6cc28
Copy sublayers in recursivelyTriggerDisplayForLayer to avoid NSFastEnumerationMutation exception
2016-03-28 16:54:50 -07:00
Scott Goodson
096df7b385
[ASDisplayNode] Remove #if gating of ASDisplayNode hitTest: (I'd misread this as _ASDisplayView's implementation, and both are needed).
2016-03-28 07:49:14 -07:00
Scott Goodson
cd493358cc
[ASControlNode] Upgrades to +setEnableHitTestDebug: to intersect hitTestSlop with parents' bounds+slop, to accurately predict and visualize UIKit event delivery edge cases.
2016-03-27 22:02:13 -07:00
appleguy
97798010cb
Merge pull request #1443 from nguyenhuy/layoutable_context
...
[ASLayoutable] Introduce ASLayoutableContext, thread-local storage for layout passes.
2016-03-27 17:40:42 -07:00
Huy Nguyen
7bb3015950
Rename ASLayoutableContext methods
2016-03-27 17:38:41 -07:00
Huy Nguyen
81d26994c5
Introduce ASLayoutableContext
...
- The struct is mapped to ID of the current thread and used by subnodes to decide whether they should proceed measurement.
2016-03-27 17:09:59 -07:00
Scott Goodson
c6093cffdf
Fix assertion format specifier from previous commit.
2016-03-26 23:57:16 -07:00
Scott Goodson
6a887a8acf
[ASDisplayNode] Alternative implementation of interfaceState -> invisible that avoids a subclass call from -dealloc.
2016-03-26 23:24:30 -07:00
Scott Goodson
e59431e702
[ASDisplayNode] Restore dispatch_async for clearContents, to prevent discarding contents for nodes that are simply moving to a new container.
2016-03-22 18:39:23 -07:00
Scott Goodson
76b38cbe6e
[ASInterfaceState] Clear the "Visible" bit immediately upon deallocation, rather than waiting for ASRangeController on the next runloop.
2016-03-22 14:32:32 -07:00
Huy Nguyen
9e76d7b603
Add method to cancel layout transitions in progress
...
- Also make sure a transition isn't invalidated right after it passed the validation test and before it proceeds
2016-03-20 23:17:35 -07:00
appleguy
4297cb1eb5
Merge pull request #1398 from facebook/Placeholders
...
[ASDisplayNode] Placeholders should always be recreated if returning to cleared nodes, and remain until ASNetwork/MultiplexImageNode finish loading their image from the network.
2016-03-19 21:19:05 -07:00
Scott Goodson
8308a4ce49
[AsyncDisplayKit] Adopt #pragma once, remove last remaining dispatch_sync (UIScreen scale).
2016-03-19 19:56: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
Eric Jensen
6739a3a4ab
Condition logic simplification
2016-03-17 11:22:53 -07:00
Eric Jensen
17aebcbaba
Add a space between the ? and : in ternarys
2016-03-17 10:38:51 -07:00
appleguy
d9ef0922d8
Merge pull request #1354 from ejensen/cleanup
...
[Refactoring] Objective-C 2.0 / Modern syntax for arrays, dictionaries, numbers; logic simplification
2016-03-17 01:06:33 -07:00
appleguy
2ad9d83520
Merge pull request #1353 from ejensen/spelling
...
[Documentation] Correct spelling errors
2016-03-16 22:53:15 -07:00
Michael Schneider
19232ac493
Address pull request comments
2016-03-16 11:44:56 -07:00
Michael Schneider
d3ba80ccfd
Improvements for automatic range mode
...
- Only update range mode if visibility changes if the node is not range controlled
- Only change explicitly set range mode if ASRangeController becomes visible
- Return interface state for range controller in ASCollectionView and ASTableView based on if the containing node is range managed
2016-03-16 11:44:56 -07:00
appleguy
9b26d94da7
Merge pull request #1386 from maicki/ReplaceRecursiveCallsWithHelperFunction
...
[ASDisplayNode] Replace recursive methods with ASDisplayNodePerformBlockOnEveryNode
2016-03-16 11:20:17 -07:00
Eric Jensen
33fda7ab49
- Use modern Objective-C syntax.
...
- Simplify comparisons.
- Remove dead stores.
2016-03-15 22:34:29 -07:00
Eric Jensen
ddd5ff1f75
Correct spelling errors
2016-03-15 21:56:51 -07:00
appleguy
8fb18714ac
Merge pull request #1385 from maicki/DisplayNodePendingNodePropertyDeadlock
...
[ASDisplayNode] Remove unnecessary lock for subnode display notifications (main thread only), avoid potential deadlock by traversing up hierarchy.
2016-03-15 17:15:13 -07:00
Michael Schneider
f385fa8ada
Replace recursive methods with ASDisplayNodePerformBlockOnEveryNode function
2016-03-15 16:34:40 -07:00
Michael Schneider
b7a92b2947
Add documentation for visibilityDidChange:
2016-03-15 16:30:49 -07:00