diff options
| author | 2008-12-19 08:31:54 -0800 | |
|---|---|---|
| committer | 2008-12-19 08:31:54 -0800 | |
| commit | 772a89695f179b51d16b26c1b0d946aa3e850e70 (patch) | |
| tree | 9a9fdadd1301625f875a3c126c986c79e3363ac4 /libs/utils/IPCThreadState.cpp | |
| parent | d34e59679f6a98e9e67ef4bd18da6e5a86d386bc (diff) | |
| parent | e09fd9e819c23dc90bca68375645e15544861330 (diff) | |
Merge commit 'remotes/korg/cupcake'
Conflicts:
	core/java/com/android/internal/app/AlertController.java
	core/res/res/values/strings.xml
	media/java/android/media/AudioSystem.java
	services/java/com/android/server/LocationManagerService.java
Diffstat (limited to 'libs/utils/IPCThreadState.cpp')
| -rw-r--r-- | libs/utils/IPCThreadState.cpp | 27 | 
1 files changed, 25 insertions, 2 deletions
| diff --git a/libs/utils/IPCThreadState.cpp b/libs/utils/IPCThreadState.cpp index ca49d9a5b0..04ae1424e4 100644 --- a/libs/utils/IPCThreadState.cpp +++ b/libs/utils/IPCThreadState.cpp @@ -391,6 +391,29 @@ void IPCThreadState::joinThreadPool(bool isMain)      status_t result;      do {          int32_t cmd; +         +        // When we've cleared the incoming command queue, process any pending derefs +        if (mIn.dataPosition() >= mIn.dataSize()) { +            size_t numPending = mPendingWeakDerefs.size(); +            if (numPending > 0) { +                for (size_t i = 0; i < numPending; i++) { +                    RefBase::weakref_type* refs = mPendingWeakDerefs[i]; +                    refs->decWeak(mProcess.get()); +                } +                mPendingWeakDerefs.clear(); +            } + +            numPending = mPendingStrongDerefs.size(); +            if (numPending > 0) { +                for (size_t i = 0; i < numPending; i++) { +                    BBinder* obj = mPendingStrongDerefs[i]; +                    obj->decStrong(mProcess.get()); +                } +                mPendingStrongDerefs.clear(); +            } +        } + +        // now get the next command to be processed, waiting if necessary          result = talkWithDriver();          if (result >= NO_ERROR) {              size_t IN = mIn.dataAvail(); @@ -832,7 +855,7 @@ status_t IPCThreadState::executeCommand(int32_t cmd)              LOG_REMOTEREFS("BR_RELEASE from driver on %p", obj);              obj->printRefs();          } -        obj->decStrong(mProcess.get()); +        mPendingStrongDerefs.push(obj);          break;      case BR_INCREFS: @@ -853,7 +876,7 @@ status_t IPCThreadState::executeCommand(int32_t cmd)          //LOG_ASSERT(refs->refBase() == obj,          //           "BR_DECREFS: object %p does not match cookie %p (expected %p)",          //           refs, obj, refs->refBase()); -        refs->decWeak(mProcess.get()); +        mPendingWeakDerefs.push(refs);          break;      case BR_ATTEMPT_ACQUIRE: |