Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tighten Rasterization API, Undeprecate It #82

Merged
merged 6 commits into from
May 1, 2017

Conversation

Adlai-Holler
Copy link
Member

@Adlai-Holler Adlai-Holler commented Apr 28, 2017

After playing with Pinterest for a little bit, there are some views that would majorly benefit from rasterization if we could get it going. Not that I'm addicted to it! But here's what this diff does:

  • Replaces the @property (readwrite) shouldRasterizeDescendants with a one-way method -[node setShouldRasterizeDescendants]. So once it's enabled on a node, there's no disabling it. This is breaking deprecated API but nobody will care.
  • Adds assertions against triggering rasterization on nodes that are already loaded.
  • Adds assertions against triggering rasterization on nodes whose subnodes are already loaded.
  • Adds assertions against adding a loaded subnode into a rasterized tree.

So the rasterization feature remains in the Beta header, and we're not going out of our way to support it, but if we can get rid of some old code, and tamp down the API, let's keep it around. Thoughts @maicki @nguyenhuy @appleguy ?

@ghost
Copy link

ghost commented Apr 28, 2017

🚫 CI failed with log

@appleguy
Copy link
Member

@Adlai-Holler :-D I never thought I'd see the day, but what an awesome surprise! Definitely planning on making use of this. Let me know if I can help, will review this weekend.

*/
@property (nonatomic, assign) BOOL shouldRasterizeDescendants ASDISPLAYNODE_DEPRECATED_MSG("Deprecated in version 2.2");
- (void)setShouldRasterizeDescendants;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Adlai-Holler I think it's a good idea to make this an enable-only method. However, this name seems kinda sucky because it sounds exactly like a property that expects an argument.

How about something like -enableSubtreeRasterization, -enableRasterizingDescendants, etc? I think coming up with the right term for a subtree of subnodes could help here. .automaticallyManagesSubnodes is one reference point, but it does not apply recursively to all levels below, so Subtree might be better.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm OK! I'll change it to enableSubtreeRasterization.

}

// Ensure no loaded subnodes
for (ASDisplayNode *subnode in _subnodes) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this loop enough to check all subnodes' subnodes? Should we use ASPerformBlockOnEverySubnode, or otherwise recursively call _enableRasterizingToParent or something on each?

// If this subnode will be rasterized, enter hierarchy if needed
// TODO: Move this into _setSupernode: ?
if (isRasterized) {
if (self.inHierarchy) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it may have been important for the original code to enter the Rasterized hierarchy state before __enterHierarchy is called, because it may have invoked delegate methods that check this. I haven't looked closely though, this might not be true - just something to take a close look at.

@appleguy appleguy assigned appleguy and Adlai-Holler and unassigned appleguy Apr 29, 2017
Copy link
Member

@appleguy appleguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor cleanup / naming considerations to do, but overall this looks like a nice step forward :).

There will continue to be a reduced footprint from this feature once the isInHierarchy system is properly merged with interfacestate, and we could also factor out the AsyncDisplay code into a separate category to reduce complexity of the core files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants