feat(config): add EngineConfig and WebKitEngineConfig structs
Introduce Engine EngineConfig field on Config plus engine.go holding EngineConfig and WebKitEngineConfig; old sections (Rendering, Performance, Privacy, Runtime) are kept intact for backward compatibility.
- commit
- 04269abd83a96b9df94582acc70d477d077ba725
- author
- brice · · 2026-03-15 16:05 UTC
- parent
- ee29e14
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
2 files · +60 -0
A internal/infrastructure/config/engine.go +58 -0
| @@ -0,0 +1,58 @@ | |||
| 1 | + | package config | |
| 2 | + | ||
| 3 | + | // EngineConfig holds engine selection and universal engine options. | |
| 4 | + | type EngineConfig struct { | |
| 5 | + | Type string `mapstructure:"type" toml:"type" yaml:"type"` | |
| 6 | + | PoolPrewarmCount int `mapstructure:"pool_prewarm_count" toml:"pool_prewarm_count" yaml:"pool_prewarm_count"` | |
| 7 | + | ZoomCacheSize int `mapstructure:"zoom_cache_size" toml:"zoom_cache_size" yaml:"zoom_cache_size"` | |
| 8 | + | Profile PerformanceProfile `mapstructure:"profile" toml:"profile" yaml:"profile"` | |
| 9 | + | CookiePolicy CookiePolicy `mapstructure:"cookie_policy" toml:"cookie_policy" yaml:"cookie_policy"` | |
| 10 | + | WebKit WebKitEngineConfig `mapstructure:"webkit" toml:"webkit" yaml:"webkit"` | |
| 11 | + | } | |
| 12 | + | ||
| 13 | + | // WebKitEngineConfig holds WebKit-specific engine options. | |
| 14 | + | type WebKitEngineConfig struct { | |
| 15 | + | // Skia rendering threads | |
| 16 | + | SkiaCPUPaintingThreads int `mapstructure:"skia_cpu_painting_threads" toml:"skia_cpu_painting_threads" yaml:"skia_cpu_painting_threads"` | |
| 17 | + | SkiaGPUPaintingThreads int `mapstructure:"skia_gpu_painting_threads" toml:"skia_gpu_painting_threads" yaml:"skia_gpu_painting_threads"` | |
| 18 | + | SkiaEnableCPURendering bool `mapstructure:"skia_enable_cpu_rendering" toml:"skia_enable_cpu_rendering" yaml:"skia_enable_cpu_rendering"` | |
| 19 | + | ||
| 20 | + | // WebKit compositor | |
| 21 | + | DisableDMABufRenderer bool `mapstructure:"disable_dmabuf_renderer" toml:"disable_dmabuf_renderer" yaml:"disable_dmabuf_renderer"` | |
| 22 | + | ForceCompositingMode bool `mapstructure:"force_compositing_mode" toml:"force_compositing_mode" yaml:"force_compositing_mode"` | |
| 23 | + | DisableCompositingMode bool `mapstructure:"disable_compositing_mode" toml:"disable_compositing_mode" yaml:"disable_compositing_mode"` | |
| 24 | + | ||
| 25 | + | // GTK/GSK | |
| 26 | + | GSKRenderer GSKRendererMode `mapstructure:"gsk_renderer" toml:"gsk_renderer" yaml:"gsk_renderer"` | |
| 27 | + | DisableMipmaps bool `mapstructure:"disable_mipmaps" toml:"disable_mipmaps" yaml:"disable_mipmaps"` | |
| 28 | + | PreferGL bool `mapstructure:"prefer_gl" toml:"prefer_gl" yaml:"prefer_gl"` | |
| 29 | + | ||
| 30 | + | // Debug | |
| 31 | + | ShowFPS bool `mapstructure:"show_fps" toml:"show_fps" yaml:"show_fps"` | |
| 32 | + | SampleMemory bool `mapstructure:"sample_memory" toml:"sample_memory" yaml:"sample_memory"` | |
| 33 | + | DebugFrames bool `mapstructure:"debug_frames" toml:"debug_frames" yaml:"debug_frames"` | |
| 34 | + | DrawCompositingIndicators bool `mapstructure:"draw_compositing_indicators" toml:"draw_compositing_indicators" yaml:"draw_compositing_indicators"` //nolint:lll // struct tags exceed lll limit | |
| 35 | + | ||
| 36 | + | // Privacy (WebKit-specific) | |
| 37 | + | ITPEnabled bool `mapstructure:"itp_enabled" toml:"itp_enabled" yaml:"itp_enabled"` | |
| 38 | + | ||
| 39 | + | // GStreamer | |
| 40 | + | ForceVSync bool `mapstructure:"force_vsync" toml:"force_vsync" yaml:"force_vsync"` | |
| 41 | + | GLRenderingMode GLRenderingMode `mapstructure:"gl_rendering_mode" toml:"gl_rendering_mode" yaml:"gl_rendering_mode"` | |
| 42 | + | GStreamerDebugLevel int `mapstructure:"gstreamer_debug_level" toml:"gstreamer_debug_level" yaml:"gstreamer_debug_level"` | |
| 43 | + | ||
| 44 | + | // Runtime prefix for WebKitGTK libraries | |
| 45 | + | Prefix string `mapstructure:"prefix" toml:"prefix" yaml:"prefix"` | |
| 46 | + | ||
| 47 | + | // Web process memory pressure | |
| 48 | + | WebProcessMemoryLimitMB int `mapstructure:"web_process_memory_limit_mb" toml:"web_process_memory_limit_mb" yaml:"web_process_memory_limit_mb"` //nolint:lll // struct tags exceed lll limit | |
| 49 | + | WebProcessMemoryPollIntervalSec float64 `mapstructure:"web_process_memory_poll_interval_sec" toml:"web_process_memory_poll_interval_sec" yaml:"web_process_memory_poll_interval_sec"` //nolint:lll // struct tags exceed lll limit | |
| 50 | + | WebProcessMemoryConservativeThreshold float64 `mapstructure:"web_process_memory_conservative_threshold" toml:"web_process_memory_conservative_threshold" yaml:"web_process_memory_conservative_threshold"` //nolint:lll // struct tags exceed lll limit | |
| 51 | + | WebProcessMemoryStrictThreshold float64 `mapstructure:"web_process_memory_strict_threshold" toml:"web_process_memory_strict_threshold" yaml:"web_process_memory_strict_threshold"` //nolint:lll // struct tags exceed lll limit | |
| 52 | + | ||
| 53 | + | // Network process memory pressure | |
| 54 | + | NetworkProcessMemoryLimitMB int `mapstructure:"network_process_memory_limit_mb" toml:"network_process_memory_limit_mb" yaml:"network_process_memory_limit_mb"` //nolint:lll // struct tags exceed lll limit | |
| 55 | + | NetworkProcessMemoryPollIntervalSec float64 `mapstructure:"network_process_memory_poll_interval_sec" toml:"network_process_memory_poll_interval_sec" yaml:"network_process_memory_poll_interval_sec"` //nolint:lll // struct tags exceed lll limit | |
| 56 | + | NetworkProcessMemoryConservativeThreshold float64 `mapstructure:"network_process_memory_conservative_threshold" toml:"network_process_memory_conservative_threshold" yaml:"network_process_memory_conservative_threshold"` //nolint:lll // struct tags exceed lll limit | |
| 57 | + | NetworkProcessMemoryStrictThreshold float64 `mapstructure:"network_process_memory_strict_threshold" toml:"network_process_memory_strict_threshold" yaml:"network_process_memory_strict_threshold"` //nolint:lll // struct tags exceed lll limit | |
| 58 | + | } | |
| @@ -0,0 +1,58 @@ | |||||
| 1 | + | package config | |||
| 2 | + | ||||
| 3 | + | // EngineConfig holds engine selection and universal engine options. | |||
| 4 | + | type EngineConfig struct { | |||
| 5 | + | Type string `mapstructure:"type" toml:"type" yaml:"type"` | |||
| 6 | + | PoolPrewarmCount int `mapstructure:"pool_prewarm_count" toml:"pool_prewarm_count" yaml:"pool_prewarm_count"` | |||
| 7 | + | ZoomCacheSize int `mapstructure:"zoom_cache_size" toml:"zoom_cache_size" yaml:"zoom_cache_size"` | |||
| 8 | + | Profile PerformanceProfile `mapstructure:"profile" toml:"profile" yaml:"profile"` | |||
| 9 | + | CookiePolicy CookiePolicy `mapstructure:"cookie_policy" toml:"cookie_policy" yaml:"cookie_policy"` | |||
| 10 | + | WebKit WebKitEngineConfig `mapstructure:"webkit" toml:"webkit" yaml:"webkit"` | |||
| 11 | + | } | |||
| 12 | + | ||||
| 13 | + | // WebKitEngineConfig holds WebKit-specific engine options. | |||
| 14 | + | type WebKitEngineConfig struct { | |||
| 15 | + | // Skia rendering threads | |||
| 16 | + | SkiaCPUPaintingThreads int `mapstructure:"skia_cpu_painting_threads" toml:"skia_cpu_painting_threads" yaml:"skia_cpu_painting_threads"` | |||
| 17 | + | SkiaGPUPaintingThreads int `mapstructure:"skia_gpu_painting_threads" toml:"skia_gpu_painting_threads" yaml:"skia_gpu_painting_threads"` | |||
| 18 | + | SkiaEnableCPURendering bool `mapstructure:"skia_enable_cpu_rendering" toml:"skia_enable_cpu_rendering" yaml:"skia_enable_cpu_rendering"` | |||
| 19 | + | ||||
| 20 | + | // WebKit compositor | |||
| 21 | + | DisableDMABufRenderer bool `mapstructure:"disable_dmabuf_renderer" toml:"disable_dmabuf_renderer" yaml:"disable_dmabuf_renderer"` | |||
| 22 | + | ForceCompositingMode bool `mapstructure:"force_compositing_mode" toml:"force_compositing_mode" yaml:"force_compositing_mode"` | |||
| 23 | + | DisableCompositingMode bool `mapstructure:"disable_compositing_mode" toml:"disable_compositing_mode" yaml:"disable_compositing_mode"` | |||
| 24 | + | ||||
| 25 | + | // GTK/GSK | |||
| 26 | + | GSKRenderer GSKRendererMode `mapstructure:"gsk_renderer" toml:"gsk_renderer" yaml:"gsk_renderer"` | |||
| 27 | + | DisableMipmaps bool `mapstructure:"disable_mipmaps" toml:"disable_mipmaps" yaml:"disable_mipmaps"` | |||
| 28 | + | PreferGL bool `mapstructure:"prefer_gl" toml:"prefer_gl" yaml:"prefer_gl"` | |||
| 29 | + | ||||
| 30 | + | // Debug | |||
| 31 | + | ShowFPS bool `mapstructure:"show_fps" toml:"show_fps" yaml:"show_fps"` | |||
| 32 | + | SampleMemory bool `mapstructure:"sample_memory" toml:"sample_memory" yaml:"sample_memory"` | |||
| 33 | + | DebugFrames bool `mapstructure:"debug_frames" toml:"debug_frames" yaml:"debug_frames"` | |||
| 34 | + | DrawCompositingIndicators bool `mapstructure:"draw_compositing_indicators" toml:"draw_compositing_indicators" yaml:"draw_compositing_indicators"` //nolint:lll // struct tags exceed lll limit | |||
| 35 | + | ||||
| 36 | + | // Privacy (WebKit-specific) | |||
| 37 | + | ITPEnabled bool `mapstructure:"itp_enabled" toml:"itp_enabled" yaml:"itp_enabled"` | |||
| 38 | + | ||||
| 39 | + | // GStreamer | |||
| 40 | + | ForceVSync bool `mapstructure:"force_vsync" toml:"force_vsync" yaml:"force_vsync"` | |||
| 41 | + | GLRenderingMode GLRenderingMode `mapstructure:"gl_rendering_mode" toml:"gl_rendering_mode" yaml:"gl_rendering_mode"` | |||
| 42 | + | GStreamerDebugLevel int `mapstructure:"gstreamer_debug_level" toml:"gstreamer_debug_level" yaml:"gstreamer_debug_level"` | |||
| 43 | + | ||||
| 44 | + | // Runtime prefix for WebKitGTK libraries | |||
| 45 | + | Prefix string `mapstructure:"prefix" toml:"prefix" yaml:"prefix"` | |||
| 46 | + | ||||
| 47 | + | // Web process memory pressure | |||
| 48 | + | WebProcessMemoryLimitMB int `mapstructure:"web_process_memory_limit_mb" toml:"web_process_memory_limit_mb" yaml:"web_process_memory_limit_mb"` //nolint:lll // struct tags exceed lll limit | |||
| 49 | + | WebProcessMemoryPollIntervalSec float64 `mapstructure:"web_process_memory_poll_interval_sec" toml:"web_process_memory_poll_interval_sec" yaml:"web_process_memory_poll_interval_sec"` //nolint:lll // struct tags exceed lll limit | |||
| 50 | + | WebProcessMemoryConservativeThreshold float64 `mapstructure:"web_process_memory_conservative_threshold" toml:"web_process_memory_conservative_threshold" yaml:"web_process_memory_conservative_threshold"` //nolint:lll // struct tags exceed lll limit | |||
| 51 | + | WebProcessMemoryStrictThreshold float64 `mapstructure:"web_process_memory_strict_threshold" toml:"web_process_memory_strict_threshold" yaml:"web_process_memory_strict_threshold"` //nolint:lll // struct tags exceed lll limit | |||
| 52 | + | ||||
| 53 | + | // Network process memory pressure | |||
| 54 | + | NetworkProcessMemoryLimitMB int `mapstructure:"network_process_memory_limit_mb" toml:"network_process_memory_limit_mb" yaml:"network_process_memory_limit_mb"` //nolint:lll // struct tags exceed lll limit | |||
| 55 | + | NetworkProcessMemoryPollIntervalSec float64 `mapstructure:"network_process_memory_poll_interval_sec" toml:"network_process_memory_poll_interval_sec" yaml:"network_process_memory_poll_interval_sec"` //nolint:lll // struct tags exceed lll limit | |||
| 56 | + | NetworkProcessMemoryConservativeThreshold float64 `mapstructure:"network_process_memory_conservative_threshold" toml:"network_process_memory_conservative_threshold" yaml:"network_process_memory_conservative_threshold"` //nolint:lll // struct tags exceed lll limit | |||
| 57 | + | NetworkProcessMemoryStrictThreshold float64 `mapstructure:"network_process_memory_strict_threshold" toml:"network_process_memory_strict_threshold" yaml:"network_process_memory_strict_threshold"` //nolint:lll // struct tags exceed lll limit | |||
| 58 | + | } | |||
M internal/infrastructure/config/schema.go +2 -0
| @@ -39,6 +39,8 @@ type Config struct { | |||
| 39 | 39 | Update UpdateConfig `mapstructure:"update" yaml:"update" toml:"update"` | |
| 40 | 40 | // Downloads configures file download behavior. | |
| 41 | 41 | Downloads DownloadsConfig `mapstructure:"downloads" yaml:"downloads" toml:"downloads"` | |
| 42 | + | // Engine holds engine selection and unified engine options. | |
| 43 | + | Engine EngineConfig `mapstructure:"engine" toml:"engine" yaml:"engine"` | |
| 42 | 44 | } | |
| 43 | 45 | ||
| 44 | 46 | // RenderingMode selects GPU vs CPU rendering. | |
| @@ -39,6 +39,8 @@ type Config struct { | |||||
| 39 | Update UpdateConfig `mapstructure:"update" yaml:"update" toml:"update"` | 39 | Update UpdateConfig `mapstructure:"update" yaml:"update" toml:"update"` | ||
| 40 | // Downloads configures file download behavior. | 40 | // Downloads configures file download behavior. | ||
| 41 | Downloads DownloadsConfig `mapstructure:"downloads" yaml:"downloads" toml:"downloads"` | 41 | Downloads DownloadsConfig `mapstructure:"downloads" yaml:"downloads" toml:"downloads"` | ||
| 42 | + | // Engine holds engine selection and unified engine options. | |||
| 43 | + | Engine EngineConfig `mapstructure:"engine" toml:"engine" yaml:"engine"` | |||
| 42 | } | 44 | } | ||
| 43 | 45 | ||||
| 44 | // RenderingMode selects GPU vs CPU rendering. | 46 | // RenderingMode selects GPU vs CPU rendering. | ||