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
Overview
Port Pinchtab's
Bridgestruct — the central coordinator holding Chrome connection, tab registry, and snapshot cache.Tasks
Bridgestruct with:tabs: AutoHashMap([]const u8, *TabEntry)— thread-safe tab registrysnapshots: AutoHashMap([]const u8, *RefCache)— snapshot cache per tabRwLockfor concurrent accessTabEntrystruct: target ID, CDP context, created timestampTabContext(tabId)— resolve existing or create new tab contextCreateTab(url)— open new tab via CDPTarget.createTargetCloseTab(tabId)— close tab, cancel context, remove from registryCleanStaleTabs()— background thread, runs every 30s, removes tabs no longer in ChromeReference
bridge.go: Bridge struct withsync.RWMutex,tabs map[string]*TabEntryAcceptance Criteria