Skip to content

Commit f5f5c77

Browse files
Remove the ObjectManager::kill() function
It's an unnecessary layer. Test: m Bug: 388120087 Change-Id: I10b0025bb816f7c18ffdc0fd3007b4bfb3ac1fda
1 parent 3fea46f commit f5f5c77

2 files changed

Lines changed: 11 additions & 17 deletions

File tree

libs/binder/BpBinder.cpp

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,16 @@ BpBinder::ObjectManager::ObjectManager()
7878

7979
BpBinder::ObjectManager::~ObjectManager()
8080
{
81-
kill();
81+
const size_t N = mObjects.size();
82+
ALOGV("Killing %zu objects in manager %p", N, this);
83+
for (auto i : mObjects) {
84+
const entry_t& e = i.second;
85+
if (e.func != nullptr) {
86+
e.func(i.first, e.object, e.cleanupCookie);
87+
}
88+
}
89+
90+
mObjects.clear();
8291
}
8392

8493
void* BpBinder::ObjectManager::attach(const void* objectID, void* object, void* cleanupCookie,
@@ -144,20 +153,6 @@ sp<IBinder> BpBinder::ObjectManager::lookupOrCreateWeak(const void* objectID, ob
144153
return newObj;
145154
}
146155

147-
void BpBinder::ObjectManager::kill()
148-
{
149-
const size_t N = mObjects.size();
150-
ALOGV("Killing %zu objects in manager %p", N, this);
151-
for (auto i : mObjects) {
152-
const entry_t& e = i.second;
153-
if (e.func != nullptr) {
154-
e.func(i.first, e.object, e.cleanupCookie);
155-
}
156-
}
157-
158-
mObjects.clear();
159-
}
160-
161156
// ---------------------------------------------------------------------------
162157

163158
sp<BpBinder> BpBinder::create(int32_t handle, std::function<void()>* postTask) {

libs/binder/include/binder/BpBinder.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ class BpBinder : public IBinder {
104104
// Stop the current recording.
105105
LIBBINDER_EXPORTED status_t stopRecordingBinder();
106106

107+
// Note: This class is not thread safe so protect uses of it when necessary
107108
class ObjectManager {
108109
public:
109110
ObjectManager();
@@ -116,8 +117,6 @@ class BpBinder : public IBinder {
116117
sp<IBinder> lookupOrCreateWeak(const void* objectID, IBinder::object_make_func make,
117118
const void* makeArgs);
118119

119-
void kill();
120-
121120
private:
122121
ObjectManager(const ObjectManager&);
123122
ObjectManager& operator=(const ObjectManager&);

0 commit comments

Comments
 (0)