Commit graph

6 commits

Author SHA1 Message Date
Tommi
7c1ddb760c Support initializing a SequenceChecker with a provided TaskQueue.
Bug: none
Change-Id: I5106f29ab7f9ed8530626f33f6259eb7aeb9e779
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/324260
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40993}
2023-10-23 14:43:04 +00:00
Tommi
3da04a93cd Allow SequenceChecker to be initialized detached.
The motivation for this is to not have to implement this pattern:

foo.h:

class Foo {
 public:
  Foo();
 private:
  SequenceChecker checker_;
};

foo.cc:

Foo::Foo() {
  checker_.Detach();
}

And instead be able to do this inline in the .h file:

class Foo {
 public:
  Foo();
 private:
  SequenceChecker checker_{SequenceChecker::kDetached};
};

Bug: none
Change-Id: Idd7ca82d15c2f77f3aaccf26f1943a49f4b40661
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/298445
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39616}
2023-03-21 12:34:15 +00:00
Danil Chapovalov
07eaddf939 Inline assert in RTC_DCHECK_RUN_ON macro
clangd ignores ASSERT_EXCLUSIVE_LOCK macro attached to an inline function in header, thus IDEs relying on clangd issue false positive warnings about members acceesses without the check of the current sequence.
Attaching assert attribute to an inlined lambda function seems to solve that issue

Bug: None
Change-Id: I6199fee26061aa4223f2e3ea7b7b14bb5820c0bc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/270480
Reviewed-by: Evan Shrubsole <eshr@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37678}
2022-08-03 13:28:28 +00:00
Danil Chapovalov
6e7c2685e3 Allow recursive check for RTC_DCHECK_RUN_ON macro
instead of using Lock/Unlock attributes, use Assert attribute to annotate code is running on certain task queue or thread.

Such check better matches what is checked, in particular allows to
recheck (and thus better document) currently used task queue

Bug: None
Change-Id: I5bc1c397efbc8342cf7915093b578bb015c85651
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/269381
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37619}
2022-07-26 09:27:23 +00:00
Harald Alvestrand
bddebc8b03 Fix an example in SequenceChecker documentation
SequenceChecker needs to be prefixed with & in RTC_DCHECK_RUN_ON;
all examples except the first one were showing this.

Bug: none
Change-Id: I90468689675319f9df67eb04a5d4cc0767ffb7a9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215582
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33771}
2021-04-19 15:58:15 +00:00
Artem Titov
b586d82a94 Move SequenceChecker header to API: step 1, move header only
Bug: webrtc:12419
Change-Id: I54db9a594f56d051a295167ca5997351443a0f2e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/205380
Reviewed-by: Tommi <tommi@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33189}
2021-02-08 11:49:58 +00:00