Remove LinkType from NearbySharingServiceFactory.

PiperOrigin-RevId: 646568953
This commit is contained in:
Francis Tsui
2024-06-25 12:32:46 -07:00
committed by Copybara-Service
parent 0640832025
commit df620dc2e6
4 changed files with 11 additions and 27 deletions
@@ -24,13 +24,12 @@
#include "sharing/nearby_connections_manager_impl.h"
#include "sharing/nearby_connections_service_impl.h"
namespace nearby {
namespace sharing {
namespace nearby::sharing {
std::unique_ptr<NearbyConnectionsManager>
NearbyConnectionsManagerFactory::CreateConnectionsManager(
LinkType link_type, nearby::TaskRunner* connections_callback_task_runner,
Context* context, nearby::DeviceInfo& device_info,
nearby::TaskRunner* connections_callback_task_runner, Context* context,
nearby::DeviceInfo& device_info,
nearby::analytics::EventLogger* event_logger) {
return std::make_unique<NearbyConnectionsManagerImpl>(
connections_callback_task_runner, context,
@@ -38,5 +37,4 @@ NearbyConnectionsManagerFactory::CreateConnectionsManager(
std::make_unique<NearbyConnectionsServiceImpl>(event_logger));
}
} // namespace sharing
} // namespace nearby
} // namespace nearby::sharing
+2 -8
View File
@@ -22,21 +22,16 @@
#include "internal/platform/task_runner.h"
#include "sharing/internal/public/context.h"
#include "sharing/nearby_connections_manager.h"
#include "sharing/nearby_sharing_service_factory.h"
namespace nearby {
namespace sharing {
namespace nearby::sharing {
class NearbyConnectionsManagerFactory {
public:
using LinkType = NearbySharingServiceFactory::LinkType;
// Return a singleton instance of NearbyConnectionsManagerFactory.
// |task_runner| is the thread when callbacks from NearbyConnection destined
// for NearSharingServiec need to be scheduled. This is usually the thread
// that NearbySharingService is running on.
static std::unique_ptr<NearbyConnectionsManager> CreateConnectionsManager(
NearbySharingServiceFactory::LinkType link_type,
nearby::TaskRunner* connections_callback_task_runner, Context* context,
nearby::DeviceInfo& device_info,
nearby::analytics::EventLogger* event_logger = nullptr);
@@ -45,7 +40,6 @@ class NearbyConnectionsManagerFactory {
NearbyConnectionsManagerFactory() = default;
};
} // namespace sharing
} // namespace nearby
} // namespace nearby::sharing
#endif // THIRD_PARTY_NEARBY_SHARING_NEARBY_CONNECTIONS_MANAGER_FACTORY_H_
+3 -6
View File
@@ -26,8 +26,7 @@
#include "sharing/nearby_sharing_service.h"
#include "sharing/nearby_sharing_service_impl.h"
namespace nearby {
namespace sharing {
namespace nearby::sharing {
using ::nearby::sharing::api::SharingPlatform;
@@ -38,7 +37,6 @@ NearbySharingServiceFactory* NearbySharingServiceFactory::GetInstance() {
}
NearbySharingService* NearbySharingServiceFactory::CreateSharingService(
LinkType link_type,
SharingPlatform& sharing_platform,
::nearby::analytics::EventLogger* event_logger) {
if (nearby_sharing_service_ != nullptr) {
@@ -53,7 +51,7 @@ NearbySharingService* NearbySharingServiceFactory::CreateSharingService(
context_->CreateSequencedTaskRunner();
auto nearby_connections_manager =
NearbyConnectionsManagerFactory::CreateConnectionsManager(
link_type, service_thread.get(), context_.get(),
service_thread.get(), context_.get(),
sharing_platform.GetDeviceInfo(), event_logger_);
nearby_sharing_service_ = std::make_unique<NearbySharingServiceImpl>(
@@ -64,5 +62,4 @@ NearbySharingService* NearbySharingServiceFactory::CreateSharingService(
return nearby_sharing_service_.get();
}
} // namespace sharing
} // namespace nearby
} // namespace nearby::sharing
+2 -7
View File
@@ -23,18 +23,14 @@
#include "sharing/nearby_sharing_decoder.h"
#include "sharing/nearby_sharing_service.h"
namespace nearby {
namespace sharing {
namespace nearby::sharing {
class NearbySharingServiceFactory {
public:
enum class LinkType { kStatic, kDynamic };
// Return a singleton instance of NearbySharingServiceFactory.
static NearbySharingServiceFactory* GetInstance();
NearbySharingService* CreateSharingService(
LinkType link_type,
nearby::sharing::api::SharingPlatform& sharing_platform,
::nearby::analytics::EventLogger* event_logger);
@@ -47,7 +43,6 @@ class NearbySharingServiceFactory {
std::unique_ptr<NearbySharingService> nearby_sharing_service_;
};
} // namespace sharing
} // namespace nearby
} // namespace nearby::sharing
#endif // THIRD_PARTY_NEARBY_SHARING_NEARBY_SHARING_SERVICE_FACTORY_H_