forked from dotnet/maui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Measure invalidation performance and fixes (dotnet#24823)
- Loading branch information
1 parent
3c64c3f
commit 7955f00
Showing
29 changed files
with
783 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/Controls/src/Core/Internals/InvalidationTriggerFlags.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System; | ||
|
||
namespace Microsoft.Maui.Controls.Internals; | ||
|
||
[Flags] | ||
internal enum InvalidationTriggerFlags : ushort | ||
{ | ||
None = 0, | ||
ApplyingBindingContext = 1 << 0, | ||
WillNotifyParentMeasureInvalidated = 1 << 1, | ||
WillTriggerHorizontalOptionsChanged = 1 << 2, | ||
WillTriggerVerticalOptionsChanged = 1 << 3, | ||
WillTriggerMarginChanged = 1 << 4, | ||
WillTriggerSizeRequestChanged = 1 << 5, | ||
WillTriggerMeasureChanged = 1 << 6, | ||
WillTriggerRendererReady = 1 << 7, | ||
WillTriggerUndefined = 1 << 8, | ||
} | ||
|
||
internal static class InvalidationTriggerFlagsExtensions { | ||
public static InvalidationTriggerFlags ToInvalidationTriggerFlags(this InvalidationTrigger trigger) { | ||
return trigger switch { | ||
InvalidationTrigger.MeasureChanged => InvalidationTriggerFlags.WillTriggerMeasureChanged, | ||
InvalidationTrigger.HorizontalOptionsChanged => InvalidationTriggerFlags.WillTriggerHorizontalOptionsChanged, | ||
InvalidationTrigger.VerticalOptionsChanged => InvalidationTriggerFlags.WillTriggerVerticalOptionsChanged, | ||
InvalidationTrigger.SizeRequestChanged => InvalidationTriggerFlags.WillTriggerSizeRequestChanged, | ||
InvalidationTrigger.RendererReady => InvalidationTriggerFlags.WillTriggerRendererReady, | ||
InvalidationTrigger.MarginChanged => InvalidationTriggerFlags.WillTriggerMarginChanged, | ||
_ => InvalidationTriggerFlags.WillTriggerUndefined, | ||
}; | ||
} | ||
|
||
public static InvalidationTrigger ToInvalidationTrigger(this InvalidationTriggerFlags flags) { | ||
if ((flags & InvalidationTriggerFlags.WillTriggerUndefined) != 0) return InvalidationTrigger.Undefined; | ||
if ((flags & InvalidationTriggerFlags.WillTriggerRendererReady) != 0) return InvalidationTrigger.RendererReady; | ||
if ((flags & InvalidationTriggerFlags.WillTriggerMeasureChanged) != 0) return InvalidationTrigger.MeasureChanged; | ||
if ((flags & InvalidationTriggerFlags.WillTriggerSizeRequestChanged) != 0) return InvalidationTrigger.SizeRequestChanged; | ||
if ((flags & InvalidationTriggerFlags.WillTriggerMarginChanged) != 0) return InvalidationTrigger.MarginChanged; | ||
if ((flags & InvalidationTriggerFlags.WillTriggerVerticalOptionsChanged) != 0) return InvalidationTrigger.VerticalOptionsChanged; | ||
if ((flags & InvalidationTriggerFlags.WillTriggerHorizontalOptionsChanged) != 0) return InvalidationTrigger.HorizontalOptionsChanged; | ||
return InvalidationTrigger.Undefined; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.