Merge "fix [2599939] "cannot play video" after open/close a video player a dozen of times" into froyo
This commit is contained in:
committed by
Android (Google) Code Review
commit
0a4ab1b9b4
@ -36,8 +36,7 @@ public:
|
|||||||
|
|
||||||
// flags returned by getFlags()
|
// flags returned by getFlags()
|
||||||
enum {
|
enum {
|
||||||
READ_ONLY = 0x00000001,
|
READ_ONLY = 0x00000001
|
||||||
MAP_ONCE = 0x00000002
|
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual int getHeapID() const = 0;
|
virtual int getHeapID() const = 0;
|
||||||
|
@ -32,7 +32,6 @@ class MemoryHeapBase : public virtual BnMemoryHeap
|
|||||||
public:
|
public:
|
||||||
enum {
|
enum {
|
||||||
READ_ONLY = IMemoryHeap::READ_ONLY,
|
READ_ONLY = IMemoryHeap::READ_ONLY,
|
||||||
MAP_ONCE = IMemoryHeap::MAP_ONCE,
|
|
||||||
// memory won't be mapped locally, but will be mapped in the remote
|
// memory won't be mapped locally, but will be mapped in the remote
|
||||||
// process.
|
// process.
|
||||||
DONT_MAP_LOCALLY = 0x00000100,
|
DONT_MAP_LOCALLY = 0x00000100,
|
||||||
|
@ -46,8 +46,7 @@ public:
|
|||||||
sp<MemoryHeapPmem> mClientHeap;
|
sp<MemoryHeapPmem> mClientHeap;
|
||||||
};
|
};
|
||||||
|
|
||||||
MemoryHeapPmem(const sp<MemoryHeapBase>& pmemHeap,
|
MemoryHeapPmem(const sp<MemoryHeapBase>& pmemHeap, uint32_t flags = 0);
|
||||||
uint32_t flags = IMemoryHeap::MAP_ONCE);
|
|
||||||
~MemoryHeapPmem();
|
~MemoryHeapPmem();
|
||||||
|
|
||||||
/* HeapInterface additions */
|
/* HeapInterface additions */
|
||||||
|
@ -46,7 +46,6 @@ public:
|
|||||||
virtual void binderDied(const wp<IBinder>& who);
|
virtual void binderDied(const wp<IBinder>& who);
|
||||||
|
|
||||||
sp<IMemoryHeap> find_heap(const sp<IBinder>& binder);
|
sp<IMemoryHeap> find_heap(const sp<IBinder>& binder);
|
||||||
void pin_heap(const sp<IBinder>& binder);
|
|
||||||
void free_heap(const sp<IBinder>& binder);
|
void free_heap(const sp<IBinder>& binder);
|
||||||
sp<IMemoryHeap> get_heap(const sp<IBinder>& binder);
|
sp<IMemoryHeap> get_heap(const sp<IBinder>& binder);
|
||||||
void dump_heaps();
|
void dump_heaps();
|
||||||
@ -100,13 +99,9 @@ private:
|
|||||||
static inline void dump_heaps() {
|
static inline void dump_heaps() {
|
||||||
gHeapCache->dump_heaps();
|
gHeapCache->dump_heaps();
|
||||||
}
|
}
|
||||||
void inline pin_heap() const {
|
|
||||||
gHeapCache->pin_heap(const_cast<BpMemoryHeap*>(this)->asBinder());
|
|
||||||
}
|
|
||||||
|
|
||||||
void assertMapped() const;
|
void assertMapped() const;
|
||||||
void assertReallyMapped() const;
|
void assertReallyMapped() const;
|
||||||
void pinHeap() const;
|
|
||||||
|
|
||||||
mutable volatile int32_t mHeapId;
|
mutable volatile int32_t mHeapId;
|
||||||
mutable void* mBase;
|
mutable void* mBase;
|
||||||
@ -320,11 +315,6 @@ void BpMemoryHeap::assertReallyMapped() const
|
|||||||
asBinder().get(), size, fd, strerror(errno));
|
asBinder().get(), size, fd, strerror(errno));
|
||||||
close(fd);
|
close(fd);
|
||||||
} else {
|
} else {
|
||||||
if (flags & MAP_ONCE) {
|
|
||||||
//LOGD("pinning heap (binder=%p, size=%d, fd=%d",
|
|
||||||
// asBinder().get(), size, fd);
|
|
||||||
pin_heap();
|
|
||||||
}
|
|
||||||
mSize = size;
|
mSize = size;
|
||||||
mFlags = flags;
|
mFlags = flags;
|
||||||
android_atomic_write(fd, &mHeapId);
|
android_atomic_write(fd, &mHeapId);
|
||||||
@ -421,19 +411,6 @@ sp<IMemoryHeap> HeapCache::find_heap(const sp<IBinder>& binder)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeapCache::pin_heap(const sp<IBinder>& binder)
|
|
||||||
{
|
|
||||||
Mutex::Autolock _l(mHeapCacheLock);
|
|
||||||
ssize_t i = mHeapCache.indexOfKey(binder);
|
|
||||||
if (i>=0) {
|
|
||||||
heap_info_t& info(mHeapCache.editValueAt(i));
|
|
||||||
android_atomic_inc(&info.count);
|
|
||||||
binder->linkToDeath(this);
|
|
||||||
} else {
|
|
||||||
LOGE("pin_heap binder=%p not found!!!", binder.get());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void HeapCache::free_heap(const sp<IBinder>& binder) {
|
void HeapCache::free_heap(const sp<IBinder>& binder) {
|
||||||
free_heap( wp<IBinder>(binder) );
|
free_heap( wp<IBinder>(binder) );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user