mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
[nearby] Migrate to new rtc::Thread::PostTask() API.
In WebRTC, rtc::Thread contains multiple PostTask signatures. The one that takes "RTC_FROM_HERE" is being deprecated. This CL upgrades to the newer version to unblock the old signature's removal. See https://crbug.com/webrtc/13582. PiperOrigin-RevId: 423317626
This commit is contained in:
+1
-1
@@ -29,4 +29,4 @@ This project follows [Google's Open Source Community
|
||||
Guidelines](https://opensource.google.com/conduct/).
|
||||
|
||||
## Last Updated
|
||||
Dec 2021
|
||||
Jaunary 2022
|
||||
|
||||
@@ -298,8 +298,8 @@ bool ConnectionFlow::OnRemoteIceCandidatesReceived(
|
||||
return false;
|
||||
}
|
||||
pc->signaling_thread()->PostTask(
|
||||
RTC_FROM_HERE, [this, can_run_tasks = std::weak_ptr<void>(can_run_tasks_),
|
||||
candidates = std::move(ice_candidates)]() mutable {
|
||||
[this, can_run_tasks = std::weak_ptr<void>(can_run_tasks_),
|
||||
candidates = std::move(ice_candidates)]() mutable {
|
||||
// don't run the task if the weak_ptr is no longer valid.
|
||||
if (!can_run_tasks.lock()) {
|
||||
return;
|
||||
@@ -515,8 +515,8 @@ bool ConnectionFlow::RunOnSignalingThread(Runnable&& runnable) {
|
||||
// We are off signaling thread, so we can't use peer connection's methods
|
||||
// but we can access the signaling thread handle.
|
||||
pc->signaling_thread()->PostTask(
|
||||
RTC_FROM_HERE, [can_run_tasks = std::weak_ptr<void>(can_run_tasks_),
|
||||
task = std::move(runnable)] {
|
||||
[can_run_tasks = std::weak_ptr<void>(can_run_tasks_),
|
||||
task = std::move(runnable)] {
|
||||
// don't run the task if the weak_ptr is no longer valid.
|
||||
// shared_ptr |can_run_tasks_| is destroyed on the same thread
|
||||
// (signaling thread). This guarantees that if the weak_ptr is valid
|
||||
|
||||
@@ -306,7 +306,7 @@ TEST_F(ConnectionFlowTest, TerminateAnswerer) {
|
||||
|
||||
CountDownLatch latch(1);
|
||||
auto pc = answerer->GetPeerConnection();
|
||||
pc->signaling_thread()->PostTask(RTC_FROM_HERE, [pc, latch]() mutable {
|
||||
pc->signaling_thread()->PostTask([pc, latch]() mutable {
|
||||
pc->Close();
|
||||
latch.CountDown();
|
||||
});
|
||||
@@ -387,7 +387,7 @@ TEST_F(ConnectionFlowTest, TerminateOfferer) {
|
||||
|
||||
CountDownLatch latch(1);
|
||||
auto pc = offerer->GetPeerConnection();
|
||||
pc->signaling_thread()->PostTask(RTC_FROM_HERE, [pc, latch]() mutable {
|
||||
pc->signaling_thread()->PostTask([pc, latch]() mutable {
|
||||
pc->Close();
|
||||
latch.CountDown();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user