Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

How does one get a player head or some sort of NSNotification regarding how far into a video a user is? #1498

Closed
fresh83 opened this issue Apr 9, 2016 · 4 comments

Comments

@fresh83
Copy link

fresh83 commented Apr 9, 2016

The technical name escapes me, but im interested in adding a read only( as in the user will NOT be able to touch it or interfere with it) player head below my videos ...something like whats on the bottom of youtube videos that shows you how much video you have left to watch via a bar that fills as you watch.

I had such a thing prior to using this lib and while the improvements of using this lib are very clear, im a bit intimidated by it/unsure how to even begin to go about adding such a view.

@Eke
Copy link
Contributor

Eke commented Apr 9, 2016

@fresh83 ASVideoNode does not have such ability at this moment. if you are in AsyncDisplayKit slack channel, find me (emeskhi). I can give you my implementation of video player in ASCellNode

@hannahmbanana
Copy link
Contributor

@fresh83 - come join us on Slack! To join, email AsyncDisplayKit@gmail.com asking for an invite.

@appleguy
Copy link
Contributor

It would be great to support this bill team, but I believe you can implemented using the same techniques that you would if integrating with AVfoundation directly. Have you found that any of the necessary Apple APIs are obscured by the video node?

If that is the case, in other words if it blocks implementing it using whatever standard technique would be if you were using the player layer directly, that is a definite problem that I would like to you resolved even before adding support for a convenience implementation.

@hannahmbanana
Copy link
Contributor

@fresh83 - It appears this issue was resolved, if not feel free to re-open it.

aimalygin pushed a commit to aimalygin/AsyncDisplayKit that referenced this issue Sep 23, 2019
Revert "Ensure ASControlMode properties lock before accessing their ivars (facebookarchive#1476)"
This reverts commit ce1e195.

Revert "Make sure all ASDisplayNode properties have backing ivars for consistency. (facebookarchive#1475)"
This reverts commit d6061f4.
- Except the unused property `interfaceStateSuspended` is still removed (this is a memory saver).
aimalygin pushed a commit to aimalygin/AsyncDisplayKit that referenced this issue Sep 16, 2020
…bookarchive#1011)

* Extended IGListKit support for node deselect, highlight and unhighlight

* Proposal of renaming willDisplayItemWithNode and didEndDisplayingItemWithNode to be similiar to UICollectionView

* Extended support for IGListDisplayDelegate

* Updated changelog with displaying delegates change

* Removed extra deprecation supression flag

* Reverted ASCollectionNode changes and implemented displaing delegate with indexPathForNode:

* Sending a real UICollectionViewCell to the delegate if not nil

* Added safety check for nil indexPaths

* Discard any CHANGELOG changes for fix Danger error

* Add an experimental flag to use native dispatch_apply (facebookarchive#1345)

* Add an experimental flag to use native dispatch_apply instead of our core count * 2 approach. This has shown performance wins in some profiling.

* Add in other places

* Don't return non-animated GIFs for animation (update to latest PINRemoteImage beta) (facebookarchive#940)

* Don't return non-animated GIFs for animation

* Update to latest PINRemoteImage beta

* Fix typos  (facebookarchive#1348)

* Update containers-overview.md

* Update subclassing.md

* Update node-overview.md

ASImageNode, ASNetworkImageNode and ASMultiplexImageNode are in place of UIImageView, not UIImage.

* Revert "Have node and controller share lock (facebookarchive#1227)" (facebookarchive#1347)

This reverts commit 2baa943.

* Don't compile out ASExperimentalTextNode if ASTextNode is compiled out (facebookarchive#1353)

* Lock up to yogaRoot during layout to avoid deadlocks. (facebookarchive#1356)

* Lock up to yogaRoot during layout to avoid dead lock.

1) lock to root for tree
2) lock self to change parent (& consequently root)
3) Implement ASLocking (tryLock) on ASNodeController
4) add lockPair to try-lock node & controller together
5) lock controllers if they exist in lockToRoot...

Disable some asserts due to lock to root. :(

LL# No commands remaining.

* Add macro so non-Yoga still builds :)

* wut

