diff options
author | Mathias Agopian <mathias@google.com> | 2009-09-08 20:02:47 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2009-09-08 22:48:24 -0700 |
commit | 4d2de2c7696feccb9e5ecc05ac3281cdaae45418 (patch) | |
tree | 23274847d49bf4581786e0e37ba845eaaf78f38d /libs/surfaceflinger | |
parent | e40e5507007b15035b81811a5cc2298572e732a2 (diff) | |
download | frameworks_native-4d2de2c7696feccb9e5ecc05ac3281cdaae45418.zip frameworks_native-4d2de2c7696feccb9e5ecc05ac3281cdaae45418.tar.gz frameworks_native-4d2de2c7696feccb9e5ecc05ac3281cdaae45418.tar.bz2 |
rename Mutexes to make the code easier to follow
Diffstat (limited to 'libs/surfaceflinger')
-rw-r--r-- | libs/surfaceflinger/LayerBuffer.cpp | 15 | ||||
-rw-r--r-- | libs/surfaceflinger/LayerBuffer.h | 25 |
2 files changed, 21 insertions, 19 deletions
diff --git a/libs/surfaceflinger/LayerBuffer.cpp b/libs/surfaceflinger/LayerBuffer.cpp index 433b48e..0945571 100644 --- a/libs/surfaceflinger/LayerBuffer.cpp +++ b/libs/surfaceflinger/LayerBuffer.cpp @@ -354,7 +354,7 @@ void LayerBuffer::BufferSource::postBuffer(ssize_t offset) { ISurface::BufferHeap buffers; { // scope for the lock - Mutex::Autolock _l(mLock); + Mutex::Autolock _l(mBufferSourceLock); buffers = mBufferHeap; if (buffers.heap != 0) { const size_t memorySize = buffers.heap->getSize(); @@ -379,7 +379,7 @@ void LayerBuffer::BufferSource::postBuffer(ssize_t offset) void LayerBuffer::BufferSource::unregisterBuffers() { - Mutex::Autolock _l(mLock); + Mutex::Autolock _l(mBufferSourceLock); mBufferHeap.heap.clear(); mBuffer.clear(); mLayer.invalidate(); @@ -387,13 +387,13 @@ void LayerBuffer::BufferSource::unregisterBuffers() sp<LayerBuffer::Buffer> LayerBuffer::BufferSource::getBuffer() const { - Mutex::Autolock _l(mLock); + Mutex::Autolock _l(mBufferSourceLock); return mBuffer; } void LayerBuffer::BufferSource::setBuffer(const sp<LayerBuffer::Buffer>& buffer) { - Mutex::Autolock _l(mLock); + Mutex::Autolock _l(mBufferSourceLock); mBuffer = buffer; } @@ -583,7 +583,7 @@ LayerBuffer::OverlaySource::OverlaySource(LayerBuffer& layer, mOverlayHandle = overlay->getHandleRef(overlay); - // NOTE: here it's okay to acquire a reference to "this"m as long as + // NOTE: here it's okay to acquire a reference to "this" as long as // the reference is not released before we leave the ctor. sp<OverlayChannel> channel = new OverlayChannel(this); @@ -601,7 +601,6 @@ LayerBuffer::OverlaySource::~OverlaySource() void LayerBuffer::OverlaySource::onDraw(const Region& clip) const { - GLclampx color = 0x000018; //dark blue GLclampx red = 0; GLclampx green = 0; GLclampx blue = 0x1818; @@ -633,7 +632,7 @@ void LayerBuffer::OverlaySource::onVisibilityResolved( int h = bounds.height(); // we need a lock here to protect "destroy" - Mutex::Autolock _l(mLock); + Mutex::Autolock _l(mOverlaySourceLock); if (mOverlay) { overlay_control_device_t* overlay_dev = mOverlayDevice; overlay_dev->setPosition(overlay_dev, mOverlay, x,y,w,h); @@ -654,7 +653,7 @@ void LayerBuffer::OverlaySource::serverDestroy() void LayerBuffer::OverlaySource::destroyOverlay() { // we need a lock here to protect "onVisibilityResolved" - Mutex::Autolock _l(mLock); + Mutex::Autolock _l(mOverlaySourceLock); if (mOverlay) { overlay_control_device_t* overlay_dev = mOverlayDevice; overlay_dev->destroyOverlay(overlay_dev, mOverlay); diff --git a/libs/surfaceflinger/LayerBuffer.h b/libs/surfaceflinger/LayerBuffer.h index e539f68..3b09998 100644 --- a/libs/surfaceflinger/LayerBuffer.h +++ b/libs/surfaceflinger/LayerBuffer.h @@ -124,7 +124,7 @@ private: virtual void unregisterBuffers(); virtual bool transformed() const; private: - mutable Mutex mLock; + mutable Mutex mBufferSourceLock; sp<Buffer> mBuffer; status_t mStatus; ISurface::BufferHeap mBufferHeap; @@ -145,14 +145,18 @@ private: virtual void onVisibilityResolved(const Transform& planeTransform); private: void serverDestroy(); - void destroyOverlay(); + void destroyOverlay(); + class OverlayChannel : public BnOverlay { - mutable Mutex mLock; - sp<OverlaySource> mSource; + public: + OverlayChannel(const sp<OverlaySource>& source) + : mSource(source) { + } + private: virtual void destroy() { sp<OverlaySource> source; { // scope for the lock; - Mutex::Autolock _l(mLock); + Mutex::Autolock _l(mDestroyLock); source = mSource; mSource.clear(); } @@ -160,11 +164,10 @@ private: source->serverDestroy(); } } - public: - OverlayChannel(const sp<OverlaySource>& source) - : mSource(source) { - } + mutable Mutex mDestroyLock; + sp<OverlaySource> mSource; }; + friend class OverlayChannel; bool mVisibilityChanged; @@ -176,7 +179,7 @@ private: int32_t mFormat; int32_t mWidthStride; int32_t mHeightStride; - mutable Mutex mLock; + mutable Mutex mOverlaySourceLock; bool mInitialized; }; @@ -199,7 +202,7 @@ private: return static_cast<LayerBuffer*>(Surface::getOwner().get()); } }; - + mutable Mutex mLock; sp<Source> mSource; sp<Surface> mSurface; |