OSDN Git Service

Remove unnecessary mutex locks from texture sharing code
authorDerek Sollenberger <djsollen@google.com>
Tue, 12 Oct 2010 18:56:35 +0000 (14:56 -0400)
committerDerek Sollenberger <djsollen@google.com>
Tue, 12 Oct 2010 18:56:35 +0000 (14:56 -0400)
The DoubleBufferedTexture currently uses a mutex to protect access
to m_frontTexture on the producer functions.  This mutex is not needed
in the producerLock/producerRelease functions as they will always be
called by the thread that sets m_frontTexture.  Additionally, this
data will be initialized before calls to those funtions as the thread
must always call aquireContext() before calling these functions.

Change-Id: I110ad357c5eed4c0f5501761174e0da4b872af5d
http://b/3089605

WebCore/platform/graphics/android/DoubleBufferedTexture.cpp

index e713398..7746603 100644 (file)
@@ -95,9 +95,7 @@ EGLContext DoubleBufferedTexture::producerAcquireContext() {
 }
 
 TextureInfo* DoubleBufferedTexture::producerLock() {
-    m_varLock.lock();
     SharedTexture* sharedTex = getFrontTexture();
-    m_varLock.unlock();
     LOGV("Acquiring P Lock (%d)", sharedTex->getSourceTextureId());
     TextureInfo* texInfo = sharedTex->lockSource();
     LOGV("Acquired P Lock");
@@ -106,11 +104,9 @@ TextureInfo* DoubleBufferedTexture::producerLock() {
 }
 
 void DoubleBufferedTexture::producerRelease() {
-    m_varLock.lock();
     // get the front texture and cache the id
     SharedTexture* sharedTex = getFrontTexture();
     LOGV("Releasing P Lock (%d)", sharedTex->getSourceTextureId());
-    m_varLock.unlock();
 
     sharedTex->releaseSource();