* Update layout-transition-api.md (facebookarchive#1357)

* Optimize ASTwoDimensionalArrayUtils (facebookarchive#1351)

* Optimize ASTwoDimensionalArrayUtils

These methods are called on the main thread during range controller updates (i.e. every frame) and so they should be as fast as possible.

* Rename

* Use vector instead of stack array to handle really big cases (e.g. photos)

* If we check for batching before content size is available we'll always fetch (facebookarchive#1355)

* Do not lock the nodeController if we are not locking to root. (facebookarchive#1360)

Doing so leaves it locked when we elsewhere explicitly unlock the node to ascend.

* Resolve root constrained size before informing delegate to resolve infinite layout loop. (facebookarchive#1359)

* Add `setNeedsLayout` to yoga tree changes. (facebookarchive#1361)

* Make ASCollectionElement Public (facebookarchive#1303)

* Update AsyncDisplayKit.h

* Update project.pbxproj

* Optimize _assertSubnodeState (facebookarchive#1352)

* Optimize _assertSubnodeState

This method is actually pretty painful in today's world. In one iPad mini trace, the first page of nodes spent 6.6ms in this call, just in time profiler.

* Clean it up, check count

* Check the right value

* _ASCollectionViewCell - The point isn't converted before to send to node, impossible to touch button into the node hierarchy (facebookarchive#1362)

* Revert node call, useless, the node has a ASDisplayView, and this view forward on the node in first.

* Use convertPoint to convert the given point in hittest & pointInside methods.
Keep the standard usage if the node didn't rasterized a view.

* Removed isNodeLoaded, finally it's useless in this case
In these methods, we are on the mainThread, we can create the view if the view is not created.

* Optimize ASCATransactionQueue (facebookarchive#1350)

* Optimize ASCATransactionQueue. This queue is very busy, and it runs on the main thread so it's important for it to be fast.

Avoid waking up the run loop for every single node.
Avoid a ton of NSPointerArray overhead that we don't need.
Avoid retain/release traffic on the singleton by using an inline function. I confirmed that in release mode, the static __strong is correctly inlined and no ARC traffic is incurred.

* Comment

* Unlock right

* Remove magic number

* Cleanup Yoga Categories (facebookarchive#1364)

* Add forwarding of UIAccessibilityAction methods (facebookarchive#1344)

* Add forwarding of UIAccessibilityAction methods

* Use OCMock for testing UIAccessibilityAction method forwarding

* Don't add extraneous truncation token during kCTLineTruncationMiddle. (facebookarchive#1297)

* Don't add extraneous truncation token during kCTLineTruncationMiddle

* Expand these comments a little.

* Update the FAQ to throw less shade. (facebookarchive#1379)

* Update the FAQ to throw less shade.

Both of these technologies have their place, no point in being assholes.

* Update faq.md

* [Updated Snapshots] Don't add extraneous truncation token during kCTLineTruncationMiddle (facebookarchive#1375)

* Don't add extraneous truncation token during kCTLineTruncationMiddle

* Expand these comments a little.

* Update snapshot tests with beautiful correct behavior

* Launches switching ASNetworkImageNode callbacks to global queue. (facebookarchive#1369)

* Launches switching ASNetworkImageNode callbacks to global queue.

* Good catch configuration tests!

* Make ASTextNode2 more forgiving when searching for links (facebookarchive#1374)

* Make ASTextNode2 more forgiving when searching for links by searching a 44x44 square around the touch

* Trailing whitespace

* Safely handle end-of-line

* Experiment with different strategies for image downloader priority (facebookarchive#1349)

Right now when an image node enters preload state, we kick off an image request with the default priority. Then when it enters display state, we change the priority to "imminent" which is mapped to the default priority as well. This means that requests from preload and display nodes have the same priority and are put to the same pool. The right behavior would be that preload requests should have a lower priority from the beginning.

Another problem is that, due to the execution order of -didEnter(Preload|Display|Visible)State calls, a node may kick off a low priority request when it enters preload state even though it knows that it's also visible. By the time -didEnterVisibleState is called, the low priority request may have already been consumed and the download/data task won't pick up the new higher priority, or some work needs to be done to move it to another queue. A better behavior would be to always use the current interface state to determine the priority. This means that visible nodes will kick off high priority requests as soon as -didEnterPreloadState is called.

The last (and smaller) issue is that a node marks its request as preload/low priority as soon as it exits visible state. I'd argue that this is too agressive. It may be reasonble for nodes in the trailing direction. Even so, we already handle this case by (almost always) have smaller trailing buffers. So this diff makes sure that nodes that exited visible state will have imminent/default priority if they remain in the display range.

All of these new behaviors are wrapped in an experiment and will be tested carefully before being rolled out.

* Add imports

* Fix build failure

* Encapsulate common logics into methods

* Address comments

* Whoops, someone forgot an else! (facebookarchive#1385)

Luckily it seems this didn't cause huge memory bloat because there's
a check below that keeps the display flag from being set in low memory
conditions when the node is off the screen.

* Catch invalid sizes during yoga layout (facebookarchive#1376)

* Correct View vs. Layer here (tho it doesn't make any difference) (facebookarchive#1378)

Older FBSnapshot versions, however, don't use VerifyViewOrLayer

* Expose initial constrained size before layout in case anyone is interested later during the layout on the same thread. (facebookarchive#1377)

Optionally, clients are expected to clean it up after usage to avoid accessing outdated data.

* Assert for context creation failure during displayBlock. (facebookarchive#1373)

Nothing good can possibly happen if we continue without one.

* Fix an issue where state change notifications can be sent mulitple times. (facebookarchive#1372)

Before the change: both - (void)setShouldInvertStrongReference:(BOOL)shouldInvertStrongReference and - (void)setNode:(ASDisplayNode *)node will call through [self setupReferencesWithNode:node]; which call the [node addInterfaceStateDelegate:self];

* Add Yoga support to ASButtonNode (facebookarchive#1381)

* Add Yoga support to ASButtonNode

* Drop unowned ASLayoutElementStyle parameter

* Fix access of Yoga properties

* Move ASButtonNode Yoga logic to Category

* Update header

* Fix CTLineRef leaks (facebookarchive#1386)

Found by Clang Static Analyzer:

~/Texture/Source/ASTextNode2.mm:663:39: warning: Potential leak of an object stored into 'truncationTokenLine'
      CTLineRef truncationTokenLine = CTLineCreateWithAttributedString((CFAttributedStringRef)_truncationAttributedText);
                                      ^
~/Texture/Source/ASTextNode2.mm:666:49: warning: Potential leak of an object stored into 'additionalTruncationTokenLine'
      CTLineRef additionalTruncationTokenLine = CTLineCreateWithAttributedString((CFAttributedStringRef)_additionalTruncationMessage);
                                                ^
2 warnings generated.

* Correct attributes lookup for supplementary elements. (facebookarchive#1318)

* Need some more locks for working with calculated yoga layouts (facebookarchive#1388)

* Adds support for using UIGraphicsImageRenderer in ASTextNode. (facebookarchive#1384)

* Adds support for using UIGraphicsImageRenderer in ASTextNode.

In many cases this reduces the backing store of text nodes by 1/2.

* Guard for UIGraphicsRenderer availability.

* Comma

* Add UIDataSourceModelAssociation to ASTableView and ASCollectionView (facebookarchive#1354)

* Add UIDataSourceModelAssociation protocol conformance to ASTableView and ASCollectionView.

* Implementing review feedback from @Adlai-Holler

* Rename ASDN C++ namespace to AS (facebookarchive#1366)

* Rename ASDN C++ namespace to "AS." Referring to the framework as ASDisplayNode is pretty out-dated and verbose. See CoreAnimation which usees CA for their internal namespace.

More using

* More cases

* Clean up a clang analyzer cast error (facebookarchive#1387)

~/Texture/Source/Private/ASMutableElementMap.mm:32:24: warning: Conversion from value of type 'NSMutableArray<NSMutableArray *> *' to incompatible type 'ASMutableCollectionElementTwoDimensionalArray *'
    _sectionsOfItems = (id)ASTwoDimensionalArrayDeepMutableCopy(items);
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

* Update for 9.4.1 CI (facebookarchive#1392)

* Remove experimental features (exp_skip_a11y_wait && exp_new_default_cell_layout_mode) (facebookarchive#1383)

* Remove experimental features

* prevent blocking main thread

* remove small content all together as none is the default

* Update ASExperimentalFeatures.h

* Make experiment checks faster (facebookarchive#1393)

* Make experiment checks use dispatch_once when not debugging, clean up singleton

* One more

* Pull out the variable

* Make shared CA transaction queue variable extern so it's actually shared (facebookarchive#1397)

* Fix header typo (facebookarchive#1402)

* Context is a pretty general name that will cause conflicts with subclasses (facebookarchive#1399)

* Suppress documentation warnings when using external libraries (facebookarchive#1401)

Fixes 1400

* Add layer-action support to nodes (facebookarchive#1396)

* Add layer-action support to nodes, unify hierarchy notifications on it

* Better pending state

* Fix bool

* Skip extra copy

* Never run default actions

* Continue the search

* Avoid an unnecessary lock & unlock pair in ASMainSerialQueue (facebookarchive#1409)

* Add clang-format for a common source code format (facebookarchive#1365)

* Add clang-format

* Update format to be as close as our current style

* Fix GIF Caching (facebookarchive#1405)

* Add support for reverse direction to yoga layouts (facebookarchive#1413)

* Add support for reverse direction to yoga layouts

* #ifdef YOGA yoga-specific additions

* oops

* Only set ASLayoutElementStyle delegate if Yoga is enabled (facebookarchive#1417)

* Fix bug in ASRangeController that causes some cell nodes of a collection view which is about to becomes invisible to load their backing view/layer and render (facebookarchive#1418)

* Fix a bug with Yoga nodes whose position change and don't update. (facebookarchive#1408)

* Follow up on the ASRangeController fix in facebookarchive#1418 (facebookarchive#1419)

The changes in facebookarchive#1418 is a bit too aggressive when it comes to nodes that are in display range. It forces those nodes to not preload.

Also update the changes to avoid diluting the experiment data by triggering too broadly (i.e avoid triggering when the old and new implementations yield the same result leading to no behavior change).

* Dev docs for threading in Texture (facebookarchive#1319)

* Getting started on adding threading by example

* writing writing writing

* more info

* More threading

* More more more

* Threading

* self lock

* Some language fixes

* Update docs/_docs/development/threading.md

Co-Authored-By: mikezucc <mikezuccarino@gmail.com>

* fix image references

* Removed locked jekyll version (facebookarchive#1322)

* showcase.md updated (facebookarchive#1421)

* Experiment with disabling ASViewController background dealloc (facebookarchive#1420)

* [Experiment] Dont forget about these collection view background deallocs (facebookarchive#1424)

* Dont forget about these collection view background deallocs

* Also Table view for completeness

* Fix retain cycle with transaction operations (facebookarchive#1429)

Add unit tests that help find cycles. `-testWeakWithSingleOperation` fails without the code fix applied.

* Replace +load initializers with __attribute__((constructor)) functions (facebookarchive#1425)

* Replace +load initializers with __attribute__((constructor)) functions

* Updating the documentation for textureDidInitialize, per @nguyenhuy

* Fix dealloc on bg (facebookarchive#1410)

* fix SIMULATE_WEB_RESPONSE not imported facebookarchive#449

* Fix to make rangeMode update in right time

* remove uncessary assert

* Fix collection cell editing bug for iOS 9 & 10

* Revert "Fix collection cell editing bug for iOS 9 & 10"

This reverts commit 06e18a10596622ff8a68835c95a23986d7bf61ea.

* Fix dealloc long gesture in background

* Add support for clipping only specific corners, add unit tests (facebookarchive#1415)

* Add support for clipping only specific corners, add unit tests

* Remove some cleanup to make the diff smaller

* Fix

* [ASImageNode]fix incorrect backing size calculation (facebookarchive#1189)

* fix backing size for image node which content mode is scaleAspectFit

* chore: update comments and naming

* add change log

* Update CHANGELOG.md

* Update CHANGELOG.md

Co-Authored-By: junjielu <348649634@qq.com>

* add unit test for backing size calculation

* correct license

* Have image nodes draw into opaque contexts automatically if possible (facebookarchive#1432)

* Have image nodes draw into opaque contexts if the image is opaque and it fills the context

* Call backingSize once

* Fix typo in batch-fetching-api.md (facebookarchive#1437)

* [ASDisplayNode] Stop infinite layout in _u_measureNodeWithBoundsIfNecessary (facebookarchive#1434)

We came across an infinite layout loop in `_u_measureNodeWithBoundsIfNecessary`. After requesting a layout from above, the sizes between pending and caluclated layout still do not match. We continue to prefer to use the pending layout and ask for another layout loop from above. We can’t seem to break out of this loop. The solution (thanks to Huy for the guidance) was to nil out the pending layout we get from requesting the layout from above.

I was only able to reproduce this when working with a node in a `UINavigationBarItem’s` `titleView`. I think that UIKit must be doing something sneaky with setting the frame on the view. While I was not able to create a unit test to catch this issue (I tried for a long time, and can post what I’ve come up with to see if anyone has any suggestions), I was able to create a pretty simple example project that shows the behavior:
https://github.com/rcancro/TextureLayoutLoopExample

* Add a verbose log for locking operations. Has no effect in production (facebookarchive#1436)

* Add a verbose log for locking operations. Has no effect in production

* Need check

* Wrap transaction operation retain cycle fix in an experiment (facebookarchive#1438)

* Wrap transaction operation retain cycle fix in an experiment

This is a follow on to facebookarchive#1429.

* fix typo in experiment name. fix copyright in tests file.

* Fix scroll node in yoga (facebookarchive#1435)

* fix SIMULATE_WEB_RESPONSE not imported facebookarchive#449

* Fix to make rangeMode update in right time

* remove uncessary assert

* Fix collection cell editing bug for iOS 9 & 10

* Revert "Fix collection cell editing bug for iOS 9 & 10"

This reverts commit 06e18a10596622ff8a68835c95a23986d7bf61ea.

* Fix child not fit to full scroll node's bounds when flex_grow = 1.0 is used on child

* Fix the stub for layerActionForKey: to let CA continue the search (facebookarchive#1441)

* Fix the stub for layerActionForKey: to let CA continue the search

* Kick CI

* Revert "Have image nodes draw into opaque contexts automatically if possible (facebookarchive#1432)" (facebookarchive#1443)

This reverts commit 28522ce.

* Use instance lock for ASPrimitiveTraitCollection (facebookarchive#1442)

* Use instance lock for ASPrimitiveTraitCollection

* Remove the atomic

* Simplify ASTraitCollection propagation in ASViewController (facebookarchive#1447)

* Use AS::Mutex in ASCollectionElement (facebookarchive#1445)

* [ASTextNode] Maintain isAccessibilityElement setting on text nodes when updating text (facebookarchive#1326)

* Add didEnterHierarchy/didExitHierarchy to ASNodeController. (facebookarchive#1444)

* Fix wrongly formatted RELEASE link (facebookarchive#1453)

* Only create activities during debug (facebookarchive#1456)

* [facebookarchive#1451] Add support for UIAccessibilityCustomAction (facebookarchive#1452)

This PR adds support for UIAccessibilityCustomAction propagation through ASPendingState so that it can be picked up by VoiceOver.

* Shut down graphics contexts experiment (facebookarchive#1458)

* Shut down graphics contexts experiment

* Remove dead import

* Remove gone class

* Remove lock of ASTextNodeRendererKey (facebookarchive#1454)

* Remove lock of ASTextNodeRendererKey

* Remove class check for isEqual

* Add const specifier to function parameter

* Fixes typo

* Fixes typo

* Disable ASAssertLocked and ASAssertUnlocked (facebookarchive#1412)

* Try to remove global lock when initialising TextKit components (facebookarchive#1455)

* Try to remove global lock when initialising TextKit components

* Adding experiment flag to dis/enable lock of textkit component

* Adding tests

* code clean

fix typo

Make remove lock optional

Keep locks

code clean

* Make ASCollectionNode's pan gesture customizable (facebookarchive#1457)

* changes done

* complete set of uigesturedeleagte methods

* Remove iOS 8 support from logging code. (facebookarchive#1462)

* Drop support for Xcode 8 and fix some compiler warnings (facebookarchive#1463)

* Remove ASEventLog (facebookarchive#1460)

* Remove ASEventLog. We'll focus on ASLog for the future, possibly making it triggerable on a per-node basis

* See ya!

* Hello semicolon

* Remove refs to gone tree methods

* Fix

* Remove irrelevant change, kick CI

* Clean up

* Cover the other background dealloc surfaces (facebookarchive#1464)

* Passthrough pagingEnabled for ASCollectionNode / ASTableNode (facebookarchive#1466)

* Passthrough pagingEnabled for ASCollectionNode and ASTableNode

* Add tvOS handling

* Fix open context bug introduced in facebookarchive#1458 (facebookarchive#1468)

* Make sure all ASDisplayNode properties have backing ivars for consistency. (facebookarchive#1475)

* Make sure all ASDisplayNodes have backing ivars for consistency.

Found this by enabling #pragma clang diagnostic error "-Wobjc-missing-property-synthesis" for ASDisplayNode. One property is unused, saving 8 bytes of heap space per instance on 64-bit builds. Implement setter/getters for these properties, and add appropriate locking. add the warning as error to the build for this file.

* Ensure ASControlMode properties lock before accessing their ivars (facebookarchive#1476)

Enable `#pragma clang diagnostic error "-Wobjc-missing-property-synthesis"` for this file.

* Add a new "global drawing" experiment to use UIGraphicsRenderer (facebookarchive#1469)

* Add a new "global drawing" experiment to use UIGraphicsRenderer everywhere, when available

* Fix logic

* Use preferredFormat

* Cut version 2.8.1 (facebookarchive#1491)

* Clean up documentation issues around periods (facebookarchive#1490)

There were so unnecessary `'` around periods for some reason. Just deleting those because they are distracting.

* Minor update in change log #changelog (facebookarchive#1492)

* Ship ASExperimentalFixRangeController (facebookarchive#1486)

* Shrink _ASCollectionPendingState from 144 to 128 bytes, a 12.5% reduction (facebookarchive#1485)

* Shrink _ASCollectionPendingState from 144 to 128 bytes, a 12.5% reduction

These objects accumulate in the heap, so reducing their size will allow more to accumulate before memory warnings.

Group the `BOOL`s into a struct. Shrink the various stored `enum`s to fit the size of their contents. Move the ivars around so that the smaller `enum` are near eachother and the bitfield struct.

* address review comments. move enums out. add comment. rename struct to _flags

* fix a missing rename

* Shrink _ASPendingState from 824 to 808 bytes, reduction of ~2% (facebookarchive#1483)

* Shrink _ASPendingState from 824 to 808 bytes, reduction of ~2%

These objects accumulate in the heap, so reducing their size will allow more to accumulate before memory warnings.

Shrink ASPendingState BOOLs. Use unsigned int for these bitfields for clarity. Separate from `_flags` as that struct is compared to `0` for testing. The `_boolFlags` struct is just storing other `BOOL`s.

* rename struct fields as suggested in garret's review.

* Shrink ASDisplayNode from 1072 to 968 bytes, reduction of 10.74% (facebookarchive#1484)

* Shrink ASDisplayNode from 1088 to 976 bytes, reduction of 11.48%

These objects accumulate in the heap, so reducing their size will allow more to accumulate before memory warnings.

Group the `BOOL`s into a struct. Shrink the various stored `enum`s to fit the size of their contents. Move the ivars around so that the smaller `enum` are near eachother and the bitfield struct.

* Forgot to bit-field-ify placeholderEnable; new small size is 968, old size is 1072 (measured consistentlyl on iPhoneSE simulator). 10.74% reduction.

* Shrink Button Node (facebookarchive#1494)

Button: 1312 to 1288 bytes, running on iPhone SE simulator. 1.9% reduction.

Shrink the enums it stores, and place them next to each other (along with a BOOL) to reduce instance size.

* Shrink TextNode(2) (facebookarchive#1495)

Running in iPhone SE Simulator:
- ASTextNode: 1360 to 1352 bytes .6% reduction
- ASTextNode2: 1360 to 1304 bytes 4.3% redction

Shrink stored enum sizes. Group BOOLs near these smaller enums. Override -usingExperiment to return constant instead of never set, but allocated ivar.

* Shrink Pager and Scroll Node (facebookarchive#1496)

Running on iPhone SE Simulator:
ASPagerNode 1240 to 1232 bytes .7% reduction
ASScrollNode 1104 to 1096 bytes .7% reduction

- make ASScrollNode smaller by shrinking ASScrollDirection, which requires a change to ASRangeController
- shrink ASPagerNode by declaring the BOOL next to the struct

* Shrink ASImageNode by .6% and ASNetworkImageNode by 2.2% (facebookarchive#1487)

* Shrink ASImageNode by .6% and ASNetworkImageNode by 2.2%

ASImageNode goes from 1384 to 1376. ASNetworkImageNode goes from 1496 to 1464.

These objects accumulate in the heap, so reducing their size will allow more to accumulate before memory warnings.

Group the `BOOL`s into a struct. Shrink the various stored `enum`s to fit the size of their contents. Move the ivars around so that the smaller `enum` are near eachother and the bitfield struct.

* add comments as requested in garrett's review.

* access ivar directly since already locked as suggested in review.

* Remove unused declaration, missed in facebookarchive#1460 (facebookarchive#1497)

* Keep the atomics - does not affect memory work (facebookarchive#1498)

Revert "Ensure ASControlMode properties lock before accessing their ivars (facebookarchive#1476)"
This reverts commit ce1e195.

Revert "Make sure all ASDisplayNode properties have backing ivars for consistency. (facebookarchive#1475)"
This reverts commit d6061f4.
- Except the unused property `interfaceStateSuspended` is still removed (this is a memory saver).

* Shrink ASCellNode by 8 bytes (facebookarchive#1499)

Group the BOOLs together, since there are only 4 (and there are no other auto-generated ivars that are < 64 bits) this is sufficient and keeps the properties `atomic`.

* Shrink ASEditableTextNode by 16 bytes (facebookarchive#1500)

Just shuffle some BOOLs around and explicitly declare an ivar so it is grouped with the others.

* ASSignpost: Add support for the os_signpost API, fixes (facebookarchive#1501)

* ASSignpost: Add support for the os_signpost API

- Removes support for colored intervals. These weren't really useful and they aren't part of the signpost api.
- Fixes an issue with range controller interval logging.
- Adds an interval for interface orientation changes.

* Rename

* Support Xcode 9

* Commentary

* Shrink ASLayout (facebookarchive#1503)

- Shrink the enum. Save 8 bytes. There are 1000s of these in the heap after running Pinterest for 10 minutes.

* Cleanup whitespace #trivial (facebookarchive#1507)

(It's easier to deal with these as silly oneoffs IMO than to
have them conflated with real work)

* Shrink LayoutSpec classes (facebookarchive#1502)

- Resize enums to make `ASStackLayoutSpec` 40 bytes smaller. This applies to the subclasses too.

Co-authored-by: Adlai Holler <adlai@icloud.com>
Co-authored-by: Garrett Moon <garrett@pinterest.com>
Co-authored-by: dirtmelon <272485887@qq.com>
Co-authored-by: Michael Schneider <maicki@users.noreply.github.com>
Co-authored-by: Kevin <kevin@wode.com>
Co-authored-by: dirtmelon <0xffdirtmelon@gmail.com>
Co-authored-by: Jonathan Downing <jd@jonathandowning.uk>
Co-authored-by: Xavier Deloge <Idefix60@users.noreply.github.com>
Co-authored-by: Eric Scheers <smeis@users.noreply.github.com>
Co-authored-by: Huy Nguyen <allforone1511@gmail.com>
Co-authored-by: Greg Bolsinga <bolsinga@mac.com>
Co-authored-by: Jacob Farkas <farktronix@users.noreply.github.com>
Co-authored-by: ernestmama <43187788+ernestmama@users.noreply.github.com>
Co-authored-by: Andrew Yates <contact@andydev.co.uk>
Co-authored-by: Tim Norman <tim@normsoft.com>
Co-authored-by: Michael Zuccarino <mikezuccarino@gmail.com>
Co-authored-by: Dmitry Gridnev <dmitr.gridnev@gmail.com>
Co-authored-by: Max Wang <max.wang.cs@gmail.com>
Co-authored-by: Ballad <348649634@qq.com>
Co-authored-by: ricky <rickycancro@gmail.com>
Co-authored-by: Patrick Balestra <me@patrickbalestra.com>
Co-authored-by: Harry Shamansky <harry.shamansky@gmail.com>
Co-authored-by: Wu Zhong <zhongwuzw@qq.com>
Co-authored-by: Oskar Zhang <i@oskarzhang.me>
Co-authored-by: Adlai Holler <adlai@google.com>
Co-authored-by: Greg Bolsinga <gbolsinga@pinterest.com>
Co-authored-by: Huy Nguyen <huy@pinterest.com>
Co-authored-by: Andrew Monshizadeh <amonshiz+github@gmail.com>
aimalygin pushed a commit to aimalygin/AsyncDisplayKit that referenced this issue Sep 16, 2020
…t are subviews of UIScrollView (facebookarchive#1821)

* [Accessibility] Do not exclude elements outside the window’s rect that are subviews of UIScrollView

Previously I put up a diff to exclude accessibility elements that were outside of the current window rect. However, I didn’t take the case of scrollViews (including table and collection views) into consideration. By ignoring cells outside of the window, the scroll view would not advance to additional elements in the scrollView but off screen.

I did some side-by-side testing with UIKit and it appears that no elements are excluded that are in a scroll view, even if the element’s rect is outside of the scroll view’s visible rect. In order to match this behavior, I added a recursive superview check to see if an element that is off screen has a scrollView as a parent. If so, we do not exclude it:

```    if (!CGRectIntersectsRect(view.window.frame, nodeInWindowCoords) && !recusivelyCheckSuperviewsForScrollView(view)) {
        continue;
    }```

* fix some spacings

* force a build

* build bump again

* Removes unnecessary `-tearDown` code. (facebookarchive#1822)

* Update Texture.podspec (facebookarchive#1773)

3.0.0

* support cancelation in ASGraphicsCreateImage (facebookarchive#1814)

* support cancelation in ASGraphicsCreateImage

* updated comment

* [IGListKit] Extended IGListKit support for displaying delegates (facebookarchive#1011)

* Extended IGListKit support for node deselect, highlight and unhighlight

* Proposal of renaming willDisplayItemWithNode and didEndDisplayingItemWithNode to be similiar to UICollectionView

* Extended support for IGListDisplayDelegate

* Updated changelog with displaying delegates change

* Removed extra deprecation supression flag

* Reverted ASCollectionNode changes and implemented displaing delegate with indexPathForNode:

* Sending a real UICollectionViewCell to the delegate if not nil

* Added safety check for nil indexPaths

* Discard any CHANGELOG changes for fix Danger error

* Add an experimental flag to use native dispatch_apply (facebookarchive#1345)

* Add an experimental flag to use native dispatch_apply instead of our core count * 2 approach. This has shown performance wins in some profiling.

* Add in other places

* Don't return non-animated GIFs for animation (update to latest PINRemoteImage beta) (facebookarchive#940)

* Don't return non-animated GIFs for animation

* Update to latest PINRemoteImage beta

* Fix typos  (facebookarchive#1348)

* Update containers-overview.md

* Update subclassing.md

* Update node-overview.md

ASImageNode, ASNetworkImageNode and ASMultiplexImageNode are in place of UIImageView, not UIImage.

* Revert "Have node and controller share lock (facebookarchive#1227)" (facebookarchive#1347)

This reverts commit 2baa943.

* Don't compile out ASExperimentalTextNode if ASTextNode is compiled out (facebookarchive#1353)

* Lock up to yogaRoot during layout to avoid deadlocks. (facebookarchive#1356)

* Lock up to yogaRoot during layout to avoid dead lock.

1) lock to root for tree
2) lock self to change parent (& consequently root)
3) Implement ASLocking (tryLock) on ASNodeController
4) add lockPair to try-lock node & controller together
5) lock controllers if they exist in lockToRoot...

Disable some asserts due to lock to root. :(

LL# No commands remaining.

* Add macro so non-Yoga still builds :)

* wut

* Update layout-transition-api.md (facebookarchive#1357)

* Optimize ASTwoDimensionalArrayUtils (facebookarchive#1351)

* Optimize ASTwoDimensionalArrayUtils

These methods are called on the main thread during range controller updates (i.e. every frame) and so they should be as fast as possible.

* Rename

* Use vector instead of stack array to handle really big cases (e.g. photos)

* If we check for batching before content size is available we'll always fetch (facebookarchive#1355)

* Do not lock the nodeController if we are not locking to root. (facebookarchive#1360)

Doing so leaves it locked when we elsewhere explicitly unlock the node to ascend.

* Resolve root constrained size before informing delegate to resolve infinite layout loop. (facebookarchive#1359)

* Add `setNeedsLayout` to yoga tree changes. (facebookarchive#1361)

* Make ASCollectionElement Public (facebookarchive#1303)

* Update AsyncDisplayKit.h

* Update project.pbxproj

* Optimize _assertSubnodeState (facebookarchive#1352)

* Optimize _assertSubnodeState

This method is actually pretty painful in today's world. In one iPad mini trace, the first page of nodes spent 6.6ms in this call, just in time profiler.

* Clean it up, check count

* Check the right value

* _ASCollectionViewCell - The point isn't converted before to send to node, impossible to touch button into the node hierarchy (facebookarchive#1362)

* Revert node call, useless, the node has a ASDisplayView, and this view forward on the node in first.

* Use convertPoint to convert the given point in hittest & pointInside methods.
Keep the standard usage if the node didn't rasterized a view.

* Removed isNodeLoaded, finally it's useless in this case
In these methods, we are on the mainThread, we can create the view if the view is not created.

* Optimize ASCATransactionQueue (facebookarchive#1350)

* Optimize ASCATransactionQueue. This queue is very busy, and it runs on the main thread so it's important for it to be fast.

Avoid waking up the run loop for every single node.
Avoid a ton of NSPointerArray overhead that we don't need.
Avoid retain/release traffic on the singleton by using an inline function. I confirmed that in release mode, the static __strong is correctly inlined and no ARC traffic is incurred.

* Comment

* Unlock right

* Remove magic number

* Cleanup Yoga Categories (facebookarchive#1364)

* Add forwarding of UIAccessibilityAction methods (facebookarchive#1344)

* Add forwarding of UIAccessibilityAction methods

* Use OCMock for testing UIAccessibilityAction method forwarding

* Don't add extraneous truncation token during kCTLineTruncationMiddle. (facebookarchive#1297)

* Don't add extraneous truncation token during kCTLineTruncationMiddle

* Expand these comments a little.

* Update the FAQ to throw less shade. (facebookarchive#1379)

* Update the FAQ to throw less shade.

Both of these technologies have their place, no point in being assholes.

* Update faq.md

* [Updated Snapshots] Don't add extraneous truncation token during kCTLineTruncationMiddle (facebookarchive#1375)

* Don't add extraneous truncation token during kCTLineTruncationMiddle

* Expand these comments a little.

* Update snapshot tests with beautiful correct behavior

* Launches switching ASNetworkImageNode callbacks to global queue. (facebookarchive#1369)

* Launches switching ASNetworkImageNode callbacks to global queue.

* Good catch configuration tests!

* Make ASTextNode2 more forgiving when searching for links (facebookarchive#1374)

* Make ASTextNode2 more forgiving when searching for links by searching a 44x44 square around the touch

* Trailing whitespace

* Safely handle end-of-line

* Experiment with different strategies for image downloader priority (facebookarchive#1349)

Right now when an image node enters preload state, we kick off an image request with the default priority. Then when it enters display state, we change the priority to "imminent" which is mapped to the default priority as well. This means that requests from preload and display nodes have the same priority and are put to the same pool. The right behavior would be that preload requests should have a lower priority from the beginning.

Another problem is that, due to the execution order of -didEnter(Preload|Display|Visible)State calls, a node may kick off a low priority request when it enters preload state even though it knows that it's also visible. By the time -didEnterVisibleState is called, the low priority request may have already been consumed and the download/data task won't pick up the new higher priority, or some work needs to be done to move it to another queue. A better behavior would be to always use the current interface state to determine the priority. This means that visible nodes will kick off high priority requests as soon as -didEnterPreloadState is called.

The last (and smaller) issue is that a node marks its request as preload/low priority as soon as it exits visible state. I'd argue that this is too agressive. It may be reasonble for nodes in the trailing direction. Even so, we already handle this case by (almost always) have smaller trailing buffers. So this diff makes sure that nodes that exited visible state will have imminent/default priority if they remain in the display range.

All of these new behaviors are wrapped in an experiment and will be tested carefully before being rolled out.

* Add imports

* Fix build failure

* Encapsulate common logics into methods

* Address comments

* Whoops, someone forgot an else! (facebookarchive#1385)

Luckily it seems this didn't cause huge memory bloat because there's
a check below that keeps the display flag from being set in low memory
conditions when the node is off the screen.

* Catch invalid sizes during yoga layout (facebookarchive#1376)

* Correct View vs. Layer here (tho it doesn't make any difference) (facebookarchive#1378)

Older FBSnapshot versions, however, don't use VerifyViewOrLayer

* Expose initial constrained size before layout in case anyone is interested later during the layout on the same thread. (facebookarchive#1377)

Optionally, clients are expected to clean it up after usage to avoid accessing outdated data.

* Assert for context creation failure during displayBlock. (facebookarchive#1373)

Nothing good can possibly happen if we continue without one.

* Fix an issue where state change notifications can be sent mulitple times. (facebookarchive#1372)

Before the change: both - (void)setShouldInvertStrongReference:(BOOL)shouldInvertStrongReference and - (void)setNode:(ASDisplayNode *)node will call through [self setupReferencesWithNode:node]; which call the [node addInterfaceStateDelegate:self];

* Add Yoga support to ASButtonNode (facebookarchive#1381)

* Add Yoga support to ASButtonNode

* Drop unowned ASLayoutElementStyle parameter

* Fix access of Yoga properties

* Move ASButtonNode Yoga logic to Category

* Update header

* Fix CTLineRef leaks (facebookarchive#1386)

Found by Clang Static Analyzer:

~/Texture/Source/ASTextNode2.mm:663:39: warning: Potential leak of an object stored into 'truncationTokenLine'
      CTLineRef truncationTokenLine = CTLineCreateWithAttributedString((CFAttributedStringRef)_truncationAttributedText);
                                      ^
~/Texture/Source/ASTextNode2.mm:666:49: warning: Potential leak of an object stored into 'additionalTruncationTokenLine'
      CTLineRef additionalTruncationTokenLine = CTLineCreateWithAttributedString((CFAttributedStringRef)_additionalTruncationMessage);
                                                ^
2 warnings generated.

* Correct attributes lookup for supplementary elements. (facebookarchive#1318)

* Need some more locks for working with calculated yoga layouts (facebookarchive#1388)

* Adds support for using UIGraphicsImageRenderer in ASTextNode. (facebookarchive#1384)

* Adds support for using UIGraphicsImageRenderer in ASTextNode.

In many cases this reduces the backing store of text nodes by 1/2.

* Guard for UIGraphicsRenderer availability.

* Comma

* Add UIDataSourceModelAssociation to ASTableView and ASCollectionView (facebookarchive#1354)

* Add UIDataSourceModelAssociation protocol conformance to ASTableView and ASCollectionView.

* Implementing review feedback from @Adlai-Holler

* Rename ASDN C++ namespace to AS (facebookarchive#1366)

* Rename ASDN C++ namespace to "AS." Referring to the framework as ASDisplayNode is pretty out-dated and verbose. See CoreAnimation which usees CA for their internal namespace.

More using

* More cases

* Clean up a clang analyzer cast error (facebookarchive#1387)

~/Texture/Source/Private/ASMutableElementMap.mm:32:24: warning: Conversion from value of type 'NSMutableArray<NSMutableArray *> *' to incompatible type 'ASMutableCollectionElementTwoDimensionalArray *'
    _sectionsOfItems = (id)ASTwoDimensionalArrayDeepMutableCopy(items);
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

* Update for 9.4.1 CI (facebookarchive#1392)

* Remove experimental features (exp_skip_a11y_wait && exp_new_default_cell_layout_mode) (facebookarchive#1383)

* Remove experimental features

* prevent blocking main thread

* remove small content all together as none is the default

* Update ASExperimentalFeatures.h

* Make experiment checks faster (facebookarchive#1393)

* Make experiment checks use dispatch_once when not debugging, clean up singleton

* One more

* Pull out the variable

* Make shared CA transaction queue variable extern so it's actually shared (facebookarchive#1397)

* Fix header typo (facebookarchive#1402)

* Context is a pretty general name that will cause conflicts with subclasses (facebookarchive#1399)

* Suppress documentation warnings when using external libraries (facebookarchive#1401)

Fixes 1400

* Add layer-action support to nodes (facebookarchive#1396)

* Add layer-action support to nodes, unify hierarchy notifications on it

* Better pending state

* Fix bool

* Skip extra copy

* Never run default actions

* Continue the search

* Avoid an unnecessary lock & unlock pair in ASMainSerialQueue (facebookarchive#1409)

* Add clang-format for a common source code format (facebookarchive#1365)

* Add clang-format

* Update format to be as close as our current style

* Fix GIF Caching (facebookarchive#1405)

* Add support for reverse direction to yoga layouts (facebookarchive#1413)

* Add support for reverse direction to yoga layouts

* #ifdef YOGA yoga-specific additions

* oops

* Only set ASLayoutElementStyle delegate if Yoga is enabled (facebookarchive#1417)

* Fix bug in ASRangeController that causes some cell nodes of a collection view which is about to becomes invisible to load their backing view/layer and render (facebookarchive#1418)

* Fix a bug with Yoga nodes whose position change and don't update. (facebookarchive#1408)

* Follow up on the ASRangeController fix in facebookarchive#1418 (facebookarchive#1419)

The changes in facebookarchive#1418 is a bit too aggressive when it comes to nodes that are in display range. It forces those nodes to not preload.

Also update the changes to avoid diluting the experiment data by triggering too broadly (i.e avoid triggering when the old and new implementations yield the same result leading to no behavior change).

* Dev docs for threading in Texture (facebookarchive#1319)

* Getting started on adding threading by example

* writing writing writing

* more info

* More threading

* More more more

* Threading

* self lock

* Some language fixes

* Update docs/_docs/development/threading.md

Co-Authored-By: mikezucc <mikezuccarino@gmail.com>

* fix image references

* Removed locked jekyll version (facebookarchive#1322)

* showcase.md updated (facebookarchive#1421)

* Experiment with disabling ASViewController background dealloc (facebookarchive#1420)

* [Experiment] Dont forget about these collection view background deallocs (facebookarchive#1424)

* Dont forget about these collection view background deallocs

* Also Table view for completeness

* Fix retain cycle with transaction operations (facebookarchive#1429)

Add unit tests that help find cycles. `-testWeakWithSingleOperation` fails without the code fix applied.

* Replace +load initializers with __attribute__((constructor)) functions (facebookarchive#1425)

* Replace +load initializers with __attribute__((constructor)) functions

* Updating the documentation for textureDidInitialize, per @nguyenhuy

* Fix dealloc on bg (facebookarchive#1410)

* fix SIMULATE_WEB_RESPONSE not imported facebookarchive#449

* Fix to make rangeMode update in right time

* remove uncessary assert

* Fix collection cell editing bug for iOS 9 & 10

* Revert "Fix collection cell editing bug for iOS 9 & 10"

This reverts commit 06e18a10596622ff8a68835c95a23986d7bf61ea.

* Fix dealloc long gesture in background

* Add support for clipping only specific corners, add unit tests (facebookarchive#1415)

* Add support for clipping only specific corners, add unit tests

* Remove some cleanup to make the diff smaller

* Fix

* [ASImageNode]fix incorrect backing size calculation (facebookarchive#1189)

* fix backing size for image node which content mode is scaleAspectFit

* chore: update comments and naming

* add change log

* Update CHANGELOG.md

* Update CHANGELOG.md

Co-Authored-By: junjielu <348649634@qq.com>

* add unit test for backing size calculation

* correct license

* Have image nodes draw into opaque contexts automatically if possible (facebookarchive#1432)

* Have image nodes draw into opaque contexts if the image is opaque and it fills the context

* Call backingSize once

* Fix typo in batch-fetching-api.md (facebookarchive#1437)

* [ASDisplayNode] Stop infinite layout in _u_measureNodeWithBoundsIfNecessary (facebookarchive#1434)

We came across an infinite layout loop in `_u_measureNodeWithBoundsIfNecessary`. After requesting a layout from above, the sizes between pending and caluclated layout still do not match. We continue to prefer to use the pending layout and ask for another layout loop from above. We can’t seem to break out of this loop. The solution (thanks to Huy for the guidance) was to nil out the pending layout we get from requesting the layout from above.

I was only able to reproduce this when working with a node in a `UINavigationBarItem’s` `titleView`. I think that UIKit must be doing something sneaky with setting the frame on the view. While I was not able to create a unit test to catch this issue (I tried for a long time, and can post what I’ve come up with to see if anyone has any suggestions), I was able to create a pretty simple example project that shows the behavior:
https://github.com/rcancro/TextureLayoutLoopExample

* Add a verbose log for locking operations. Has no effect in production (facebookarchive#1436)

* Add a verbose log for locking operations. Has no effect in production

* Need check

* Wrap transaction operation retain cycle fix in an experiment (facebookarchive#1438)

* Wrap transaction operation retain cycle fix in an experiment

This is a follow on to facebookarchive#1429.

* fix typo in experiment name. fix copyright in tests file.

* Fix scroll node in yoga (facebookarchive#1435)

* fix SIMULATE_WEB_RESPONSE not imported facebookarchive#449

* Fix to make rangeMode update in right time

* remove uncessary assert

* Fix collection cell editing bug for iOS 9 & 10

* Revert "Fix collection cell editing bug for iOS 9 & 10"

This reverts commit 06e18a10596622ff8a68835c95a23986d7bf61ea.

* Fix child not fit to full scroll node's bounds when flex_grow = 1.0 is used on child

* Fix the stub for layerActionForKey: to let CA continue the search (facebookarchive#1441)

* Fix the stub for layerActionForKey: to let CA continue the search

* Kick CI

* Revert "Have image nodes draw into opaque contexts automatically if possible (facebookarchive#1432)" (facebookarchive#1443)

This reverts commit 28522ce.

* Use instance lock for ASPrimitiveTraitCollection (facebookarchive#1442)

* Use instance lock for ASPrimitiveTraitCollection

* Remove the atomic

* Simplify ASTraitCollection propagation in ASViewController (facebookarchive#1447)

* Use AS::Mutex in ASCollectionElement (facebookarchive#1445)

* [ASTextNode] Maintain isAccessibilityElement setting on text nodes when updating text (facebookarchive#1326)

* Add didEnterHierarchy/didExitHierarchy to ASNodeController. (facebookarchive#1444)

* Fix wrongly formatted RELEASE link (facebookarchive#1453)

* Only create activities during debug (facebookarchive#1456)

* [facebookarchive#1451] Add support for UIAccessibilityCustomAction (facebookarchive#1452)

This PR adds support for UIAccessibilityCustomAction propagation through ASPendingState so that it can be picked up by VoiceOver.

* Shut down graphics contexts experiment (facebookarchive#1458)

* Shut down graphics contexts experiment

* Remove dead import

* Remove gone class

* Remove lock of ASTextNodeRendererKey (facebookarchive#1454)

* Remove lock of ASTextNodeRendererKey

* Remove class check for isEqual

* Add const specifier to function parameter

* Fixes typo

* Fixes typo

* Disable ASAssertLocked and ASAssertUnlocked (facebookarchive#1412)

* Try to remove global lock when initialising TextKit components (facebookarchive#1455)

* Try to remove global lock when initialising TextKit components

* Adding experiment flag to dis/enable lock of textkit component

* Adding tests

* code clean

fix typo

Make remove lock optional

Keep locks

code clean

* Make ASCollectionNode's pan gesture customizable (facebookarchive#1457)

* changes done

* complete set of uigesturedeleagte methods

* Remove iOS 8 support from logging code. (facebookarchive#1462)

* Drop support for Xcode 8 and fix some compiler warnings (facebookarchive#1463)

* Remove ASEventLog (facebookarchive#1460)

* Remove ASEventLog. We'll focus on ASLog for the future, possibly making it triggerable on a per-node basis

* See ya!

* Hello semicolon

* Remove refs to gone tree methods

* Fix

* Remove irrelevant change, kick CI

* Clean up

* Cover the other background dealloc surfaces (facebookarchive#1464)

* Passthrough pagingEnabled for ASCollectionNode / ASTableNode (facebookarchive#1466)

* Passthrough pagingEnabled for ASCollectionNode and ASTableNode

* Add tvOS handling

* Fix open context bug introduced in facebookarchive#1458 (facebookarchive#1468)

* Make sure all ASDisplayNode properties have backing ivars for consistency. (facebookarchive#1475)

* Make sure all ASDisplayNodes have backing ivars for consistency.

Found this by enabling #pragma clang diagnostic error "-Wobjc-missing-property-synthesis" for ASDisplayNode. One property is unused, saving 8 bytes of heap space per instance on 64-bit builds. Implement setter/getters for these properties, and add appropriate locking. add the warning as error to the build for this file.

* Ensure ASControlMode properties lock before accessing their ivars (facebookarchive#1476)

Enable `#pragma clang diagnostic error "-Wobjc-missing-property-synthesis"` for this file.

* Add a new "global drawing" experiment to use UIGraphicsRenderer (facebookarchive#1469)

* Add a new "global drawing" experiment to use UIGraphicsRenderer everywhere, when available

* Fix logic

* Use preferredFormat

* Cut version 2.8.1 (facebookarchive#1491)

* Clean up documentation issues around periods (facebookarchive#1490)

There were so unnecessary `'` around periods for some reason. Just deleting those because they are distracting.

* Minor update in change log #changelog (facebookarchive#1492)

* Ship ASExperimentalFixRangeController (facebookarchive#1486)

* Shrink _ASCollectionPendingState from 144 to 128 bytes, a 12.5% reduction (facebookarchive#1485)

* Shrink _ASCollectionPendingState from 144 to 128 bytes, a 12.5% reduction

These objects accumulate in the heap, so reducing their size will allow more to accumulate before memory warnings.

Group the `BOOL`s into a struct. Shrink the various stored `enum`s to fit the size of their contents. Move the ivars around so that the smaller `enum` are near eachother and the bitfield struct.

* address review comments. move enums out. add comment. rename struct to _flags

* fix a missing rename

* Shrink _ASPendingState from 824 to 808 bytes, reduction of ~2% (facebookarchive#1483)

* Shrink _ASPendingState from 824 to 808 bytes, reduction of ~2%

These objects accumulate in the heap, so reducing their size will allow more to accumulate before memory warnings.

Shrink ASPendingState BOOLs. Use unsigned int for these bitfields for clarity. Separate from `_flags` as that struct is compared to `0` for testing. The `_boolFlags` struct is just storing other `BOOL`s.

* rename struct fields as suggested in garret's review.

* Shrink ASDisplayNode from 1072 to 968 bytes, reduction of 10.74% (facebookarchive#1484)

* Shrink ASDisplayNode from 1088 to 976 bytes, reduction of 11.48%

These objects accumulate in the heap, so reducing their size will allow more to accumulate before memory warnings.

Group the `BOOL`s into a struct. Shrink the various stored `enum`s to fit the size of their contents. Move the ivars around so that the smaller `enum` are near eachother and the bitfield struct.

* Forgot to bit-field-ify placeholderEnable; new small size is 968, old size is 1072 (measured consistentlyl on iPhoneSE simulator). 10.74% reduction.

* Shrink Button Node (facebookarchive#1494)

Button: 1312 to 1288 bytes, running on iPhone SE simulator. 1.9% reduction.

Shrink the enums it stores, and place them next to each other (along with a BOOL) to reduce instance size.

* Shrink TextNode(2) (facebookarchive#1495)

Running in iPhone SE Simulator:
- ASTextNode: 1360 to 1352 bytes .6% reduction
- ASTextNode2: 1360 to 1304 bytes 4.3% redction

Shrink stored enum sizes. Group BOOLs near these smaller enums. Override -usingExperiment to return constant instead of never set, but allocated ivar.

* Shrink Pager and Scroll Node (facebookarchive#1496)

Running on iPhone SE Simulator:
ASPagerNode 1240 to 1232 bytes .7% reduction
ASScrollNode 1104 to 1096 bytes .7% reduction

- make ASScrollNode smaller by shrinking ASScrollDirection, which requires a change to ASRangeController
- shrink ASPagerNode by declaring the BOOL next to the struct

* Shrink ASImageNode by .6% and ASNetworkImageNode by 2.2% (facebookarchive#1487)

* Shrink ASImageNode by .6% and ASNetworkImageNode by 2.2%

ASImageNode goes from 1384 to 1376. ASNetworkImageNode goes from 1496 to 1464.

These objects accumulate in the heap, so reducing their size will allow more to accumulate before memory warnings.

Group the `BOOL`s into a struct. Shrink the various stored `enum`s to fit the size of their contents. Move the ivars around so that the smaller `enum` are near eachother and the bitfield struct.

* add comments as requested in garrett's review.

* access ivar directly since already locked as suggested in review.

* Remove unused declaration, missed in facebookarchive#1460 (facebookarchive#1497)

* Keep the atomics - does not affect memory work (facebookarchive#1498)

Revert "Ensure ASControlMode properties lock before accessing their ivars (facebookarchive#1476)"
This reverts commit ce1e195.

Revert "Make sure all ASDisplayNode properties have backing ivars for consistency. (facebookarchive#1475)"
This reverts commit d6061f4.
- Except the unused property `interfaceStateSuspended` is still removed (this is a memory saver).

* Shrink ASCellNode by 8 bytes (facebookarchive#1499)

Group the BOOLs together, since there are only 4 (and there are no other auto-generated ivars that are < 64 bits) this is sufficient and keeps the properties `atomic`.

* Shrink ASEditableTextNode by 16 bytes (facebookarchive#1500)

Just shuffle some BOOLs around and explicitly declare an ivar so it is grouped with the others.

* ASSignpost: Add support for the os_signpost API, fixes (facebookarchive#1501)

* ASSignpost: Add support for the os_signpost API

- Removes support for colored intervals. These weren't really useful and they aren't part of the signpost api.
- Fixes an issue with range controller interval logging.
- Adds an interval for interface orientation changes.

* Rename

* Support Xcode 9

* Commentary

* Shrink ASLayout (facebookarchive#1503)

- Shrink the enum. Save 8 bytes. There are 1000s of these in the heap after running Pinterest for 10 minutes.

* Cleanup whitespace #trivial (facebookarchive#1507)

(It's easier to deal with these as silly oneoffs IMO than to
have them conflated with real work)

* Shrink LayoutSpec classes (facebookarchive#1502)

- Resize enums to make `ASStackLayoutSpec` 40 bytes smaller. This applies to the subclasses too.

Co-authored-by: Adlai Holler <adlai@icloud.com>
Co-authored-by: Garrett Moon <garrett@pinterest.com>
Co-authored-by: dirtmelon <272485887@qq.com>
Co-authored-by: Michael Schneider <maicki@users.noreply.github.com>
Co-authored-by: Kevin <kevin@wode.com>
Co-authored-by: dirtmelon <0xffdirtmelon@gmail.com>
Co-authored-by: Jonathan Downing <jd@jonathandowning.uk>
Co-authored-by: Xavier Deloge <Idefix60@users.noreply.github.com>
Co-authored-by: Eric Scheers <smeis@users.noreply.github.com>
Co-authored-by: Huy Nguyen <allforone1511@gmail.com>
Co-authored-by: Greg Bolsinga <bolsinga@mac.com>
Co-authored-by: Jacob Farkas <farktronix@users.noreply.github.com>
Co-authored-by: ernestmama <43187788+ernestmama@users.noreply.github.com>
Co-authored-by: Andrew Yates <contact@andydev.co.uk>
Co-authored-by: Tim Norman <tim@normsoft.com>
Co-authored-by: Michael Zuccarino <mikezuccarino@gmail.com>
Co-authored-by: Dmitry Gridnev <dmitr.gridnev@gmail.com>
Co-authored-by: Max Wang <max.wang.cs@gmail.com>
Co-authored-by: Ballad <348649634@qq.com>
Co-authored-by: ricky <rickycancro@gmail.com>
Co-authored-by: Patrick Balestra <me@patrickbalestra.com>
Co-authored-by: Harry Shamansky <harry.shamansky@gmail.com>
Co-authored-by: Wu Zhong <zhongwuzw@qq.com>
Co-authored-by: Oskar Zhang <i@oskarzhang.me>
Co-authored-by: Adlai Holler <adlai@google.com>
Co-authored-by: Greg Bolsinga <gbolsinga@pinterest.com>
Co-authored-by: Huy Nguyen <huy@pinterest.com>
Co-authored-by: Andrew Monshizadeh <amonshiz+github@gmail.com>

* use iOS 13.4.1 and default Xcode 11.4.1 for CI (facebookarchive#1831)

Co-authored-by: dmaclach <dmaclach@gmail.com>
Co-authored-by: Jeffrey Macko <mackoj@users.noreply.github.com>
Co-authored-by: vovasty <vlad@aramzamzam.net>
Co-authored-by: Heberti Almeida <hebertialmeida@gmail.com>
Co-authored-by: Adlai Holler <adlai@icloud.com>
Co-authored-by: Garrett Moon <garrett@pinterest.com>
Co-authored-by: dirtmelon <272485887@qq.com>
Co-authored-by: Michael Schneider <maicki@users.noreply.github.com>
Co-authored-by: Kevin <kevin@wode.com>
Co-authored-by: dirtmelon <0xffdirtmelon@gmail.com>
Co-authored-by: Jonathan Downing <jd@jonathandowning.uk>
Co-authored-by: Xavier Deloge <Idefix60@users.noreply.github.com>
Co-authored-by: Eric Scheers <smeis@users.noreply.github.com>
Co-authored-by: Huy Nguyen <allforone1511@gmail.com>
Co-authored-by: Greg Bolsinga <bolsinga@mac.com>
Co-authored-by: Jacob Farkas <farktronix@users.noreply.github.com>
Co-authored-by: ernestmama <43187788+ernestmama@users.noreply.github.com>
Co-authored-by: Andrew Yates <contact@andydev.co.uk>
Co-authored-by: Tim Norman <tim@normsoft.com>
Co-authored-by: Michael Zuccarino <mikezuccarino@gmail.com>
Co-authored-by: Dmitry Gridnev <dmitr.gridnev@gmail.com>
Co-authored-by: Max Wang <max.wang.cs@gmail.com>
Co-authored-by: Ballad <348649634@qq.com>
Co-authored-by: Patrick Balestra <me@patrickbalestra.com>
Co-authored-by: Harry Shamansky <harry.shamansky@gmail.com>
Co-authored-by: Wu Zhong <zhongwuzw@qq.com>
Co-authored-by: Oskar Zhang <i@oskarzhang.me>
Co-authored-by: Adlai Holler <adlai@google.com>
Co-authored-by: Greg Bolsinga <gbolsinga@pinterest.com>
Co-authored-by: Huy Nguyen <huy@pinterest.com>
Co-authored-by: Andrew Monshizadeh <amonshiz+github@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants