Change ObjCNetworkMonitor::OnPathUpdate to use PostTask

Removes use of AsyncInvoker, replaced with PendingTaskSafetyFlag. The
latter is extended to support creation on a different thread than
where it will be used, and to support stop and restart.

Bug: webrtc:12339
Change-Id: I28b6e09b1542f50037e842ef5fe3a47d15704b46
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211002
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33432}
This commit is contained in:
Niels Möller
2021-03-11 10:24:06 +01:00
committed by Commit Bot
parent aa6adffba3
commit be140b4187
5 changed files with 21 additions and 5 deletions

View File

@ -24,6 +24,11 @@ void PendingTaskSafetyFlag::SetNotAlive() {
alive_ = false;
}
void PendingTaskSafetyFlag::SetAlive() {
RTC_DCHECK_RUN_ON(&main_sequence_);
alive_ = true;
}
bool PendingTaskSafetyFlag::alive() const {
RTC_DCHECK_RUN_ON(&main_sequence_);
return alive_;

View File

@ -62,6 +62,7 @@ class PendingTaskSafetyFlag : public rtc::RefCountInterface {
~PendingTaskSafetyFlag() = default;
void SetNotAlive();
void SetAlive();
bool alive() const;
protected: