-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Move DeferredSetter instance to ValueStore #1732
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
Move DeferredSetter instance to ValueStore #1732
Conversation
…e DeferredSetter for both styled and direct properties.
…nary. Remove SettingStatus entries for bindings from the dictionary for bindings that don't create a queue of pending values.
src/Avalonia.Base/AvaloniaObject.cs
Outdated
| return ((IDirectPropertyAccessor)GetRegistered(property)).GetValue(this); | ||
| } | ||
| else if (_values != null) | ||
| else if (Values != null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Values can never be null can it? I think this should be changed back to _values.
src/Avalonia.Base/AvaloniaObject.cs
Outdated
| VerifyAccess(); | ||
|
|
||
| return _values?.IsAnimating(property) ?? false; | ||
| return Values?.IsAnimating(property) ?? false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be _values too - we don't want to create the object here.
src/Avalonia.Base/AvaloniaObject.cs
Outdated
| VerifyAccess(); | ||
|
|
||
| return _values?.IsSet(property) ?? false; | ||
| return Values?.IsSet(property) ?? false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here.
src/Avalonia.Base/AvaloniaObject.cs
Outdated
| { | ||
| VerifyAccess(); | ||
| _values?.Revalidate(property); | ||
| Values?.Revalidate(property); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here.
Move the
DeferredSetterinstance(s) to ValueStore. Now eachAvaloniaObjecthas oneDeferredSetterand there is not a global instance. Additionally, add aSingleOrQueueclass to reduce memory usage inDeferredSettermachinery.With these changes, memory usage in Control Catalog is reduced as shown below:
In #1703:
In this PR: