18 Commits

Author SHA1 Message Date
Adlai Holler
56e69eac78
Initialize mutex assertion variables (#1226) 2018-11-08 13:07:46 -08:00
Adlai Holler
4cfc333d81
Clean up our mutex, fix try_lock not hooking into assert mechanism (#1219)
* Clean up our mutex

* Placement new import

* Privatize
2018-11-07 10:47:48 -08:00
Adlai Holler
5c9815f46d
ASThread: Remove Locker, Unlocker, and SharedMutex (#1213)
* ASThread: Remove Locker, Unlocker, and SharedMutex

* Remove extra line

* Kick the CI

* Move C++ down

* Fix thing
2018-11-05 13:26:36 -08:00
appleguy
465abb1ded [License] Simplify the Texture license to be pure Apache 2 (removing ASDK-Licenses). (#1077)
* [License] Simplify the Texture license to be pure Apache 2 (removing ASDK-Licenses)

With permission of the Facebook Open Source team, we are simplifying the Texture
license so that clients can rely on the Apache 2 terms that most of Texture is
already covered by. This means that code originally forked from AsyncDisplayKit
will be re-licensed from "BSD 3-clause + PATENTS v2" to Apache 2 without a
PATENTS file.

After getting confirmation that the updates to these core files look good, we'll
propagate this new license header to all files (in this same PR) and get sign-off
from all parties before landing.

* [License] Update all Texture source files to be pure Apache 2.

* Changelog entry for Apache 2 license update.

* Revert "[License] Update all Texture source files to be pure Apache 2."

This reverts commit ffa0fbbba9717d871dd16c4b07539f2f8208fc2b.

* [License] Update all Texture source files to be pure Apache 2, maintaining copyrights.

* [License] Update CONTRIBUTING, README, Podspec & Dangerfile.
2018-08-28 07:39:18 -07:00
Adlai Holler
f2912ecb48 Update lock-checking flag logic (#1032) 2018-07-15 19:57:12 -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
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
Adlai Holler
69e0c096e1
Remove unused/unneeded header macros (#973) 2018-06-18 11:38:02 -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
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
Adlai Holler
071bd7379f
Add experiment to skip creating UIViews altogether for constants (#881)
* Add experiment to skip creating UIViews altogether for constants

* Update changelog

* Do it right

* Annotate function

* Skip all the work entirely
2018-04-12 10:14:29 -07:00
Adlai Holler
4bbbd725de
Introduce ASRecursiveUnfairLock and tests (#858)
* Introduce ASRecursiveUnfairLock and tests

* Document it and put underscores to scare people away

* Increment changelog

* Integrate it with ASDN::Mutex behind experiment

* Rename the experiment

* Love these license headers oh so much

* Move internal header because we have to

* Address Jon's feedback
2018-03-28 11:29:50 -07:00
Adlai Holler
0f9b1e6789
Make objects conform to NSLocking (#851)
* Make display node, layout spec, and style conform to NSLocking so that users/subclasses can access their locks

* Update the changelog

* Align slashes

* Put it back, when we're in ASDisplayNode

* Go a little further

* Put back the changes I didn't mean to commit

* Kick the CI

* Fix yoga build

* Put back non-locking change

* Address comments from Scott
2018-03-25 10:46:04 -07:00
Huy Nguyen
8e0aa1ea73 Fix crashes caused by failing to unlock or destroy a static mutex while the app is being terminated (#577)
* Fix crashes caused by failing to unlock or destroy a static mutex while the app is being terminated

* Allocate static mutexes on the heap memory to avoid destruction at app exit

* ASThread to use ASDisplayNodeCAssert() instead of assert()
2017-09-22 11:53:41 +01:00
Adlai Holler
4829a8643d Improve System Trace Implementation #trivial (#368)
* Improve the kdebug, system trace integration

* Remove superseded subsystem

* Address review comments

* Please the license header gods

* Address harder

* Fix node block retaining collection view
2017-06-19 10:14:39 -07:00
Garrett Moon
8013e25524 Update license v2 (#67)
* Fixed license

* Update all licenses

* Update Dangerfile for new license

* Update already updated licenses

* Closer…

* Closer…

* Closer…

* Closer…

* Closer…

* Closer…

* Closer…

* Closer…

* Closer…

* Closer…

* Closer…
2017-04-24 16:59:57 -07:00
Huy Nguyen
c325ae2cb5 Move thread ownership assertion to ASThread (#3269) 2017-04-13 15:49:32 -07:00
Adlai Holler
73ca6ab514 Shuffle & Cleanup Stuff (#3080) 2017-02-26 18:14:13 -08:00