420 Commits

Author SHA1 Message Date
Michael Schneider
d9d5b12475
Improve locking situation in ASVideoPlayerNode (#1042)
* Improve locking in ASVideoPlayerNode

* Address comments
2018-07-20 15:27:28 -07:00
Flatout73
4b5b90f7a0 [ASTextNode] One more check variables before calling delegate method #trivial (#922) 2018-07-20 15:15:50 -07:00
Michael Schneider
736e200407 Fix warning for ASLayout method override for the designated initializer of the superclass '-init' not found #trivial (#1036)
* Fix warning for ASLayout method override for the designated initializer of the superclass '-init' not found

* Move unavailable init into header
2018-07-18 02:57:35 -07:00
Michael Schneider
b1f6030e86 Create and set delegate for clip corner layers within ASDisplayNode (#1029)
* Create and use ASDisplayNodeCornerLayerDelegate

* Return kCFNull for actionForLayer:forKey:
2018-07-18 02:56:37 -07:00
Adlai Holler
db0f515812
Revert unreleased layout debug method name change from #1030 #trivial (#1039)
* Revert unreleased layout debugging method name change from #1030 #trivial

* Eh make less changes
2018-07-17 21:08:29 -07:00
Adlai Holler
cf810acaa3
Fix the bug I introduced in #1030 (#1035) 2018-07-16 20:43:58 -07:00
Adlai Holler
6ed5ba29f8
Turn off exceptions to reduce binary size (-600KB for arm64) (#1033)
* Turn off exceptions to reduce binary size

* Changelog
2018-07-16 09:38:12 -07:00
Adlai Holler
f2912ecb48 Update lock-checking flag logic (#1032) 2018-07-15 19:57:12 -07:00
Adlai Holler
0b9f12716e
Remove NSMutableArray for retaining sublayout elements (#1030)
* Remove NSMutableArray for retaining sublayout elements

* Kick the CI

* Kick the CI again

* Smash that CI button

* Murder the CI
2018-07-15 18:41:23 -07:00
Adlai Holler
5cad23b925
Split framework dependencies into separate subspecs to reduce binary size and dynamic linking time when they're not needed (#1028) 2018-07-14 11:10:19 -07:00
Huy Nguyen
0dc97fbb2f
Stricter locking assertions (#1024)
- Rename `ASDisplayNodeAssertLockUnownedByCurrentThread` to `ASAssertUnlocked`, and `ASDisplayNodeAssertLockOwnedByCurrentThread` to `ASAssertLocked` -> shorter and hopefully easier to distinguish between the two.
- Add assertions to `_locked_` and `_u_` (i.e "unlocked") methods.
- Turn `CHECK_LOCKING_SAFETY` flag on by default. After #1022 and #1023, we're in a good shape to actually enforce locked/unlocked requirements of internal methods. Our test suite passed, and we'll test more at Pinterest after the sync this week.
- Fix ASVideoNode to avoid calling `play` while holding the lock. That method inserts a subnode and must be called lock free.
- Simplify `_loaded(node)` to only nil-check `_layer` because regardless of whether the node is view or layer backed, the layer should always be set if loaded. Use it throughout.
- Other minor changes.
2018-07-13 14:58:16 -07:00
Adlai Holler
af7f71f92d
Address warnings in Xcode >= 9.3 about using %zd for NSInteger (#1026) 2018-07-13 11:56:54 -07:00
Kevin
8986838b48 Add move detection and support to ASLayoutTransition (#1006)
* Add move detection and support to ASLayoutTransition

...and NSArray+Diffing.
Add some tests.

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update ASLayout+IGListKit.h

* Update ASLayout+IGListKit.mm

* Use std collections to avoid NSNumber boxing

* Update ASLayoutTransition.mm

* Code review updates.

* Use `unordered_multimap` on stack instead of unordered_map<id,queue> on heap
* Remove notFound BOOL (use NSNotFound sentinel value) and put some vars inside the if (insertions/moves) loop
* Don't copy defaultCompare block (redundant under ARC)
* Whitespace
* Remove unneeded mutableCopy-s in ArrayDiffingTests

* Code review updates.

* Type _subnodeMoves pair.first to ASDisplayNode * instead of id
* C++ enumeration
* unowned refs for adding previousLayout nodes to _subnodeMoves
* Remove unreleated ASDynamicCast that is probably right though

* Add commentary to NSArray+Diffing.h; make multimap elements unowned

* Use std::make_pair, optimize ASLayout+IGListKit

* Oops I thought I had added these headers but nope

* Simplify simplify

* Diff subnodes instead of sublayouts

* Another randomized test with actual ASLayouts
2018-07-13 10:19:03 -07:00
Adlai Holler
7c1aee7315
Fix i386 build by providing fallbacks to thread_local variables (#1025) 2018-07-12 21:09:24 -07:00
Michael Schneider
763332f2a7 Add showsHorizontal(Vertical)ScrollIndicator property applying from pending state (#1016) 2018-07-12 15:39:02 -07:00
Huy Nguyen
814fc382c7
Make sure -_completePendingLayoutTransition is called without the node's instance lock #trivial (#1023)
This is because committing the layout transition (aka `-_completeLayoutTransition:`) results in subnode insertions and removals which must be called lock-free.
2018-07-12 11:26:26 -07:00
Huy Nguyen
5ffcd405c6
Fix misleading/scary stack trace shown when an assertion occurs during node measurement (#1022)
- Currently, there is a pair of mutex unlock and unlock that wraps around `-_u_measureNodeWithBoundsIfNecessary:` in `__layout`. That is because this method must be called without the lock.
- When an assertion occurs within that method, the runtime bails early without reacquire the lock (so the lock is free now). However, the runtime then hits the end of the outmost mutex locker scope and tries to release the lock that it no longer holds, causing another assertion in ASThread to be shown to user (#932). This makes it extremely hard to idenfity the root assertion.
- Fix by replacing the unlock/lock pair with a mutex unlocker.
2018-07-12 11:25:35 -07:00
Sergey Pronin
a08d2210cf [IGListKit] Adds missing UIScrollViewDelegate method to DataSource proxy (#1015)
* Adds missing UIScrollViewDelegate method to IGListKit proxy implementation

* Updates CHANGELOG
2018-07-10 11:16:13 -07:00
Michael Schneider
55abeed743
Introduce let / var macros and some further cleanup (#1012)
* Introduce let / var and some further cleanup

* Address first comments

* Update changelog

* Move the const before auto
2018-07-10 09:37:53 -07:00
Michael Schneider
6c487dd26c
Properly consider node for responder methods (#1008)
* Properly consider node for responder methods

* Add changelog
2018-07-06 08:32:03 -07:00
Michael Schneider
d28b17c87f
Fix warnings and memory issues (#1003) 2018-07-03 08:39:49 -07:00
Adlai Holler
75594affe2
Remove yoga layout spec, which has been superseded (#999)
* Remove yoga layout spec, which has been superseded by tighter yoga-display node integration

* Changelog
2018-06-30 09:42:27 -07:00
Adlai Holler
77e2d28919
Create transfer-array method and use it (#987)
* Create transfer-array method and use it

* License headers

* Update ASArrayByFlatMapping
2018-06-29 18:21:55 -07:00
Garrett Moon
a4f78ad3e0
Adds support for having multiple interface state delegates. (#979)
* Adds support for having multiple interface state delegates.

Hopefully in a performant way.

* Switch to respondsToSelector for int del instead of separate object

* Add CHANGELOG

* Make ASDisplayNode+InterfaceState.h public

* Huy's comments

* Don't even bother removing since it's a weak hash table.
2018-06-27 16:52:40 -07:00
Michael Schneider
b82128ee4e
Add missing instance variables in ASTextNode and warnings cleanup #trivial (#984)
* Add missing instance variables in ASTextNode and warnings cleanup

* Re-add drain
2018-06-24 08:56:10 -07:00
Adlai Holler
0fe991f818
Optimize layout flattening (#982)
* Optimize layout flattening

* Changelog

* Remove whitespace

* Update ASLayout.mm

Add comment
2018-06-22 14:20:33 -07:00
Max Wang
fa0ef6fdd2 ASConfiguration version check only when have json dict (#971)
* fix SIMULATE_WEB_RESPONSE not imported #449

* Fix to make rangeMode update in right time

* remove uncessary assert

* avoid extra version log.

* check dictionary earlier
2018-06-19 09:20:34 -07:00
Adlai Holler
a0e5f4c002
Create an experiment to remove extra collection teardown step (#975)
* Create an experiment to remove extra collection teardown step, simplify delegate proxy

* chagelog

* Remove detritus
2018-06-19 08:32:02 -07:00
Andrei Titov
4669a24fdf Fixed removing node from supernode after layout transition (#937)
Fixed removing node from supernode after layout transition when automaticallyManagesSubnodes is disabled. In case if developer prefer to manage subnodes by himself then he wants to be sure that stack will not change automatically.
2018-06-18 18:43:09 -07:00
Max Wang
f4f1454be1 Pointer check #trivial (#970) 2018-06-18 18:38:26 -07:00
Adlai Holler
dbe469a94a
Standardize "extern" decls on AS_EXTERN (#972)
* Standardize "extern" decls on AS_EXTERN

* Rebase & remove from implementation files
2018-06-18 15:53:34 -07:00
Adlai Holler
69e0c096e1
Remove unused/unneeded header macros (#973) 2018-06-18 11:38:02 -07:00
Adlai Holler
a11506564a
Reduce usage of autorelease pools (#968)
* Reduce reliance on the autorelease pool

* changelog

* A few more places

* Use it in another place
2018-06-15 10:15:25 -07:00
Huy Nguyen
42ac10aac3
Fix crash when call needsMainThreadDeallocation on NSProxy instances #trivial (#965) 2018-06-12 19:32:11 +01:00
Max Wang
5c13cbe7a2 Fix method name typo in _locked_isLayoutTransitionInvalid #trivial (#963) 2018-06-12 08:56:37 +01:00
Adlai Holler
f6c5dc31e2
Generalize the main thread ivar dealloc stuff (#959) 2018-06-07 09:41:58 -07:00
Adlai Holler
35d59acd83
Add support for acquiring multiple locks at once (#958)
* Add ASLocking which supports -tryLock and taking multiple locks safely

* Better multi locking

* Assert about lock set capacity
2018-06-05 12:31:30 -07:00
Max Wang
9214e3c2ef Renew supplementary node on relayout (#842)
* fix SIMULATE_WEB_RESPONSE not imported #449

* Fix to make rangeMode update in right time

* Renew supplementary node on relayout.

* Add support for layoutDelegate (ASCollectionLayout).

* revert space

* Update change log

* fix build error

* refactor

* set default size

* return early when can delegate
2018-06-04 10:29:41 -07:00
Adlai Holler
21973c8840
Clean up async transaction system a bit (#955)
* Clean up async transaction system a bit

* Update changelog
2018-06-02 12:28:04 -07:00
Adlai Holler
ee06e97e0f
Make ASPerformMainThreadDeallocation visible in C (#952)
* Make ASPerformMainThreadDeallocation visible in C

* Update changelog
2018-06-01 13:54:46 -07:00
Huy Nguyen
8a4bb6cf06
[ASTableView] Generate a new cell layout if existing ones are invalid (#942) 2018-05-28 18:26:01 +03:00
Max Wang
62b07e100e Match interfacestate update sequence to uikit (#882)
* fix SIMULATE_WEB_RESPONSE not imported #449

* Fix to make rangeMode update in right time

* Match interface update closer to UIKit.

* allow the correct exiting sequence for thrashing

* refactor
2018-05-25 18:21:50 -07:00
Adlai Holler
cac14e0bce
Standardize Property Declaration Style in Core Classes (#870)
* Audit property attributes for core classes

* Update style guide

* Go crazy

* Update changelog
2018-05-24 14:42:43 -07:00
Adlai Holler
8b890f07be
Create a new dealloc queue that is more efficient (#931)
* Fork dealloc queue in an experiment

* Fix and put back

* Use the right selector

* Go simpler

* Clarify name

* Type inference

* Use CFTypeRefs like a boss

* Improve comments

* License header
2018-05-22 09:06:24 -07:00
appleguy
b2e5f9ec64 [ASTextNode2] Simplify compare-assign check & lock _pointScaleFactors accessor #trivial (#934) 2018-05-22 07:58:33 -07:00
Flo
ede9a7f929 [ASImageNode+AnimatedImage] Fix early return when animatedImage is nil in setAnimatedImage #trivial (#925)
* [ASNetworkImageNodeTests] Add defaultImage test and improve image test. #trivial

* [ASImageNode+AnimatedImage] Fix early return when animatedImage is nil in setAnimatedImage. #trivial
2018-05-21 13:09:01 -07:00
Huy Nguyen
b9ae6c4fa8
[ASDisplayNode] Fix an issue that causes a node to sometimes return an outdated calculated size or size range (#808) 2018-05-21 18:36:19 +01:00
Max Wang
06358d8662 Fix pager node for interface coalescing (#877)
* fix SIMULATE_WEB_RESPONSE not imported #449

* Fix to make rangeMode update in right time

* Fix pager node for interface coalescing

* Fix typo

* change log
2018-05-19 13:52:30 -07:00
appleguy
6799e26b03 [ASTextNode2] Upgrade lock safety by protecting all ivars (including rarely-changed ones). (#918)
* [ASTextNode2] Upgrade lock safety by protecting all ivars (including rarely-changed ones).

Although I don't know of any specific crashes caused by this, I think we should
lock all properties by default. There are also some indications of premature
optimization in keeping lock scope small, where it is actually important to
have transactional integrity, and also where the ASDisplayNode base class is
otherwise going to repeatedly re-lock the object anyway.

I think this will remain pretty efficient, especially with os_unfair_lock enabled.

* Use compare-assign macros
2018-05-19 12:47:06 -07:00
Max Wang
62dd3ca7ce Remove assert. fix #878 #914 (#924)
* fix SIMULATE_WEB_RESPONSE not imported #449

* Fix to make rangeMode update in right time

* remove uncessary assert
2018-05-17 15:55:13 -07:00