Update p2p/ to use C++ lambdas instead of rtc::Bind

Bug: webrtc:11339
Change-Id: Ie128e2ed8acb445b453682b88ceb86d968850ef1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/201726
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32994}
This commit is contained in:
Niels Möller
2021-01-14 12:20:27 +01:00
committed by Commit Bot
parent 3ae09f5419
commit 87e9f6e666
5 changed files with 11 additions and 16 deletions

View File

@ -241,7 +241,7 @@ class FakeIceTransport : public IceTransportInternal {
if (async_) {
invoker_.AsyncInvokeDelayed<void>(
RTC_FROM_HERE, rtc::Thread::Current(),
rtc::Bind(&FakeIceTransport::SendPacketInternal, this, packet),
[this, packet] { FakeIceTransport::SendPacketInternal(packet); },
async_delay_ms_);
} else {
SendPacketInternal(packet);

View File

@ -18,7 +18,6 @@
#include "p2p/base/basic_packet_socket_factory.h"
#include "p2p/base/port_allocator.h"
#include "p2p/base/udp_port.h"
#include "rtc_base/bind.h"
#include "rtc_base/net_helpers.h"
#include "rtc_base/thread.h"
@ -222,9 +221,7 @@ class FakePortAllocator : public cricket::PortAllocator {
Initialize();
return;
}
network_thread_->Invoke<void>(RTC_FROM_HERE,
rtc::Bind(&PortAllocator::Initialize,
static_cast<PortAllocator*>(this)));
network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { Initialize(); });
}
void SetNetworkIgnoreMask(int network_ignore_mask) override {}

View File

@ -1276,7 +1276,9 @@ void TurnPort::ScheduleEntryDestruction(TurnEntry* entry) {
entry->set_destruction_timestamp(timestamp);
invoker_.AsyncInvokeDelayed<void>(
RTC_FROM_HERE, thread(),
rtc::Bind(&TurnPort::DestroyEntryIfNotCancelled, this, entry, timestamp),
[this, entry, timestamp] {
DestroyEntryIfNotCancelled(entry, timestamp);
},
TURN_PERMISSION_TIMEOUT);
}

View File

@ -18,7 +18,6 @@
#include "api/packet_socket_factory.h"
#include "api/transport/stun.h"
#include "p2p/base/async_stun_tcp_socket.h"
#include "rtc_base/bind.h"
#include "rtc_base/byte_buffer.h"
#include "rtc_base/checks.h"
#include "rtc_base/helpers.h"
@ -575,7 +574,7 @@ void TurnServer::DestroyInternalSocket(rtc::AsyncPacketSocket* socket) {
sockets_to_delete_.push_back(
std::unique_ptr<rtc::AsyncPacketSocket>(socket));
invoker_.AsyncInvoke<void>(RTC_FROM_HERE, rtc::Thread::Current(),
rtc::Bind(&TurnServer::FreeSockets, this));
[this] { FreeSockets(); });
}
}

View File

@ -20,7 +20,6 @@
#include "api/transport/stun.h"
#include "rtc_base/async_packet_socket.h"
#include "rtc_base/async_resolver_interface.h"
#include "rtc_base/bind.h"
#include "rtc_base/checks.h"
#include "rtc_base/constructor_magic.h"
#include "rtc_base/helpers.h"
@ -358,9 +357,8 @@ void StunProber::OnServerResolved(rtc::AsyncResolverInterface* resolver) {
// Deletion of AsyncResolverInterface can't be done in OnResolveResult which
// handles SignalDone.
invoker_.AsyncInvoke<void>(
RTC_FROM_HERE, thread_,
rtc::Bind(&rtc::AsyncResolverInterface::Destroy, resolver, false));
invoker_.AsyncInvoke<void>(RTC_FROM_HERE, thread_,
[resolver] { resolver->Destroy(false); });
servers_.pop_back();
if (servers_.size()) {
@ -458,8 +456,8 @@ void StunProber::MaybeScheduleStunRequests() {
if (Done()) {
invoker_.AsyncInvokeDelayed<void>(
RTC_FROM_HERE, thread_,
rtc::Bind(&StunProber::ReportOnFinished, this, SUCCESS), timeout_ms_);
RTC_FROM_HERE, thread_, [this] { ReportOnFinished(SUCCESS); },
timeout_ms_);
return;
}
if (should_send_next_request(now)) {
@ -470,8 +468,7 @@ void StunProber::MaybeScheduleStunRequests() {
next_request_time_ms_ = now + interval_ms_;
}
invoker_.AsyncInvokeDelayed<void>(
RTC_FROM_HERE, thread_,
rtc::Bind(&StunProber::MaybeScheduleStunRequests, this),
RTC_FROM_HERE, thread_, [this] { MaybeScheduleStunRequests(); },
get_wake_up_interval_ms());
}