Documentation
¶
Overview ¶
Package bootstrap provides initialization utilities for the browser.
Package bootstrap provides initialization utilities for the browser.
Index ¶
- func CheckMediaRequirements(ctx context.Context, cfg *config.Config) error
- func CheckRuntimeRequirements(ctx context.Context, cfg *config.Config) error
- func CreateLazyDatabase() (*sqlite.LazyDB, error)
- type BrowserSession
- type DatabaseResult
- type DeferredInitInput
- type DeferredInitResult
- type ParallelDBWebKitInput
- type ParallelDBWebKitResult
- type ParallelInitInput
- type ParallelInitResult
- type RuntimeRequirementsError
- type StartupTimer
- type WebKitStack
- type WebKitStackInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckMediaRequirements ¶ added in v0.22.0
CheckMediaRequirements verifies GStreamer and media codec availability. Returns error if media subsystem initialization fails.
func CheckRuntimeRequirements ¶ added in v0.22.0
CheckRuntimeRequirements verifies WebKitGTK and other runtime dependencies. Returns error if requirements are not met; caller should log details and exit. Note: When running in a Flatpak sandbox, runtime checks are skipped because the Flatpak runtime provides all required libraries.
func CreateLazyDatabase ¶ added in v0.22.0
CreateLazyDatabase creates a lazy database provider that defers initialization. The database is initialized on first access, allowing the UI to render faster.
Currently unused: the application uses OpenDatabase with RunParallelDBWebKit for eager initialization. This function is kept for potential future use when lazy initialization past first paint becomes beneficial.
Types ¶
type BrowserSession ¶
type BrowserSession struct {
Session *entity.Session
Logger zerolog.Logger
LogCleanup func()
Persist func(context.Context) error
End func(context.Context) error
}
func StartBrowserSession ¶
func StartBrowserSession( ctx context.Context, cfg *config.Config, sessionRepo repository.SessionRepository, deferPersist bool, ) (*BrowserSession, context.Context, error)
type DatabaseResult ¶ added in v0.22.0
DatabaseResult holds database connection and cleanup function.
func OpenDatabase ¶ added in v0.22.0
func OpenDatabase(ctx context.Context) (*DatabaseResult, error)
OpenDatabase opens and initializes the SQLite database using XDG paths. Returns error if database cannot be opened or migrations fail.
type DeferredInitInput ¶ added in v0.22.0
DeferredInitInput holds the input for deferred initialization.
type DeferredInitResult ¶ added in v0.22.0
type DeferredInitResult struct {
RuntimeErr error
MediaErr error
SQLiteErr error
Duration time.Duration
}
DeferredInitResult holds results from deferred initialization checks.
func RunDeferredInit ¶ added in v0.22.0
func RunDeferredInit(input DeferredInitInput) DeferredInitResult
RunDeferredInit runs deferred initialization checks off the critical path. This includes SQLite WASM precompile, runtime requirements, and media checks.
type ParallelDBWebKitInput ¶ added in v0.22.0
type ParallelDBWebKitInput struct {
Ctx context.Context
Config *config.Config
DataDir string // For WebKit context
CacheDir string // For WebKit cache
ThemeManager *theme.Manager
ColorResolver port.ColorSchemeResolver
}
ParallelDBWebKitInput holds inputs for parallel DB and WebKit initialization.
type ParallelDBWebKitResult ¶ added in v0.22.0
type ParallelDBWebKitResult struct {
DB *sql.DB
DBCleanup func()
Stack WebKitStack
}
ParallelDBWebKitResult holds results from parallel DB and WebKit initialization.
func RunParallelDBWebKit ¶ added in v0.22.0
func RunParallelDBWebKit(input ParallelDBWebKitInput) (*ParallelDBWebKitResult, error)
RunParallelDBWebKit initializes database in background while WebKit runs on main thread. Database init happens in goroutine (pure Go/WASM), WebKit must stay on main thread (GTK). This saves ~150ms by overlapping DB migrations with WebKit context creation.
type ParallelInitInput ¶ added in v0.22.0
ParallelInitInput holds the input for parallel initialization.
type ParallelInitResult ¶ added in v0.22.0
type ParallelInitResult struct {
DataDir string
CacheDir string
ThemeManager *theme.Manager
ColorResolver port.ColorSchemeResolver
AdwaitaDetector *colorscheme.AdwaitaDetector
Duration time.Duration
}
ParallelInitResult holds the results of parallel initialization phase.
func RunParallelInit ¶ added in v0.22.0
func RunParallelInit(input ParallelInitInput) (*ParallelInitResult, error)
RunParallelInit runs the essential parallel initialization phase. This includes directory resolution, color scheme resolver creation, and theme creation. Returns the first fatal error encountered, or nil with the results.
type RuntimeRequirementsError ¶ added in v0.22.0
type RuntimeRequirementsError struct {
Checks []usecase.RuntimeDependencyStatus
}
RuntimeRequirementsError contains details about missing runtime dependencies.
func (*RuntimeRequirementsError) Error ¶ added in v0.22.0
func (*RuntimeRequirementsError) Error() string
func (*RuntimeRequirementsError) LogDetails ¶ added in v0.22.0
func (e *RuntimeRequirementsError) LogDetails(ctx context.Context)
LogDetails logs detailed information about missing dependencies.
type StartupTimer ¶ added in v0.22.0
type StartupTimer struct {
// contains filtered or unexported fields
}
StartupTimer tracks timing for cold start phases. Thread-safe for use with parallel initialization.
func NewStartupTimer ¶ added in v0.22.0
func NewStartupTimer() *StartupTimer
NewStartupTimer creates a new timer starting from now.
func (*StartupTimer) Log ¶ added in v0.22.0
func (t *StartupTimer) Log(ctx context.Context)
Log outputs all timing information to the context logger.
func (*StartupTimer) LogDebug ¶ added in v0.22.0
func (t *StartupTimer) LogDebug(ctx context.Context)
LogDebug outputs timing as debug level (for less verbose production logs).
func (*StartupTimer) Mark ¶ added in v0.22.0
func (t *StartupTimer) Mark(phase string)
Mark records the duration since the last mark (or start) for the given phase.
func (*StartupTimer) MarkDuration ¶ added in v0.22.0
func (t *StartupTimer) MarkDuration(phase string, d time.Duration)
MarkDuration records a specific duration for a phase. Useful for operations timed independently (e.g., parallel goroutines).
func (*StartupTimer) Total ¶ added in v0.22.0
func (t *StartupTimer) Total() time.Duration
Total returns the total elapsed time since timer creation. Thread-safe: uses mutex for memory visibility guarantees.
type WebKitStack ¶
type WebKitStack struct {
Context *webkit.WebKitContext
Settings *webkit.SettingsManager
Injector *webkit.ContentInjector
MessageRouter *webkit.MessageRouter
Pool *webkit.WebViewPool
FilterManager *filtering.Manager
}
func BuildWebKitStack ¶
func BuildWebKitStack(input WebKitStackInput) WebKitStack