-
Notifications
You must be signed in to change notification settings - Fork 725
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: [Wasm] Improve DOM routed events dispatch performance
- Loading branch information
1 parent
c108230
commit f90906d
Showing
9 changed files
with
138 additions
and
37 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using System; | ||
|
||
namespace Windows.UI.Xaml | ||
{ | ||
partial class UIElement | ||
{ | ||
/// <summary> | ||
/// Generic handlers for DOM mapped events | ||
/// </summary> | ||
internal static class GenericEventHandlers | ||
{ | ||
internal static object RaiseEventHandler(Delegate d, object sender, object args) | ||
{ | ||
if (d is EventHandler handler) | ||
{ | ||
handler(sender, args as EventArgs); | ||
return null; | ||
} | ||
|
||
throw new InvalidOperationException($"The parameters for invoking GenericEventHandlers.RaiseEventHandler with {d} are incorrect"); | ||
} | ||
|
||
internal static object RaiseRawEventHandler(Delegate d, object sender, object args) | ||
{ | ||
if (d is RawEventHandler handler) | ||
{ | ||
return handler(sender as UIElement, args as string); | ||
} | ||
|
||
throw new InvalidOperationException($"The parameters for invoking GenericEventHandlers.RaiseEventHandler with {d} are incorrect"); | ||
} | ||
|
||
internal static object RaiseRoutedEventHandler(Delegate d, object sender, object args) | ||
{ | ||
if (d is RoutedEventHandler handler) | ||
{ | ||
handler(sender, args as RoutedEventArgs); | ||
return null; | ||
} | ||
|
||
throw new InvalidOperationException($"The parameters for invoking GenericEventHandlers.RaiseEventHandler with {d} are incorrect"); | ||
} | ||
|
||
internal static object RaiseExceptionRoutedEventHandler(Delegate d, object sender, object args) | ||
{ | ||
if (d is ExceptionRoutedEventHandler handler) | ||
{ | ||
handler(sender, args as ExceptionRoutedEventArgs); | ||
return null; | ||
} | ||
return null; | ||
} | ||
|
||
internal static object RaiseRoutedEventHandlerWithHandled(Delegate d, object sender, object args) | ||
{ | ||
if (d is RoutedEventHandlerWithHandled handler) | ||
{ | ||
handler(sender, args as RoutedEventArgs); | ||
return null; | ||
} | ||
return null; | ||
} | ||
} | ||
} | ||
} |
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