Bug 1145015 - Part 1: Remove IsValidKey() check in MagicGrallocBufferHandle serializer. r=sotaro, r=nical

There is a data racing problem in IsValidKey() and we don't need to check the
index in serializer. The index is always invalid when we alloc new buffer.
This commit is contained in:
JerryShih 2015-03-24 03:19:00 -04:00
parent 89e09b129b
commit fc1e027e12
3 changed files with 0 additions and 18 deletions

View File

@ -147,11 +147,6 @@ ParamTraits<MagicGrallocBufferHandle>::Read(const Message* aMsg,
if (sameProcess) {
aResult->mGraphicBuffer = SharedBufferManagerParent::GetGraphicBuffer(aResult->mRef);
} else {
if (SharedBufferManagerChild::GetSingleton()->IsValidKey(index)) {
aResult->mGraphicBuffer = SharedBufferManagerChild::GetSingleton()->GetGraphicBuffer(index);
}
MOZ_ASSERT(!aResult->mGraphicBuffer.get());
// Deserialize GraphicBuffer
#if ANDROID_VERSION >= 19
sp<GraphicBuffer> buffer(new GraphicBuffer());

View File

@ -365,16 +365,5 @@ SharedBufferManagerChild::GetGraphicBuffer(int64_t key)
}
#endif
bool
SharedBufferManagerChild::IsValidKey(int64_t key)
{
#ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC
if (mBuffers.count(key) != 1) {
return false;
}
#endif
return true;
}
} /* namespace layers */
} /* namespace mozilla */

View File

@ -113,8 +113,6 @@ public:
android::sp<android::GraphicBuffer> GetGraphicBuffer(int64_t key);
#endif
bool IsValidKey(int64_t key);
base::Thread* GetThread() const;
MessageLoop* GetMessageLoop() const;