summaryrefslogtreecommitdiff
path: root/transport/HidlTransportSupport.cpp
diff options
context:
space:
mode:
authorSteven Moreland <smoreland@google.com>2018-12-12 15:56:33 -0800
committerSteven Moreland <smoreland@google.com>2018-12-13 00:13:15 +0000
commit87d991be8a39baeeb728f3f0f397ef6ecb09f990 (patch)
treee6b2481da983b44830d5dee712cd7a6a09e1362c /transport/HidlTransportSupport.cpp
parentace631e16ab357e2628a54a7f8e4ba928f403777 (diff)
downloadlibhidl-87d991be8a39baeeb728f3f0f397ef6ecb09f990.tar.gz
interfacesEqual: not templatized, use const sp&.
So, this will save space when the function is used, and it'll also save copies (when the object is already of this type, otherwise, the conversion constructor will still be invoked). Bug: 118394906 Test: boot, hidl_test Change-Id: I3cb81d578df43e9e91d54f52945c0c44cc35208e
Diffstat (limited to 'transport/HidlTransportSupport.cpp')
-rw-r--r--transport/HidlTransportSupport.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/transport/HidlTransportSupport.cpp b/transport/HidlTransportSupport.cpp
index 591ccba..c9937f1 100644
--- a/transport/HidlTransportSupport.cpp
+++ b/transport/HidlTransportSupport.cpp
@@ -23,6 +23,8 @@
namespace android {
namespace hardware {
+using ::android::hidl::base::V1_0::IBase;
+
void configureRpcThreadpool(size_t maxThreads, bool callerWillJoin) {
// TODO(b/32756130) this should be transport-dependent
configureBinderRpcThreadpool(maxThreads, callerWillJoin);
@@ -40,8 +42,7 @@ status_t handleTransportPoll(int /*fd*/) {
return handleBinderPoll();
}
-bool setMinSchedulerPolicy(const sp<::android::hidl::base::V1_0::IBase>& service,
- int policy, int priority) {
+bool setMinSchedulerPolicy(const sp<IBase>& service, int policy, int priority) {
if (service->isRemote()) {
LOG(ERROR) << "Can't set scheduler policy on remote service.";
return false;
@@ -74,7 +75,7 @@ bool setMinSchedulerPolicy(const sp<::android::hidl::base::V1_0::IBase>& service
// release in the meta-version sense, we should remove this.
std::unique_lock<std::mutex> lock = details::gServicePrioMap.lock();
- std::vector<wp<::android::hidl::base::V1_0::IBase>> toDelete;
+ std::vector<wp<IBase>> toDelete;
for (const auto& kv : details::gServicePrioMap) {
if (kv.first.promote() == nullptr) {
toDelete.push_back(kv.first);
@@ -88,6 +89,13 @@ bool setMinSchedulerPolicy(const sp<::android::hidl::base::V1_0::IBase>& service
return true;
}
+bool interfacesEqual(const sp<IBase>& left, const sp<IBase>& right) {
+ if (left == nullptr || right == nullptr || !left->isRemote() || !right->isRemote()) {
+ return left == right;
+ }
+ return getOrCreateCachedBinder(left.get()) == getOrCreateCachedBinder(right.get());
+}
+
namespace details {
int32_t getPidIfSharable() {
#if LIBHIDL_TARGET_DEBUGGABLE