-
-
Notifications
You must be signed in to change notification settings - Fork 97
refactor: singleton rework. #574
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
refactor: singleton rework. #574
Conversation
9dd3e06 to
8a27298
Compare
|
Great PR! |
19067f4 to
c15be76
Compare
…nd use GetInstance() to spawn, unless it has an advanced constructor.
c15be76 to
bece973
Compare
|
|
Fixed |
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.
Pull request overview
This PR refactors the singleton pattern implementation across the codebase by introducing a centralized Singleton base class and standardizing its usage. The refactoring moves the singleton implementation to a dedicated header file and unifies all singleton access methods to use GetInstance() instead of the previously inconsistent get() and getInstance() naming.
- Introduces a new
util/singleton.hheader with a reusable CRTP-based singleton template - Migrates all singleton classes (
OutputLogger,HttpHookManager,CefSocketDispatcher,BackendManager,BackendCallbacks,BackendLoadState) to inherit from the newSingletonbase class - Standardizes singleton access method naming from
get()/getInstance()toGetInstance()throughout the codebase
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/util/singleton.h | Introduces new generic singleton template with CRTP pattern |
| src/sys/logger.cc | Updates Logger global to reference singleton instance |
| src/include/millennium/logger.h | Refactors OutputLogger to inherit from Singleton, updates constructor visibility |
| src/include/millennium/http_hooks.h | Refactors HttpHookManager to inherit from Singleton, removes custom singleton implementation |
| src/core/http_hooks.cc | Removes custom get() singleton implementation |
| src/include/millennium/ffi.h | Refactors CefSocketDispatcher to inherit from Singleton, removes custom implementation |
| src/include/millennium/backend_mgr.h | Refactors BackendManager to inherit from Singleton, removes GetInstance() method |
| src/include/millennium/backend_init.h | Refactors BackendCallbacks to use inherited Singleton pattern |
| src/core/backend_init.cc | Refactors BackendLoadState to inherit from Singleton |
| src/runtime/libpy_api.cc | Updates singleton access calls to GetInstance() |
| src/runtime/liblj_api.cc | Updates singleton access calls to GetInstance() |
| src/runtime/libjs_interop.cc | Updates singleton access calls to GetInstance() |
| src/plat/init_win32.cc | Updates singleton access calls to GetInstance() |
| src/core/init.cc | Updates singleton access calls to GetInstance() |
| src/core/millennium_api.cc | Updates singleton access calls to GetInstance() |
| src/hooks/steam_hooks.cc | Updates singleton access calls to GetInstance() |
| src/backend/webkit.cc | Updates singleton access calls to GetInstance() |
| src/core/backend_mgr.cc | Updates singleton access calls to GetInstance() |
| src/include/millennium/csp_bypass.h | Updates singleton access calls to GetInstance() |
| src/include/millennium/init.h | Adds singleton.h include and reorders headers |
| src/include/millennium/plugin_logger.h | Minor formatting improvements with blank lines |
| src/CMakeLists.txt | Corrects filenames from http_hook.cc to http_hooks.cc and log.cc to logger.cc |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Pretty much:
Lemme know if there are any typos, of course, but this flawlessly builds on my machine for all targets. :]