Remove SetArcCleanupCallback API.

PiperOrigin-RevId: 640199327
This commit is contained in:
Anay Wadhera
2024-06-04 10:27:50 -07:00
committed by Copybara-Service
parent a882f5816d
commit 0a96c9f7e0
5 changed files with 0 additions and 42 deletions
-4
View File
@@ -181,10 +181,6 @@ void FakeNearbySharingService::OpenUrl(const ::nearby::network::Url& url) {}
// Copies text to cache/clipboard.
void FakeNearbySharingService::CopyText(absl::string_view text) {}
// Sets a cleanup callback to be called once done with transfer for ARC.
void FakeNearbySharingService::SetArcTransferCleanupCallback(
std::function<void()> callback) {}
std::string FakeNearbySharingService::Dump() const { return ""; }
NearbyShareSettings* FakeNearbySharingService::GetSettings() { return nullptr; }
-3
View File
@@ -130,9 +130,6 @@ class FakeNearbySharingService : public NearbySharingService {
// Copies text to cache/clipboard.
void CopyText(absl::string_view text) override;
// Sets a cleanup callback to be called once done with transfer for ARC.
void SetArcTransferCleanupCallback(std::function<void()> callback) override;
std::string Dump() const override;
NearbyShareSettings* GetSettings() override;
-4
View File
@@ -252,10 +252,6 @@ class NearbySharingService {
virtual void JoinWifiNetwork(absl::string_view ssid,
absl::string_view password) = 0;
// Sets a cleanup callback to be called once done with transfer for ARC.
virtual void SetArcTransferCleanupCallback(
std::function<void()> callback) = 0;
virtual std::string Dump() const = 0;
virtual void UpdateFilePathsInProgress(bool update_file_paths) = 0;
-27
View File
@@ -1010,26 +1010,6 @@ void NearbySharingServiceImpl::JoinWifiNetwork(absl::string_view ssid,
});
}
void NearbySharingServiceImpl::SetArcTransferCleanupCallback(
std::function<void()> callback) {
// In the case where multiple Nearby Share sessions are started, successive
// Nearby Share bubbles shown will prevent the user from sharing while the
// initial bubble is still active. For the successive bubble(s), we want to
// make sure only the original cleanup callback is valid.
// Also in the following case:
// 1. CrOS starts a receive transfer.
// 2. ARC starts a send transfer and |arc_transfer_cleanup_callback_| is set
// erroneously if |is_transferring_| check is missing.
// As multiple transfers cannot occur at the same time, a "Can't Share" error
// will occur. When the transfer in [1] finishes and another ARC Nearby Share
// session starts, the |arc_transfer_cleanup_callback_| can't be set if a
// value is already set to ensure all clean up is performed. Hence, check if
// not |is_transferring_| before setting |arc_transfer_cleanup_callback_|.
if (!is_transferring_ && arc_transfer_cleanup_callback_ == nullptr) {
arc_transfer_cleanup_callback_ = std::move(callback);
}
}
NearbyShareSettings* NearbySharingServiceImpl::GetSettings() {
return settings_.get();
}
@@ -2512,13 +2492,6 @@ void NearbySharingServiceImpl::OnTransferComplete() {
is_transferring_ = false;
is_sending_files_ = false;
// Cleanup ARC after send transfer completes since reading from file
// descriptor(s) are done at this point even though there could be Nearby
// Connection frames cached that are not yet sent to the remote device.
if (was_sending_files && arc_transfer_cleanup_callback_) {
arc_transfer_cleanup_callback_();
}
NL_VLOG(1) << __func__ << ": NearbySharing state change transfer finished";
// Files transfer is done! Receivers can immediately cancel, but senders
// should add a short delay to ensure the final in-flight packet(s) make
-4
View File
@@ -183,7 +183,6 @@ class NearbySharingServiceImpl
void CopyText(absl::string_view text) override;
void JoinWifiNetwork(absl::string_view ssid,
absl::string_view password) override;
void SetArcTransferCleanupCallback(std::function<void()> callback) override;
NearbyShareSettings* GetSettings() override;
nearby::sharing::api::SharingRpcNotifier* GetRpcNotifier() override;
NearbyShareLocalDeviceDataManager* GetLocalDeviceDataManager() override;
@@ -647,9 +646,6 @@ class NearbySharingServiceImpl
// finishes. When processing finishes, the event is removed from the queue.
std::queue<std::function<void()>> endpoint_discovery_events_;
// Called when cleanup for ARC is needed as part of the transfer.
std::function<void()> arc_transfer_cleanup_callback_;
// Shouldn't schedule new task after shutting down, and skip task if the
// object is null.
std::shared_ptr<bool> is_shutting_down_ = nullptr;