Skip to content

Bridge & Tab Registry: central state management #3

@justrach

Description

@justrach

Overview

Port Pinchtab's Bridge struct — the central coordinator holding Chrome connection, tab registry, and snapshot cache.

Tasks

  • Bridge struct with:
    • CDP client reference
    • tabs: AutoHashMap([]const u8, *TabEntry) — thread-safe tab registry
    • snapshots: AutoHashMap([]const u8, *RefCache) — snapshot cache per tab
    • RwLock for concurrent access
  • TabEntry struct: target ID, CDP context, created timestamp
  • TabContext(tabId) — resolve existing or create new tab context
  • CreateTab(url) — open new tab via CDP Target.createTarget
  • CloseTab(tabId) — close tab, cancel context, remove from registry
  • CleanStaleTabs() — background thread, runs every 30s, removes tabs no longer in Chrome

Reference

  • Pinchtab bridge.go: Bridge struct with sync.RWMutex, tabs map[string]*TabEntry

Acceptance Criteria

  • Thread-safe tab CRUD operations
  • Stale tab cleanup works
  • Snapshot cache set/get/delete per tab

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions