feat(libwebrtc): implement webrtc::TaskQueueBase::Current and CurrentTaskQueueSetter #14087
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14087"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by alvaroelpob on 2026-10-31T18:35:28Z.
What
Implements
webrtc::TaskQueueBase::Current()and theTaskQueueBase::CurrentTaskQueueSetterconstructor and destructor in libwebrtc, which threw and were declared without parameters.The module's WebRTC revision lies between M127 and M134, as recorded in the debt file by #13687.
api/task_queue/task_queue_base.cchas the same code at M127 branch-heads/6533 and M134 branch-heads/6998; only its includes differ.CurrentTaskQueueSetterintask_queue_base.hholds a singleTaskQueueBase* const previous_at both revisions.The functions are adapted from
task_queue_base.ccand live insrc/TaskQueueBase.cpp, which starts with that file's WebRTC copyright notice and the BSD licence text from WebRTC'sLICENSE. The debt entry says it is adapted fromtask_queue_base.cc.Current()returns a thread-local pointer that starts null on every thread.thisand the queue, stores the current queue inprevious_and makes the queue current. Null is allowed and clears it.previous_current again.task_queue_base.cchas athread_localvariant and a pthread-key variant for builds withoutthread_local; both keep one pointer per thread and behave the same.WebRtcCurrentTaskQueueSetteris the 8-byte setter, checked by astatic_assert; the queue stays opaque. Upstream writes through a null setter, so a null setter throws. The inventory drops from 408 to 405.Tested
Ubuntu 26.04 (WSL2, kernel 6.18), GCC 15.2.0, Release, full build with
BUILD_TESTING=ON.guest_webrtc_task_queue_basetest:Current()is null before any setter.previous_holds.std::invalid_argumentin the constructor and the destructor without changing the current queue.ctest -j16on head f290692326: 3033/3033 pass.check_conventions.py --base upstream/mainpasses.pr_overlap.pyreports the open pull requests listed in Depends on.1bc97b9527after #13736 merged; the only conflicts were the include, CMake source and debt count lines. Fullctest -j16on the top of the stack, #14148 head 0884de5716 (which contains this head, 0c385970b9): 3087/3087 pass.check_conventions.py --base upstream/mainpasses.dc9dc7eaaeafter #13764 and #13816 merged. The conflicts were the debt count line and, in the AudioDeviceGeneric commit, theExport.cppstubs next to the removed VAD stubs; that commit keepsmain's side and removes only its own seven stubs. The count is now set from the stubs left inExport.cppplus the 60 bound by NID (38231 on this head,
fb3a950650). Fullctest -j16on the top of the stack, #14148 head44e052f6dd: 3113/3113 pass.check_conventions.py --base upstream/mainpasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T19:17:01Z.
Review: APPROVED
Reviewed — looks good
The thread-local current-queue implementation matches the cited WebRTC implementation, and I found no blocking issue in the reviewed stack head.
What I ran
Reviewed head
f2906923264c7dbd21449d58adeca231b34aabdfagainst baseca073ec3ad0d766ea9f4658e418a5c977001a353; the PR stack check reported a clean merge preview. Environment: Debian Linux x86_64, Python 3.11.2, GCC 12.2.0 (c++). No local build or C++ test was run.Results
main. The checker notes newer heads of #13736, #13764 and #13816 are not included in this dependent branch; those dependencies remain open and should retain their declared landing order.libwebrtcUnknown*symbols, not these additions.TaskQueueBase.cppas a possible unregistered C++ test; manual inspection confirmed CMake registerstests/TaskQueueBase.cppasguest_webrtc_task_queue_base.Unedited convention-check output
Sources
thread_localbranch in WebRTCtask_queue_base.ccat commit 8d78f5de6c27b2c793039989ea381f1428fb0100.TaskQueueBase.cppat the PR head; the test covers null initial state, nested restore, null queue, and thread isolation (test at the PR head).Not verified
I did not run a local build or C++ test, test on a console, or independently reproduce the author's Linux run. The full suite remains pending, and CI skipped Linux and specialized jobs.