diff --git a/Package.swift b/Package.swift index 09c96c3e..27d9b761 100644 --- a/Package.swift +++ b/Package.swift @@ -525,8 +525,8 @@ let package = Package( "connections/implementation/webrtc_endpoint_channel.cc", "connections/implementation/mediums/webrtc.cc", "connections/implementation/mediums/webrtc", - "internal/platform/tachyon_express_signaling_messenger.cc", - "internal/platform/tachyon_express_signaling_messenger.h", + "connections/implementation/mediums/webrtc/tachyon_express_signaling_messenger.cc", + "connections/implementation/mediums/webrtc/tachyon_express_signaling_messenger.h", "internal/platform/implementation/apple/webrtc.h", "internal/platform/implementation/apple/webrtc.mm", // This breaks the build, but seems to work fine without it? diff --git a/connections/implementation/mediums/webrtc/BUILD b/connections/implementation/mediums/webrtc/BUILD index dfca3a94..a1fae7a8 100644 --- a/connections/implementation/mediums/webrtc/BUILD +++ b/connections/implementation/mediums/webrtc/BUILD @@ -144,6 +144,37 @@ cc_library( ], ) +cc_library( + name = "tachyon_express_signaling_messenger", + srcs = ["tachyon_express_signaling_messenger.cc"], + hdrs = ["tachyon_express_signaling_messenger.h"], + visibility = [ + "//connections:__subpackages__", + "//internal/platform/implementation:__subpackages__", + "//internal/test:__subpackages__", + ], + deps = [ + "//internal/account", + "//internal/platform:base", + "//internal/platform:logging", + "//internal/platform:types", + "//internal/platform/implementation:webrtc_platform", + "//internal/proto:messaging_cc_grpc_proto", + "//internal/proto:tachyon_cc_proto", + "//internal/rpc:utils", + "//location/nearby/sharing/lib/account:account_manager", + "//third_party/gloop/util/random:mt_random", + "//third_party/grpc:gpr", + "//third_party/grpc:grpc++", + "//util/random:util", + "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/functional:any_invocable", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/synchronization", + "@com_google_absl//absl/time", + ], +) + cc_library( name = "fake_webrtc", testonly = True, diff --git a/internal/platform/tachyon_express_signaling_messenger.cc b/connections/implementation/mediums/webrtc/tachyon_express_signaling_messenger.cc similarity index 98% rename from internal/platform/tachyon_express_signaling_messenger.cc rename to connections/implementation/mediums/webrtc/tachyon_express_signaling_messenger.cc index e430f7ff..9e6efa79 100644 --- a/internal/platform/tachyon_express_signaling_messenger.cc +++ b/connections/implementation/mediums/webrtc/tachyon_express_signaling_messenger.cc @@ -12,9 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef NO_WEBRTC - -#include "internal/platform/tachyon_express_signaling_messenger.h" +#include "connections/implementation/mediums/webrtc/tachyon_express_signaling_messenger.h" #include #include @@ -36,7 +34,6 @@ #include "internal/account/account_manager_impl.h" #include "internal/platform/byte_array.h" #include "internal/platform/count_down_latch.h" -#include "internal/platform/implementation/webrtc.h" #include "internal/platform/logging.h" #include "internal/proto/messaging.grpc.pb.h" #include "internal/proto/tachyon.proto.h" @@ -45,7 +42,7 @@ #include "internal/rpc/utils.h" #include "util/random/util.h" -namespace nearby { +namespace nearby::connections::mediums { namespace { using ::google::internal::communications::instantmessaging::v1::ClientInfo; @@ -340,6 +337,4 @@ bool TachyonExpressSignalingMessenger::SendMessage(absl::string_view peer_id, return success; } -} // namespace nearby - -#endif // #ifndef NO_WEBRTC +} // namespace nearby::connections::mediums diff --git a/internal/platform/tachyon_express_signaling_messenger.h b/connections/implementation/mediums/webrtc/tachyon_express_signaling_messenger.h similarity index 91% rename from internal/platform/tachyon_express_signaling_messenger.h rename to connections/implementation/mediums/webrtc/tachyon_express_signaling_messenger.h index 8f01bddd..47c6f59c 100644 --- a/internal/platform/tachyon_express_signaling_messenger.h +++ b/connections/implementation/mediums/webrtc/tachyon_express_signaling_messenger.h @@ -12,12 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef THIRD_PARTY_NEARBY_INTERNAL_PLATFORM_TACHYON_MESSAGING_CLIENT_H_ -#define THIRD_PARTY_NEARBY_INTERNAL_PLATFORM_TACHYON_MESSAGING_CLIENT_H_ - -#ifndef NO_WEBRTC - -#include +#ifndef CORE_INTERNAL_MEDIUMS_WEBRTC_TACHYON_MESSAGING_CLIENT_H_ +#define CORE_INTERNAL_MEDIUMS_WEBRTC_TACHYON_MESSAGING_CLIENT_H_ #include #include @@ -34,7 +30,7 @@ #include "internal/platform/implementation/webrtc.h" #include "internal/proto/messaging.grpc.pb.h" -namespace nearby { +namespace nearby::connections::mediums { // Interface for the messaging Tachyon service. See // third_party/nearby/internal/proto/messaging.proto @@ -98,8 +94,6 @@ class TachyonExpressSignalingMessenger : public api::WebRtcSignalingMessenger { std::shared_ptr reader_ = nullptr; }; -} // namespace nearby +} // namespace nearby::connections::mediums -#endif // #ifndef NO_WEBRTC - -#endif // THIRD_PARTY_NEARBY_INTERNAL_PLATFORM_TACHYON_MESSAGING_CLIENT_H_ +#endif // CORE_INTERNAL_MEDIUMS_WEBRTC_TACHYON_MESSAGING_CLIENT_H_ diff --git a/internal/platform/BUILD b/internal/platform/BUILD index 2e56b1d8..e9efd49e 100644 --- a/internal/platform/BUILD +++ b/internal/platform/BUILD @@ -284,38 +284,6 @@ cc_library( ], ) -cc_library( - name = "tachyon_express_signaling_messenger", - srcs = ["tachyon_express_signaling_messenger.cc"], - hdrs = ["tachyon_express_signaling_messenger.h"], - visibility = [ - "//connections:__subpackages__", - "//internal/platform/implementation:__subpackages__", - "//internal/test:__subpackages__", - "//third_party/nearby/presence:__subpackages__", - ], - deps = [ - ":base", - ":logging", - ":types", - "//internal/account", - "//internal/platform/implementation:webrtc_platform", - "//internal/proto:messaging_cc_grpc_proto", - "//internal/proto:tachyon_cc_proto", - "//internal/rpc:utils", - "//location/nearby/sharing/lib/account:account_manager", - "//third_party/gloop/util/random:mt_random", - "//third_party/grpc:gpr", - "//third_party/grpc:grpc++", - "//util/random:util", - "@com_google_absl//absl/base:core_headers", - "@com_google_absl//absl/functional:any_invocable", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/synchronization", - "@com_google_absl//absl/time", - ], -) - cc_library( name = "comm", srcs = [ diff --git a/internal/platform/implementation/apple/BUILD b/internal/platform/implementation/apple/BUILD index 35b153f3..eb9349fa 100644 --- a/internal/platform/implementation/apple/BUILD +++ b/internal/platform/implementation/apple/BUILD @@ -61,8 +61,8 @@ objc_library( "webrtc.h", ], deps = [ + "//connections/implementation/mediums/webrtc:tachyon_express_signaling_messenger", "//internal/platform:logging", - "//internal/platform:tachyon_express_signaling_messenger", "//internal/platform:types", "//internal/platform/implementation:webrtc_platform", "//internal/proto:tachyon_cc_proto", @@ -130,7 +130,6 @@ objc_library( "//internal/crypto_cros", "//internal/platform:comm", "//internal/platform:logging", - "//internal/platform:tachyon_express_signaling_messenger", "//internal/platform:types", "//internal/proto:tachyon_cc_proto", "//internal/platform:base", diff --git a/internal/platform/implementation/apple/webrtc.mm b/internal/platform/implementation/apple/webrtc.mm index a7a50f79..755f0cb5 100644 --- a/internal/platform/implementation/apple/webrtc.mm +++ b/internal/platform/implementation/apple/webrtc.mm @@ -25,10 +25,10 @@ #include "absl/status/status.h" #include "absl/strings/string_view.h" +#include "connections/implementation/mediums/webrtc/tachyon_express_signaling_messenger.h" #include "internal/platform/count_down_latch.h" #include "internal/platform/crypto.h" #include "internal/platform/logging.h" -#include "internal/platform/tachyon_express_signaling_messenger.h" #include "internal/proto/tachyon.pb.h" #include "internal/proto/tachyon_enums.proto.h" #include "webrtc/api/create_modular_peer_connection_factory.h" @@ -91,7 +91,8 @@ void WebRtcMedium::CreatePeerConnection( std::unique_ptr WebRtcMedium::GetSignalingMessenger( absl::string_view self_id, const location::nearby::connections::LocationHint& location_hint) { - return std::make_unique(self_id, location_hint); + return std::make_unique< + nearby::connections::mediums::TachyonExpressSignalingMessenger>(self_id, location_hint); } } // namespace nearby::apple diff --git a/internal/platform/implementation/windows/BUILD b/internal/platform/implementation/windows/BUILD index 860165bb..c89f5328 100644 --- a/internal/platform/implementation/windows/BUILD +++ b/internal/platform/implementation/windows/BUILD @@ -238,9 +238,9 @@ cc_library( hdrs = ["webrtc.h"], tags = ["windows"], deps = [ + "//connections/implementation/mediums/webrtc:tachyon_express_signaling_messenger", "//internal/platform:logging", - "//internal/platform:tachyon_express_signaling_messenger", - "//internal/platform/implementation:comm", + "//internal/platform/implementation:webrtc_platform", "//third_party/webrtc/files/stable/webrtc/api:create_modular_peer_connection_factory", "//third_party/webrtc/files/stable/webrtc/api:peer_connection_interface", "//third_party/webrtc/files/stable/webrtc/api:rtc_error", diff --git a/internal/platform/implementation/windows/webrtc.cc b/internal/platform/implementation/windows/webrtc.cc index 85fa989d..cd6e366c 100644 --- a/internal/platform/implementation/windows/webrtc.cc +++ b/internal/platform/implementation/windows/webrtc.cc @@ -22,9 +22,9 @@ #include #include "absl/strings/string_view.h" +#include "connections/implementation/mediums/webrtc/tachyon_express_signaling_messenger.h" #include "internal/platform/implementation/webrtc.h" #include "internal/platform/logging.h" -#include "internal/platform/tachyon_express_signaling_messenger.h" #include "webrtc/api/create_modular_peer_connection_factory.h" #include "webrtc/api/peer_connection_interface.h" #include "webrtc/api/rtc_error.h" @@ -33,6 +33,8 @@ namespace nearby::windows { +using ::nearby::connections::mediums::TachyonExpressSignalingMessenger; + std::string WebRtcMedium::GetDefaultCountryCode() { wchar_t systemGeoName[LOCALE_NAME_MAX_LENGTH];