From 9e00f2ece821b40d949719b276016aec492f6744 Mon Sep 17 00:00:00 2001 From: Francis Tsui Date: Tue, 19 May 2026 13:53:44 -0700 Subject: [PATCH] Cleanup webrtc files. PiperOrigin-RevId: 918011253 --- .../implementation/mediums/webrtc/BUILD | 18 +++++++++--------- .../mediums/webrtc/connection_flow.cc | 12 +++++++----- .../mediums/webrtc/connection_flow.h | 7 +++---- .../mediums/webrtc/data_channel_listener.h | 4 ---- .../webrtc/local_ice_candidate_listener.h | 8 ++------ .../webrtc/session_description_wrapper.h | 8 +++----- .../mediums/webrtc/signaling_frames.cc | 10 +++++++--- .../mediums/webrtc/signaling_frames.h | 7 ++----- .../mediums/webrtc/webrtc_impl.cc | 4 ---- .../mediums/webrtc/webrtc_impl.h | 4 ---- .../mediums/webrtc/webrtc_socket_impl.cc | 4 ---- .../mediums/webrtc/webrtc_socket_impl.h | 4 ---- .../mediums/webrtc/webrtc_socket_impl_test.cc | 2 ++ 13 files changed, 35 insertions(+), 57 deletions(-) diff --git a/connections/implementation/mediums/webrtc/BUILD b/connections/implementation/mediums/webrtc/BUILD index 357bf5e3..26c8f243 100644 --- a/connections/implementation/mediums/webrtc/BUILD +++ b/connections/implementation/mediums/webrtc/BUILD @@ -25,11 +25,9 @@ cc_library( ], copts = ["-DNO_WEBRTC"], deps = [ - "//connections:core_types", "//connections/implementation/mediums:webrtc_socket", - # "//third_party/webrtc/files/stable/webrtc/api:create_peerconnection_factory", # buildcleaner: keep + "//internal/platform:base", # "//third_party/webrtc/files/stable/webrtc/api:jsep", - # "//third_party/webrtc/files/stable/webrtc/api:peer_connection_interface", "@com_google_absl//absl/functional:any_invocable", ], ) @@ -49,6 +47,11 @@ cc_library( # "//third_party/webrtc/files/stable/webrtc/api:data_channel_interface", # "//third_party/webrtc/files/stable/webrtc/api:jsep", # "//third_party/webrtc/files/stable/webrtc/api:libjingle_peerconnection_api", + # "//third_party/webrtc/files/stable/webrtc/api:rtc_error", + # "//third_party/webrtc/files/stable/webrtc/api:scoped_refptr", + "//third_party/webrtc/files/stable/webrtc/rtc_base:network_constants", + "//third_party/webrtc/files/stable/webrtc/rtc_base:refcount", + "//third_party/webrtc/files/stable/webrtc/rtc_base:threading", "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/functional:any_invocable", "@com_google_absl//absl/memory", @@ -72,9 +75,6 @@ cc_library( name = "webrtc_socket_impl", srcs = ["webrtc_socket_impl.cc"], hdrs = ["webrtc_socket_impl.h"], - visibility = [ - "//connections/implementation:__subpackages__", - ], deps = [ "//connections/implementation/mediums:webrtc_socket", "//internal/platform:base", @@ -92,7 +92,7 @@ cc_library( srcs = ["webrtc_impl.cc"], hdrs = ["webrtc_impl.h"], visibility = [ - "//connections/implementation:__subpackages__", + "//connections/implementation/mediums:__pkg__", ], deps = [ ":connection_flow", @@ -128,7 +128,6 @@ cc_test( ], shard_count = 16, tags = [ - "notsan", # NOTE(b/139734036): known data race in usrsctplib. "requires-net:external", ], deps = [ @@ -144,11 +143,12 @@ cc_test( "//internal/platform:comm", "//internal/platform:test_util", "//internal/platform:types", - "//internal/platform/implementation/g3", # buildcleaner: keep + "//internal/platform/implementation:platform_impl", "//internal/test", # "//third_party/webrtc/files/stable/webrtc/api:data_channel_interface", # "//third_party/webrtc/files/stable/webrtc/api:jsep", # "//third_party/webrtc/files/stable/webrtc/api:scoped_refptr", + "//third_party/webrtc/files/stable/webrtc/rtc_base:refcount", "@com_github_protobuf_matchers//protobuf-matchers", "@com_google_absl//absl/strings:string_view", "@com_google_absl//absl/time", diff --git a/connections/implementation/mediums/webrtc/connection_flow.cc b/connections/implementation/mediums/webrtc/connection_flow.cc index bff8e441..02f31b20 100644 --- a/connections/implementation/mediums/webrtc/connection_flow.cc +++ b/connections/implementation/mediums/webrtc/connection_flow.cc @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef NO_WEBRTC - #include "connections/implementation/mediums/webrtc/connection_flow.h" #include @@ -27,7 +25,6 @@ #include "connections/implementation/mediums/webrtc/local_ice_candidate_listener.h" #include "connections/implementation/mediums/webrtc/session_description_wrapper.h" #include "connections/implementation/mediums/webrtc/webrtc_socket_impl.h" -#include "connections/implementation/mediums/webrtc_socket.h" #include "internal/platform/exception.h" #include "internal/platform/future.h" #include "internal/platform/logging.h" @@ -36,6 +33,13 @@ #include "internal/platform/webrtc.h" #include "webrtc/api/data_channel_interface.h" #include "webrtc/api/jsep.h" +#include "webrtc/api/peer_connection_interface.h" +#include "webrtc/api/rtc_error.h" +#include "webrtc/api/scoped_refptr.h" +#include "webrtc/api/set_local_description_observer_interface.h" +#include "webrtc/api/set_remote_description_observer_interface.h" +#include "webrtc/rtc_base/ref_counted_object.h" +#include "webrtc/rtc_base/thread.h" namespace nearby { namespace connections { @@ -579,5 +583,3 @@ ConnectionFlow::GetAndResetPeerConnection() { } // namespace mediums } // namespace connections } // namespace nearby - -#endif diff --git a/connections/implementation/mediums/webrtc/connection_flow.h b/connections/implementation/mediums/webrtc/connection_flow.h index 73e8294e..b83cfe0b 100644 --- a/connections/implementation/mediums/webrtc/connection_flow.h +++ b/connections/implementation/mediums/webrtc/connection_flow.h @@ -15,8 +15,6 @@ #ifndef CORE_INTERNAL_MEDIUMS_WEBRTC_CONNECTION_FLOW_H_ #define CORE_INTERNAL_MEDIUMS_WEBRTC_CONNECTION_FLOW_H_ -#ifndef NO_WEBRTC - #include #include @@ -34,7 +32,10 @@ #include "internal/platform/runnable.h" #include "internal/platform/webrtc.h" #include "webrtc/api/data_channel_interface.h" +#include "webrtc/api/jsep.h" #include "webrtc/api/peer_connection_interface.h" +#include "webrtc/api/scoped_refptr.h" +#include "webrtc/rtc_base/network_constants.h" namespace nearby { namespace connections { @@ -246,6 +247,4 @@ class ConnectionFlow : public webrtc::PeerConnectionObserver { } // namespace connections } // namespace nearby -#endif - #endif // CORE_INTERNAL_MEDIUMS_WEBRTC_CONNECTION_FLOW_H_ diff --git a/connections/implementation/mediums/webrtc/data_channel_listener.h b/connections/implementation/mediums/webrtc/data_channel_listener.h index ec679940..cb4e39b3 100644 --- a/connections/implementation/mediums/webrtc/data_channel_listener.h +++ b/connections/implementation/mediums/webrtc/data_channel_listener.h @@ -15,8 +15,6 @@ #ifndef CORE_INTERNAL_MEDIUMS_WEBRTC_DATA_CHANNEL_LISTENER_H_ #define CORE_INTERNAL_MEDIUMS_WEBRTC_DATA_CHANNEL_LISTENER_H_ -#ifndef NO_WEBRTC - #include #include "absl/functional/any_invocable.h" @@ -41,6 +39,4 @@ struct DataChannelListener { } // namespace connections } // namespace nearby -#endif // NO_WEBRTC - #endif // CORE_INTERNAL_MEDIUMS_WEBRTC_DATA_CHANNEL_LISTENER_H_ diff --git a/connections/implementation/mediums/webrtc/local_ice_candidate_listener.h b/connections/implementation/mediums/webrtc/local_ice_candidate_listener.h index da71236f..a3b10fd0 100644 --- a/connections/implementation/mediums/webrtc/local_ice_candidate_listener.h +++ b/connections/implementation/mediums/webrtc/local_ice_candidate_listener.h @@ -15,11 +15,9 @@ #ifndef CORE_INTERNAL_MEDIUMS_WEBRTC_LOCAL_ICE_CANDIDATE_LISTENER_H_ #define CORE_INTERNAL_MEDIUMS_WEBRTC_LOCAL_ICE_CANDIDATE_LISTENER_H_ -#ifndef NO_WEBRTC - -#include "connections/listeners.h" +#include "absl/functional/any_invocable.h" +#include "internal/platform/listeners.h" #include "webrtc/api/jsep.h" -#include "webrtc/api/peer_connection_interface.h" namespace nearby { namespace connections { @@ -37,6 +35,4 @@ struct LocalIceCandidateListener { } // namespace connections } // namespace nearby -#endif - #endif // CORE_INTERNAL_MEDIUMS_WEBRTC_LOCAL_ICE_CANDIDATE_LISTENER_H_ diff --git a/connections/implementation/mediums/webrtc/session_description_wrapper.h b/connections/implementation/mediums/webrtc/session_description_wrapper.h index ef468120..a099b175 100644 --- a/connections/implementation/mediums/webrtc/session_description_wrapper.h +++ b/connections/implementation/mediums/webrtc/session_description_wrapper.h @@ -15,9 +15,9 @@ #ifndef CORE_INTERNAL_MEDIUMS_WEBRTC_SESSION_DESCRIPTION_WRAPPER_H_ #define CORE_INTERNAL_MEDIUMS_WEBRTC_SESSION_DESCRIPTION_WRAPPER_H_ -#ifndef NO_WEBRTC - -#include "webrtc/api/peer_connection_interface.h" +#include +#include +#include "webrtc/api/jsep.h" // Wrapper object around SessionDescriptionInterface*. // This object owns the SessionDescriptionInterface* unless Release() has been @@ -63,6 +63,4 @@ class SessionDescriptionWrapper { std::unique_ptr impl_; }; -#endif - #endif // CORE_INTERNAL_MEDIUMS_WEBRTC_SESSION_DESCRIPTION_WRAPPER_H_ diff --git a/connections/implementation/mediums/webrtc/signaling_frames.cc b/connections/implementation/mediums/webrtc/signaling_frames.cc index 8991c60a..b59f8c7d 100644 --- a/connections/implementation/mediums/webrtc/signaling_frames.cc +++ b/connections/implementation/mediums/webrtc/signaling_frames.cc @@ -12,9 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef NO_WEBRTC +#include +#include +#include +#include #include "connections/implementation/mediums/webrtc/signaling_frames.h" +#include "connections/implementation/mediums/webrtc_peer_id.h" +#include "internal/platform/byte_array.h" +#include "webrtc/api/jsep.h" namespace nearby { namespace connections { @@ -131,5 +137,3 @@ location::nearby::mediums::IceCandidate EncodeIceCandidate( } // namespace mediums } // namespace connections } // namespace nearby - -#endif diff --git a/connections/implementation/mediums/webrtc/signaling_frames.h b/connections/implementation/mediums/webrtc/signaling_frames.h index 6e13645d..c6579463 100644 --- a/connections/implementation/mediums/webrtc/signaling_frames.h +++ b/connections/implementation/mediums/webrtc/signaling_frames.h @@ -15,14 +15,13 @@ #ifndef CORE_INTERNAL_MEDIUMS_WEBRTC_SIGNALING_FRAMES_H_ #define CORE_INTERNAL_MEDIUMS_WEBRTC_SIGNALING_FRAMES_H_ -#ifndef NO_WEBRTC - +#include #include #include "connections/implementation/mediums/webrtc_peer_id.h" #include "internal/platform/byte_array.h" #include "proto/mediums/web_rtc_signaling_frames.pb.h" -#include "webrtc/api/peer_connection_interface.h" +#include "webrtc/api/jsep.h" namespace nearby { namespace connections { @@ -55,6 +54,4 @@ std::vector> DecodeIceCandidates( } // namespace connections } // namespace nearby -#endif - #endif // CORE_INTERNAL_MEDIUMS_WEBRTC_SIGNALING_FRAMES_H_ diff --git a/connections/implementation/mediums/webrtc/webrtc_impl.cc b/connections/implementation/mediums/webrtc/webrtc_impl.cc index 372c8434..85202f7c 100644 --- a/connections/implementation/mediums/webrtc/webrtc_impl.cc +++ b/connections/implementation/mediums/webrtc/webrtc_impl.cc @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef NO_WEBRTC - #include "connections/implementation/mediums/webrtc/webrtc_impl.h" #include @@ -789,5 +787,3 @@ bool WebRtcImpl::IsUsingCellular() { } // namespace mediums } // namespace connections } // namespace nearby - -#endif // NO_WEBRTC diff --git a/connections/implementation/mediums/webrtc/webrtc_impl.h b/connections/implementation/mediums/webrtc/webrtc_impl.h index 5bc91189..349581bd 100644 --- a/connections/implementation/mediums/webrtc/webrtc_impl.h +++ b/connections/implementation/mediums/webrtc/webrtc_impl.h @@ -15,8 +15,6 @@ #ifndef CORE_INTERNAL_MEDIUMS_WEBRTC_WEBRTC_IMPL_H_ #define CORE_INTERNAL_MEDIUMS_WEBRTC_WEBRTC_IMPL_H_ -#ifndef NO_WEBRTC - #include #include #include @@ -249,6 +247,4 @@ class WebRtcImpl : public WebRtc { } // namespace connections } // namespace nearby -#endif // NO_WEBRTC - #endif // CORE_INTERNAL_MEDIUMS_WEBRTC_WEBRTC_IMPL_H_ diff --git a/connections/implementation/mediums/webrtc/webrtc_socket_impl.cc b/connections/implementation/mediums/webrtc/webrtc_socket_impl.cc index c34160c5..ff8a3a03 100644 --- a/connections/implementation/mediums/webrtc/webrtc_socket_impl.cc +++ b/connections/implementation/mediums/webrtc/webrtc_socket_impl.cc @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef NO_WEBRTC - #include "connections/implementation/mediums/webrtc/webrtc_socket_impl.h" #include @@ -203,5 +201,3 @@ void WebRtcSocketImpl::OffloadFromSignalingThread(Runnable runnable) { } // namespace mediums } // namespace connections } // namespace nearby - -#endif // NO_WEBRTC diff --git a/connections/implementation/mediums/webrtc/webrtc_socket_impl.h b/connections/implementation/mediums/webrtc/webrtc_socket_impl.h index 071522ef..b3605462 100644 --- a/connections/implementation/mediums/webrtc/webrtc_socket_impl.h +++ b/connections/implementation/mediums/webrtc/webrtc_socket_impl.h @@ -15,8 +15,6 @@ #ifndef CORE_INTERNAL_MEDIUMS_WEBRTC_WEBRTC_SOCKET_IMPL_H_ #define CORE_INTERNAL_MEDIUMS_WEBRTC_WEBRTC_SOCKET_IMPL_H_ -#ifndef NO_WEBRTC - #include #include #include @@ -131,6 +129,4 @@ class WebRtcSocketImpl : public WebRtcSocket, } // namespace connections } // namespace nearby -#endif // NO_WEBRTC - #endif // CORE_INTERNAL_MEDIUMS_WEBRTC_WEBRTC_SOCKET_IMPL_H_ diff --git a/connections/implementation/mediums/webrtc/webrtc_socket_impl_test.cc b/connections/implementation/mediums/webrtc/webrtc_socket_impl_test.cc index b7f46c3a..fdffc732 100644 --- a/connections/implementation/mediums/webrtc/webrtc_socket_impl_test.cc +++ b/connections/implementation/mediums/webrtc/webrtc_socket_impl_test.cc @@ -24,6 +24,8 @@ #include "internal/platform/byte_array.h" #include "internal/platform/exception.h" #include "webrtc/api/data_channel_interface.h" +#include "webrtc/api/scoped_refptr.h" +#include "webrtc/rtc_base/ref_counted_object.h" namespace nearby { namespace connections {