From e429d2d373a7b12aca6fa4387522286ad5ddd40e Mon Sep 17 00:00:00 2001 From: hai007 Date: Fri, 21 Jan 2022 07:25:25 -0800 Subject: [PATCH] [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 --- CONTRIBUTING.md | 2 +- cpp/core/internal/mediums/webrtc/connection_flow.cc | 8 ++++---- cpp/core/internal/mediums/webrtc/connection_flow_test.cc | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1b3dc465..73b5c420 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,4 +29,4 @@ This project follows [Google's Open Source Community Guidelines](https://opensource.google.com/conduct/). ## Last Updated -Dec 2021 +Jaunary 2022 diff --git a/cpp/core/internal/mediums/webrtc/connection_flow.cc b/cpp/core/internal/mediums/webrtc/connection_flow.cc index a048f854..78efab68 100644 --- a/cpp/core/internal/mediums/webrtc/connection_flow.cc +++ b/cpp/core/internal/mediums/webrtc/connection_flow.cc @@ -298,8 +298,8 @@ bool ConnectionFlow::OnRemoteIceCandidatesReceived( return false; } pc->signaling_thread()->PostTask( - RTC_FROM_HERE, [this, can_run_tasks = std::weak_ptr(can_run_tasks_), - candidates = std::move(ice_candidates)]() mutable { + [this, can_run_tasks = std::weak_ptr(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(can_run_tasks_), - task = std::move(runnable)] { + [can_run_tasks = std::weak_ptr(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 diff --git a/cpp/core/internal/mediums/webrtc/connection_flow_test.cc b/cpp/core/internal/mediums/webrtc/connection_flow_test.cc index 0412a118..8dfc2401 100644 --- a/cpp/core/internal/mediums/webrtc/connection_flow_test.cc +++ b/cpp/core/internal/mediums/webrtc/connection_flow_test.cc @@ -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(); });