feat(cef): add purego-cef dependency (local replace) and CEF config schema
- commit
- 4f9ffc5d69dc9bdb9406bcf32175e311660b3164
- author
- brice · · 2026-03-19 15:18 UTC
- committer
- brice · · 2026-03-28 04:35 UTC
- parent
- 408294c
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
3 files · +18 -0
M go.mod +2 -0
| @@ -25,6 +25,8 @@ require ( | |||
| 25 | 25 | ||
| 26 | 26 | replace github.com/ebitengine/purego => github.com/bnema/purego v0.0.0-20260323095903-91aa177a2704 | |
| 27 | 27 | ||
| 28 | + | replace github.com/bnema/purego-cef => ../purego-cef | |
| 29 | + | ||
| 28 | 30 | require ( | |
| 29 | 31 | github.com/atotto/clipboard v0.1.4 // indirect | |
| 30 | 32 | github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect | |
| @@ -25,6 +25,8 @@ require ( | |||||
| 25 | 25 | ||||
| 26 | replace github.com/ebitengine/purego => github.com/bnema/purego v0.0.0-20260323095903-91aa177a2704 | 26 | replace github.com/ebitengine/purego => github.com/bnema/purego v0.0.0-20260323095903-91aa177a2704 | ||
| 27 | 27 | ||||
| 28 | + | replace github.com/bnema/purego-cef => ../purego-cef | |||
| 29 | + | ||||
| 28 | require ( | 30 | require ( | ||
| 29 | github.com/atotto/clipboard v0.1.4 // indirect | 31 | github.com/atotto/clipboard v0.1.4 // indirect | ||
| 30 | github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect | 32 | github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect | ||
A internal/infrastructure/cef/doc.go +2 -0
| @@ -0,0 +1,2 @@ | |||
| 1 | + | // Package cef implements port.Engine using the Chromium Embedded Framework via purego-cef. | |
| 2 | + | package cef | |
| @@ -0,0 +1,2 @@ | |||||
| 1 | + | // Package cef implements port.Engine using the Chromium Embedded Framework via purego-cef. | |||
| 2 | + | package cef | |||
M internal/infrastructure/config/engine.go +14 -0
| @@ -8,6 +8,7 @@ type EngineConfig struct { | |||
| 8 | 8 | Profile PerformanceProfile `mapstructure:"profile" toml:"profile" yaml:"profile"` | |
| 9 | 9 | CookiePolicy CookiePolicy `mapstructure:"cookie_policy" toml:"cookie_policy" yaml:"cookie_policy"` | |
| 10 | 10 | WebKit WebKitEngineConfig `mapstructure:"webkit" toml:"webkit" yaml:"webkit"` | |
| 11 | + | CEF CEFEngineConfig `mapstructure:"cef" toml:"cef" yaml:"cef"` | |
| 11 | 12 | } | |
| 12 | 13 | ||
| 13 | 14 | // WebKitEngineConfig holds WebKit-specific engine options. | |
| @@ -57,6 +58,19 @@ type WebKitEngineConfig struct { | |||
| 57 | 58 | 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 | 59 | } | |
| 59 | 60 | ||
| 61 | + | // CEFEngineConfig holds CEF-specific engine options. | |
| 62 | + | type CEFEngineConfig struct { | |
| 63 | + | // CEFDir is the path to the CEF framework directory containing | |
| 64 | + | // libcef.so and the Resources/locales subdirectories. | |
| 65 | + | CEFDir string `mapstructure:"cef_dir" toml:"cef_dir" yaml:"cef_dir"` | |
| 66 | + | // LogSeverity controls CEF's internal log verbosity. | |
| 67 | + | // 0 = default, 1 = verbose, 2 = info, 3 = warning, 4 = error, 99 = disable. | |
| 68 | + | LogSeverity int32 `mapstructure:"log_severity" toml:"log_severity" yaml:"log_severity"` | |
| 69 | + | // WindowlessFrameRate is the maximum frame rate for off-screen rendering. | |
| 70 | + | // Default: 30. Higher values increase CPU usage. | |
| 71 | + | WindowlessFrameRate int32 `mapstructure:"windowless_frame_rate" toml:"windowless_frame_rate" yaml:"windowless_frame_rate"` | |
| 72 | + | } | |
| 73 | + | ||
| 60 | 74 | // PerformanceConfigFromEngine constructs a PerformanceConfig from the | |
| 61 | 75 | // new [engine] config section, for use with ResolvePerformanceProfile. | |
| 62 | 76 | func PerformanceConfigFromEngine(e *EngineConfig) PerformanceConfig { | |
| @@ -8,6 +8,7 @@ type EngineConfig struct { | |||||
| 8 | Profile PerformanceProfile `mapstructure:"profile" toml:"profile" yaml:"profile"` | 8 | Profile PerformanceProfile `mapstructure:"profile" toml:"profile" yaml:"profile"` | ||
| 9 | CookiePolicy CookiePolicy `mapstructure:"cookie_policy" toml:"cookie_policy" yaml:"cookie_policy"` | 9 | CookiePolicy CookiePolicy `mapstructure:"cookie_policy" toml:"cookie_policy" yaml:"cookie_policy"` | ||
| 10 | WebKit WebKitEngineConfig `mapstructure:"webkit" toml:"webkit" yaml:"webkit"` | 10 | WebKit WebKitEngineConfig `mapstructure:"webkit" toml:"webkit" yaml:"webkit"` | ||
| 11 | + | CEF CEFEngineConfig `mapstructure:"cef" toml:"cef" yaml:"cef"` | |||
| 11 | } | 12 | } | ||
| 12 | 13 | ||||
| 13 | // WebKitEngineConfig holds WebKit-specific engine options. | 14 | // WebKitEngineConfig holds WebKit-specific engine options. | ||
| @@ -57,6 +58,19 @@ type WebKitEngineConfig struct { | |||||
| 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 | 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 | } | 59 | } | ||
| 59 | 60 | ||||
| 61 | + | // CEFEngineConfig holds CEF-specific engine options. | |||
| 62 | + | type CEFEngineConfig struct { | |||
| 63 | + | // CEFDir is the path to the CEF framework directory containing | |||
| 64 | + | // libcef.so and the Resources/locales subdirectories. | |||
| 65 | + | CEFDir string `mapstructure:"cef_dir" toml:"cef_dir" yaml:"cef_dir"` | |||
| 66 | + | // LogSeverity controls CEF's internal log verbosity. | |||
| 67 | + | // 0 = default, 1 = verbose, 2 = info, 3 = warning, 4 = error, 99 = disable. | |||
| 68 | + | LogSeverity int32 `mapstructure:"log_severity" toml:"log_severity" yaml:"log_severity"` | |||
| 69 | + | // WindowlessFrameRate is the maximum frame rate for off-screen rendering. | |||
| 70 | + | // Default: 30. Higher values increase CPU usage. | |||
| 71 | + | WindowlessFrameRate int32 `mapstructure:"windowless_frame_rate" toml:"windowless_frame_rate" yaml:"windowless_frame_rate"` | |||
| 72 | + | } | |||
| 73 | + | ||||
| 60 | // PerformanceConfigFromEngine constructs a PerformanceConfig from the | 74 | // PerformanceConfigFromEngine constructs a PerformanceConfig from the | ||
| 61 | // new [engine] config section, for use with ResolvePerformanceProfile. | 75 | // new [engine] config section, for use with ResolvePerformanceProfile. | ||
| 62 | func PerformanceConfigFromEngine(e *EngineConfig) PerformanceConfig { | 76 | func PerformanceConfigFromEngine(e *EngineConfig) PerformanceConfig { | ||