summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ian Pedowitz <ijpedowitz@google.com> 2015-10-22 22:41:13 +0000
committer android-build-merger <android-build-merger@google.com> 2015-10-22 22:41:13 +0000
commit4daca51a1a27b1cf47c72e32889506585b9a3757 (patch)
tree5d43a70799ed5676a34c1af3179d1d492f1da3b2
parent0461dee9a8711c8e15e2442f5c63ef96e3df81b7 (diff)
parentf4ccbf8103dadabfc8e2eb01b582d9711f7d2931 (diff)
Revert "Track ashmem memory usage in Parcel" am: 6880307e8e am: 159a5c3372 am: 7a2643cd77
am: f4ccbf8103 * commit 'f4ccbf8103dadabfc8e2eb01b582d9711f7d2931': Revert "Track ashmem memory usage in Parcel"
-rw-r--r--include/binder/Parcel.h6
-rw-r--r--libs/binder/Parcel.cpp38
2 files changed, 12 insertions, 32 deletions
diff --git a/include/binder/Parcel.h b/include/binder/Parcel.h
index 7b80dd9e51..5a37e6a408 100644
--- a/include/binder/Parcel.h
+++ b/include/binder/Parcel.h
@@ -372,11 +372,9 @@ public:
private:
size_t mBlobAshmemSize;
- size_t mOpenAshmemSize;
public:
size_t getBlobAshmemSize() const;
- size_t getOpenAshmemSize() const;
};
// ---------------------------------------------------------------------------
@@ -444,9 +442,9 @@ inline TextOutput& operator<<(TextOutput& to, const Parcel& parcel)
// Generic acquire and release of objects.
void acquire_object(const sp<ProcessState>& proc,
- const flat_binder_object& obj, const void* who, size_t* outAshmemSize);
+ const flat_binder_object& obj, const void* who);
void release_object(const sp<ProcessState>& proc,
- const flat_binder_object& obj, const void* who, size_t* outAshmemSize);
+ const flat_binder_object& obj, const void* who);
void flatten_binder(const sp<ProcessState>& proc,
const sp<IBinder>& binder, flat_binder_object* out);
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index 5a62fce840..436af85599 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -96,7 +96,7 @@ enum {
};
void acquire_object(const sp<ProcessState>& proc,
- const flat_binder_object& obj, const void* who, size_t* outAshmemSize)
+ const flat_binder_object& obj, const void* who)
{
switch (obj.type) {
case BINDER_TYPE_BINDER:
@@ -123,13 +123,8 @@ void acquire_object(const sp<ProcessState>& proc,
return;
}
case BINDER_TYPE_FD: {
- if (obj.cookie != 0) {
- // If we own an ashmem fd, keep track of how much memory it refers to.
- int size = ashmem_get_size_region(obj.handle);
- if (size > 0) {
- *outAshmemSize += size;
- }
- }
+ // intentionally blank -- nothing to do to acquire this, but we do
+ // recognize it as a legitimate object type.
return;
}
}
@@ -138,7 +133,7 @@ void acquire_object(const sp<ProcessState>& proc,
}
void release_object(const sp<ProcessState>& proc,
- const flat_binder_object& obj, const void* who, size_t* outAshmemSize)
+ const flat_binder_object& obj, const void* who)
{
switch (obj.type) {
case BINDER_TYPE_BINDER:
@@ -165,14 +160,7 @@ void release_object(const sp<ProcessState>& proc,
return;
}
case BINDER_TYPE_FD: {
- if (obj.cookie != 0) {
- int size = ashmem_get_size_region(obj.handle);
- if (size > 0) {
- *outAshmemSize -= size;
- }
-
- close(obj.handle);
- }
+ if (obj.cookie != 0) close(obj.handle);
return;
}
}
@@ -514,7 +502,7 @@ status_t Parcel::appendFrom(const Parcel *parcel, size_t offset, size_t len)
flat_binder_object* flat
= reinterpret_cast<flat_binder_object*>(mData + off);
- acquire_object(proc, *flat, this, &mOpenAshmemSize);
+ acquire_object(proc, *flat, this);
if (flat->type == BINDER_TYPE_FD) {
// If this is a file descriptor, we need to dup it so the
@@ -1235,7 +1223,7 @@ restart_write:
// Need to write meta-data?
if (nullMetaData || val.binder != 0) {
mObjects[mObjectsSize] = mDataPos;
- acquire_object(ProcessState::self(), val, this, &mOpenAshmemSize);
+ acquire_object(ProcessState::self(), val, this);
mObjectsSize++;
}
@@ -2095,7 +2083,7 @@ void Parcel::releaseObjects()
i--;
const flat_binder_object* flat
= reinterpret_cast<flat_binder_object*>(data+objects[i]);
- release_object(proc, *flat, this, &mOpenAshmemSize);
+ release_object(proc, *flat, this);
}
}
@@ -2109,7 +2097,7 @@ void Parcel::acquireObjects()
i--;
const flat_binder_object* flat
= reinterpret_cast<flat_binder_object*>(data+objects[i]);
- acquire_object(proc, *flat, this, &mOpenAshmemSize);
+ acquire_object(proc, *flat, this);
}
}
@@ -2297,7 +2285,7 @@ status_t Parcel::continueWrite(size_t desired)
// will need to rescan because we may have lopped off the only FDs
mFdsKnown = false;
}
- release_object(proc, *flat, this, &mOpenAshmemSize);
+ release_object(proc, *flat, this);
}
binder_size_t* objects =
(binder_size_t*)realloc(mObjects, objectsSize*sizeof(binder_size_t));
@@ -2384,7 +2372,6 @@ void Parcel::initState()
mAllowFds = true;
mOwner = NULL;
mBlobAshmemSize = 0;
- mOpenAshmemSize = 0;
}
void Parcel::scanForFds() const
@@ -2407,11 +2394,6 @@ size_t Parcel::getBlobAshmemSize() const
return mBlobAshmemSize;
}
-size_t Parcel::getOpenAshmemSize() const
-{
- return mOpenAshmemSize;
-}
-
// --- Parcel::Blob ---
Parcel::Blob::Blob() :