-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[dotnet] [bidi] Modules as extensions #16392
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
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
@RenderMichael despite on these dummy changes, let's see how we can modify If you know please advise. |
PR Code Suggestions ✨Explore these optional code suggestions:
|
I don't want to believe that injecting custom |
Nice! Thank you. Parameterless ctor for Module looks ugly. But we need something parameterless to be able to |
If we targeted only the latest .NET versions, this would be a great place to have a static abstract member: interface ICreateModule<TModule> where TModule : ICreateModule<TModule>
{
static abstract TModule Create(Broker broker);
}
public class MyModule : Module, ICreateModule<MyModule>
{
private JsonSerializerContext _context;
private MyModule(Broker broker, JsonSerializerOptions options) : base(broker)
{
_context = new MySerializerContext(broker.CreateOptions());
}
public static MyModule Create(Broker broker)
{
return new MyModule(broker);
}
} But alas, we cannot expose it the "best" way on modern .NET but a different way on older TFMs.
I don't see how that would work differently from the |
I tried to implement different factory approaches, no luck (anyway consumer should provide factory func when calling, meaning this signature is exposed). Current approach looks better:
I will continue. |
Now each module owns Performance degradation (memory)Before:
After:
Cross-module type referencingIf we define json context per module, then we also have to define all types this module is referencing to. It is nightmare! We should track references somehow, and it is easy to make a mistake. How to move on?I think we can use one big shared json context by all modules. External modules will define their own context. |
Forgot BrowserModule Unnecessary Command/EmptyResult types in context? Move BrowsingContext Move Session Move Storage Move WebExtension Move Script Move Network Move Log Move Emulation Move Input Delete global json context
33b05f6
to
1fb3389
Compare
@RenderMichael I am confident with proposed changes, please review.
Edited: Module has access to |
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
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.
Looks pretty good! A few comments, none of them blocking.
User description
Contributes to #15329
🔗 Related Issues
💥 What does this PR do?
🔧 Implementation Notes
💡 Additional Considerations
🔄 Types of changes
PR Type
Enhancement
Description
Refactor BiDi modules to use extension pattern
Centralize JSON serialization configuration in BiDi class
Replace individual module properties with generic AsModule method
Update all module constructors to parameterless design
Diagram Walkthrough
File Walkthrough
13 files
Centralize JSON context and implement module extensions
Add factory method and JSON context properties
Update command execution with JSON context parameter
Remove constructor parameter and use JsonContext
Remove constructor parameter and use JsonContext
Remove constructor parameter and use JsonContext
Remove constructor parameter and use JsonContext
Remove constructor parameter and use JsonContext
Remove constructor parameter and use JsonContext
Remove constructor parameter and use JsonContext
Remove constructor parameter and use JsonContext
Remove constructor parameter and use JsonContext
Remove constructor parameter and use JsonContext