From 48eeee8d2b884af1cd5daac571b181d10979ed8b Mon Sep 17 00:00:00 2001 From: Janusz Sobczak Date: Fri, 15 Sep 2023 16:24:44 -0700 Subject: [PATCH] Migrate to AnyInvocable in webrtc medium PiperOrigin-RevId: 565805742 --- connections/implementation/mediums/webrtc/BUILD | 1 + .../implementation/mediums/webrtc/data_channel_listener.h | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/connections/implementation/mediums/webrtc/BUILD b/connections/implementation/mediums/webrtc/BUILD index 2d15ee8d..1928212b 100644 --- a/connections/implementation/mediums/webrtc/BUILD +++ b/connections/implementation/mediums/webrtc/BUILD @@ -42,6 +42,7 @@ cc_library( "//internal/platform:types", "//proto/mediums:web_rtc_signaling_frames_cc_proto", # TODO: Support WebRTC + "@com_google_absl//absl/functional:any_invocable", "@com_google_absl//absl/memory", "@com_google_absl//absl/time", ], diff --git a/connections/implementation/mediums/webrtc/data_channel_listener.h b/connections/implementation/mediums/webrtc/data_channel_listener.h index 8a98cda2..8e6edea8 100644 --- a/connections/implementation/mediums/webrtc/data_channel_listener.h +++ b/connections/implementation/mediums/webrtc/data_channel_listener.h @@ -17,9 +17,8 @@ #ifndef NO_WEBRTC +#include "absl/functional/any_invocable.h" #include "connections/implementation/mediums/webrtc_socket.h" -#include "connections/listeners.h" -#include "internal/platform/byte_array.h" namespace nearby { namespace connections { @@ -29,11 +28,11 @@ namespace mediums { struct DataChannelListener { // Called when the data channel is open and the socket wraper is ready to // read and write. - std::function data_channel_open_cb = + absl::AnyInvocable data_channel_open_cb = [](WebRtcSocketWrapper) {}; // Called when the data channel is closed. - std::function data_channel_closed_cb = []() {}; + absl::AnyInvocable data_channel_closed_cb = []() {}; }; } // namespace mediums