Skip to content

Conversation

@ninetailedtori
Copy link
Contributor

Pretty much:

  • Move singleton to its own header.
  • Rewrite any singleton classes that didn't inherit, to inherit from singleton.
  • Unify get() and getInstance() to GetInstance() which I think is code style?

Lemme know if there are any typos, of course, but this flawlessly builds on my machine for all targets. :]

@ninetailedtori ninetailedtori force-pushed the singletons-rework branch 2 times, most recently from 9dd3e06 to 8a27298 Compare December 20, 2025 04:07
@shdwmtr
Copy link
Member

shdwmtr commented Dec 20, 2025

Great PR!

@ninetailedtori ninetailedtori force-pushed the singletons-rework branch 2 times, most recently from 19067f4 to c15be76 Compare December 26, 2025 01:10
@ninetailedtori ninetailedtori changed the title Singletons rework housekeep(global): singleton rework. Dec 31, 2025
@shdwmtr
Copy link
Member

shdwmtr commented Dec 31, 2025

housekeep isn't a standard semantic commit type.

https://www.conventionalcommits.org/en/v1.0.0/

@ninetailedtori ninetailedtori changed the title housekeep(global): singleton rework. refactor: singleton rework. Dec 31, 2025
@ninetailedtori
Copy link
Contributor Author

housekeep isn't a standard semantic commit type.

https://www.conventionalcommits.org/en/v1.0.0/

Fixed

Copy link

Copilot AI left a 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.h header with a reusable CRTP-based singleton template
  • Migrates all singleton classes (OutputLogger, HttpHookManager, CefSocketDispatcher, BackendManager, BackendCallbacks, BackendLoadState) to inherit from the new Singleton base class
  • Standardizes singleton access method naming from get()/getInstance() to GetInstance() 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.

@shdwmtr shdwmtr changed the base branch from main to singleton-rework January 1, 2026 03:43
@shdwmtr shdwmtr merged commit bfc0217 into SteamClientHomebrew:singleton-rework Jan 1, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants