diff options
author | 2024-04-22 10:35:34 -0700 | |
---|---|---|
committer | 2024-04-25 00:58:20 +0000 | |
commit | 9857069d436ceda50cce0d4950f6d177ae02d690 (patch) | |
tree | 870e96792119ba0a313616a908dd1f6a83e4b942 | |
parent | 0164b9b9b6baf97347c9b7164aa0e2ff798dfd99 (diff) |
contextual_callback: Remove unused apis
Bug: 336298374
Test: m .
Flag: EXEMPT, Unused Code Removal
Change-Id: I8b9c933d7bc10c45d4ab24853e92bcd10fd8dc00
-rw-r--r-- | system/gd/common/contextual_callback.h | 16 | ||||
-rw-r--r-- | system/gd/hci/hci_layer.cc | 2 | ||||
-rw-r--r-- | system/gd/hci/remote_name_request.cc | 2 | ||||
-rw-r--r-- | system/gd/l2cap/internal/dynamic_channel_impl.cc | 2 |
4 files changed, 3 insertions, 19 deletions
diff --git a/system/gd/common/contextual_callback.h b/system/gd/common/contextual_callback.h index 9fb5a5a213..a5f565c395 100644 --- a/system/gd/common/contextual_callback.h +++ b/system/gd/common/contextual_callback.h @@ -48,14 +48,6 @@ class ContextualOnceCallback<R(Args...)> { return context_ && callback_; } - void Invoke(Args... args) { - context_->Post(common::BindOnce(std::move(callback_), std::forward<Args>(args)...)); - } - - bool IsEmpty() { - return context_ == nullptr; - } - private: common::OnceCallback<R(Args...)> callback_; IPostableContext* context_; @@ -90,14 +82,6 @@ class ContextualCallback<R(Args...)> { return context_ && callback_; } - void Invoke(Args... args) { - context_->Post(common::BindOnce(callback_, std::forward<Args>(args)...)); - } - - bool IsEmpty() { - return context_ == nullptr; - } - private: common::Callback<R(Args...)> callback_; IPostableContext* context_; diff --git a/system/gd/hci/hci_layer.cc b/system/gd/hci/hci_layer.cc index f821afd6cd..aa41eb0867 100644 --- a/system/gd/hci/hci_layer.cc +++ b/system/gd/hci/hci_layer.cc @@ -228,7 +228,7 @@ struct HciLayer::impl { CommandCompleteView::Create(EventView::Create(PacketView<kLittleEndian>(complete))); log::assert_that( command_complete_view.IsValid(), "assert failed: command_complete_view.IsValid()"); - command_queue_.front().GetCallback<CommandCompleteView>()->Invoke(command_complete_view); + (*command_queue_.front().GetCallback<CommandCompleteView>())(command_complete_view); } else { log::assert_that( command_queue_.front().waiting_for_status_ == is_status, diff --git a/system/gd/hci/remote_name_request.cc b/system/gd/hci/remote_name_request.cc index e35b928c67..5f8fd685c9 100644 --- a/system/gd/hci/remote_name_request.cc +++ b/system/gd/hci/remote_name_request.cc @@ -177,7 +177,7 @@ struct RemoteNameRequestModule::impl { void on_remote_host_supported_features_notification(EventView view) { auto packet = RemoteHostSupportedFeaturesNotificationView::Create(view); log::assert_that(packet.IsValid(), "assert failed: packet.IsValid()"); - if (pending_ && !on_remote_host_supported_features_notification_.IsEmpty()) { + if (pending_ && on_remote_host_supported_features_notification_) { log::info( "Received REMOTE_HOST_SUPPORTED_FEATURES_NOTIFICATION from {}", packet.GetBdAddr().ToRedactedStringForLogging()); diff --git a/system/gd/l2cap/internal/dynamic_channel_impl.cc b/system/gd/l2cap/internal/dynamic_channel_impl.cc index 26139fd5a6..dfd2bc335e 100644 --- a/system/gd/l2cap/internal/dynamic_channel_impl.cc +++ b/system/gd/l2cap/internal/dynamic_channel_impl.cc @@ -47,7 +47,7 @@ hci::AddressWithType DynamicChannelImpl::GetDevice() const { } void DynamicChannelImpl::RegisterOnCloseCallback(DynamicChannel::OnCloseCallback on_close_callback) { - log::assert_that(on_close_callback_.IsEmpty(), "OnCloseCallback can only be registered once"); + log::assert_that(!on_close_callback_, "OnCloseCallback can only be registered once"); // If channel is already closed, call the callback immediately without saving it if (closed_) { on_close_callback(close_reason_); |