') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); Dispatch broker event readiness notifications by wdcui · Pull Request #1002 · microsoft/litebox · GitHub
Skip to content

Dispatch broker event readiness notifications - #1002

Merged
Weidong Cui (wdcui) merged 14 commits into
uliteboxfrom
wdcui/ulitebox/event-readiness-notification-dispatch
Jul 3, 2026
Merged

Dispatch broker event readiness notifications#1002
Weidong Cui (wdcui) merged 14 commits into
uliteboxfrom
wdcui/ulitebox/event-readiness-notification-dispatch

Conversation

@wdcui

@wdcuiWeidong Cui (wdcui) commented Jul 2, 2026

Copy link
Copy Markdown
Member

Adds a LiteBox broker notification dispatch path and a BrokerHandleRegistry that maps broker object handles to local pollables, so EventReadiness notifications can wake blocked broker-backed event counters. Event counters register/unregister their pollable by handle, and the Linux userland runner now dispatches notification-channel messages through a narrow LiteBox dispatcher instead of only draining them. Includes focused coverage that a broker readiness notification wakes a blocked broker-backed event counter read.

Weidong Cui (wdcui)and others added 14 commits July 2, 2026 13:23
Add a LiteBox broker notification sink and local event registry so broker EventReadiness notifications can wake the matching EventCounter pollee. Register broker-backed event counters by handle and unregister them on drop.
Wire the Linux userland runner notification receive loop to dispatch notifications instead of only draining them, and cover the path with a local-control-channel test that wakes a blocked event counter read via notification.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove the EventCounterWakeups wrapper and register broker-backed event counters by weak Pollee references instead. Keep readiness-to-events mapping in the broker event registry so notification dispatch can wake local waiters without a custom wrapper type.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Rename the event-specific registry to BrokerObjectRegistry and expose generic pollable registration plus readiness notification helpers. Event counters remain the first user, while future broker-backed objects can register the same way.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Rename unregister to unregister_pollable to match register_pollable on BrokerObjectRegistry.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep BrokerObjectRegistry methods in one impl block and put the TimeProvider bound only on notify_readiness, where Pollee notification requires it.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Rename BrokerObjectRegistry to BrokerPollableRegistry to make clear that the registry maps broker object handles to local pollables for readiness wakeups, not to general object state.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Rename the readiness routing table to BrokerHandleRegistry and store BrokerHandleEntry values so a handle can own more local metadata than a single weak Pollee. Registering and unregistering pollables now operates within the handle entry, allowing future broker-backed objects to attach multiple wake surfaces.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Let BrokerHandleEntry prune and notify its pollables in place so BrokerHandleRegistry::notify_readiness no longer passes pollable vectors around. Remove stale entries before checking for an empty handle entry.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove unnecessary fake-channel handshake state and overly specific request matching from the notification wakeup test while keeping the coverage that a broker notification wakes a blocked event counter read.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove BrokerNotificationSink and add LiteBox::dispatch_broker_notification. The Linux userland runner now moves a LiteBox clone into the notification receiver thread and dispatches notifications directly.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep LiteBox inherent methods in one impl block and leave only the required Clone trait impl separate.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Restore the explicit crate-private LiteBox::clone helper instead of exposing Clone publicly. Add a narrow broker notification dispatcher for deployment code that needs to move notification dispatch into a receiver thread.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove local type aliases for the concrete broker local and notification channel types in the Linux userland runner.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove the one-use BrokerConnection wrapper and have runner broker connect return the negotiated local control adapter and notification receiver directly.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@wdcui
Weidong Cui (wdcui) added this pull request to the merge queueJul 3, 2026
Merged via the queue into ulitebox with commit e1ca2e5Jul 3, 2026
7 of 8 checks passed
@wdcui
Weidong Cui (wdcui) deleted the wdcui/ulitebox/event-readiness-notification-dispatch branch July 3, 2026 21:30
@github-actions

Copy link
Copy Markdown

🤖 SemverChecks 🤖 No breaking API changes detected

Note: this does not mean API is unchanged, or even that there are no breaking changes; simply, none of the detections triggered.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@wdcui