diff options
| author | Mathias Agopian <mathias@google.com> | 2009-10-06 19:28:11 -0700 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2009-10-06 19:28:11 -0700 |
| commit | e3aa2ada1931be2b66636aeb7296b20df8dbae09 (patch) | |
| tree | 4ff0538e50b1bb7e082b02fbdd77e00c248280f9 /include | |
| parent | 821620494f0f073a27124e96139d5320df79d7e4 (diff) | |
| parent | 5fd0ea8fb4827cdf183fe3c5c7f11bfd9c94d895 (diff) | |
| download | frameworks_base-e3aa2ada1931be2b66636aeb7296b20df8dbae09.zip frameworks_base-e3aa2ada1931be2b66636aeb7296b20df8dbae09.tar.gz frameworks_base-e3aa2ada1931be2b66636aeb7296b20df8dbae09.tar.bz2 | |
am 5fd0ea8f: am 26fe45dc: Merge change I4961c959 into eclair
Merge commit '5fd0ea8fb4827cdf183fe3c5c7f11bfd9c94d895' into eclair-mr2-plus-aosp
* commit '5fd0ea8fb4827cdf183fe3c5c7f11bfd9c94d895':
fix [2152536] ANR in browser
Diffstat (limited to 'include')
| -rw-r--r-- | include/private/ui/SharedBufferStack.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/include/private/ui/SharedBufferStack.h b/include/private/ui/SharedBufferStack.h index 59cf31c..f6824d9 100644 --- a/include/private/ui/SharedBufferStack.h +++ b/include/private/ui/SharedBufferStack.h @@ -139,7 +139,8 @@ private: class SharedBufferBase { public: - SharedBufferBase(SharedClient* sharedClient, int surface, int num); + SharedBufferBase(SharedClient* sharedClient, int surface, int num, + int32_t identity); ~SharedBufferBase(); uint32_t getIdentity(); status_t getStatus() const; @@ -150,6 +151,7 @@ protected: SharedClient* const mSharedClient; SharedBufferStack* const mSharedStack; const int mNumBuffers; + const int mIdentity; friend struct Update; friend struct QueueUpdate; @@ -180,7 +182,10 @@ status_t SharedBufferBase::waitForCondition(T condition) SharedClient& client( *mSharedClient ); const nsecs_t TIMEOUT = s2ns(1); Mutex::Autolock _l(client.lock); - while ((condition()==false) && (stack.status == NO_ERROR)) { + while ((condition()==false) && + (stack.identity == mIdentity) && + (stack.status == NO_ERROR)) + { status_t err = client.cv.waitRelative(client.lock, TIMEOUT); // handle errors and timeouts @@ -190,13 +195,13 @@ status_t SharedBufferBase::waitForCondition(T condition) LOGE("waitForCondition(%s) timed out (identity=%d), " "but condition is true! We recovered but it " "shouldn't happen." , T::name(), - mSharedStack->identity); + stack.identity); break; } else { LOGW("waitForCondition(%s) timed out " "(identity=%d, status=%d). " "CPU may be pegged. trying again.", T::name(), - mSharedStack->identity, mSharedStack->status); + stack.identity, stack.status); } } else { LOGE("waitForCondition(%s) error (%s) ", @@ -205,7 +210,7 @@ status_t SharedBufferBase::waitForCondition(T condition) } } } - return stack.status; + return (stack.identity != mIdentity) ? status_t(BAD_INDEX) : stack.status; } @@ -223,8 +228,9 @@ status_t SharedBufferBase::updateCondition(T update) { class SharedBufferClient : public SharedBufferBase { public: - SharedBufferClient(SharedClient* sharedClient, int surface, int num); - + SharedBufferClient(SharedClient* sharedClient, int surface, int num, + int32_t identity); + ssize_t dequeue(); status_t undoDequeue(int buf); |
