Permit current queue reference to be null on sequence checker creation

This makes it not an error to bind a SequenceChecker before the
global TaskQueueBase::Current() is set.

Unbreaks the SDP integration fuzzer.

Bug: webrtc:13374
Change-Id: Ic4c23fa29f4598290cf9196550e5133ba753f44f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/237620
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35341}
This commit is contained in:
Harald Alvestrand 2021-11-15 08:02:27 +00:00 committed by WebRTC LUCI CQ
parent 5fb11901f0
commit b8f7ef1c1b
2 changed files with 4 additions and 1 deletions

View File

@ -51,7 +51,7 @@ bool SequenceCheckerImpl::IsCurrent() const {
valid_system_queue_ = current_system_queue;
return true;
}
if (valid_queue_ || current_queue) {
if (valid_queue_) {
return valid_queue_ == current_queue;
}
if (valid_system_queue_ && valid_system_queue_ == current_system_queue) {

View File

@ -187,6 +187,9 @@ TEST(UniqueNumberGeneratorDeathTest, FailsWhenUsedInWrongContext) {
// thread/sequence checkers will pick up a different thread environment than
// `fake_task_queue` will represent.
UniqueNumberGenerator<uint32_t> generator;
// Instantiate a fake task queue that will register itself as the current tq.
FakeTaskQueue initial_fake_task_queue;
// Generate an ID on the current thread. This causes the generator to attach
// to the current thread context.
generator.GenerateNumber();