-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[dotnet] Add SystemClock
singleton
#15285
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|
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.
Thanks, micro-optimizations are always good, even if it is nano :) I concern this approach will not work if in future we will add parameter in ctor
. But I cannot image which one might be added.
If we add a parameter in the constructor, then users who use The only reason users may be forced to care about the For that reason, I opened #15314 👀 |
User description
Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.
Add
SystemClock
singletonMotivation and Context
This minimizes an allocation when using the
WebDriverWait
type, and adjacent types like components and waitsTypes of changes
Checklist
PR Type
Enhancement, Tests
Description
Introduced a singleton
SystemClock.Instance
to minimize allocations.Updated various classes to use
SystemClock.Instance
instead of creating new instances.Refactored
FakeClock
toHandCrankClock
with improved naming and functionality.Adjusted related tests to align with the new
SystemClock.Instance
andHandCrankClock
.Changes walkthrough 📝
PopupWindowFinder.cs
Use `SystemClock.Instance` in `PopupWindowFinder`
dotnet/src/support/UI/PopupWindowFinder.cs
new SystemClock()
withSystemClock.Instance
.WebDriverWait
initialization.SlowLoadableComponent{T}.cs
Use `SystemClock.Instance` in `SlowLoadableComponent`
dotnet/src/support/UI/SlowLoadableComponent{T}.cs
new SystemClock()
withSystemClock.Instance
.DefaultWait{T}.cs
Use `SystemClock.Instance` in `DefaultWait`
dotnet/src/webdriver/Support/DefaultWait{T}.cs
new SystemClock()
withSystemClock.Instance
.SystemClock.cs
Introduce singleton instance for `SystemClock`
dotnet/src/webdriver/Support/SystemClock.cs
SystemClock.Instance
as a singleton instance.WebDriverWait.cs
Use `SystemClock.Instance` in `WebDriverWait`
dotnet/src/webdriver/Support/WebDriverWait.cs
new SystemClock()
withSystemClock.Instance
.HandCrankClock.cs
Refactor `FakeClock` to `HandCrankClock`
dotnet/test/support/UI/HandCrankClock.cs
FakeClock
toHandCrankClock
.SlowLoadableComponentTest.cs
Update tests for `SystemClock` and `HandCrankClock`
dotnet/test/support/UI/SlowLoadableComponentTest.cs
SystemClock.Instance
.FakeClock
withHandCrankClock
.