зеркало из https://github.com/mozilla/gecko-dev.git
Bug 784404 - Intermittent assertion in dom/devicestorage/test/test_basic.html. v.2 r=bent
This commit is contained in:
Родитель
68fb119245
Коммит
6ce49fd03d
|
@ -17,6 +17,8 @@ namespace dom {
|
|||
namespace devicestorage {
|
||||
|
||||
DeviceStorageRequestParent::DeviceStorageRequestParent(const DeviceStorageParams& aParams)
|
||||
: mMutex("DeviceStorageRequestParent::mMutex")
|
||||
, mActorDestoryed(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(DeviceStorageRequestParent);
|
||||
|
||||
|
@ -127,6 +129,8 @@ NS_IMPL_THREADSAFE_RELEASE(DeviceStorageRequestParent);
|
|||
void
|
||||
DeviceStorageRequestParent::ActorDestroy(ActorDestroyReason)
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
mActorDestoryed = true;
|
||||
int32_t count = mRunnables.Length();
|
||||
for (int32_t index = 0; index < count; index++) {
|
||||
mRunnables[index]->Cancel();
|
||||
|
|
|
@ -37,9 +37,8 @@ private:
|
|||
public:
|
||||
CancelableRunnable(DeviceStorageRequestParent* aParent)
|
||||
: mParent(aParent)
|
||||
, mCanceled(false)
|
||||
{
|
||||
mParent->AddRunnable(this);
|
||||
mCanceled = !(mParent->AddRunnable(this));
|
||||
}
|
||||
|
||||
virtual ~CancelableRunnable() {
|
||||
|
@ -183,12 +182,22 @@ private:
|
|||
};
|
||||
|
||||
protected:
|
||||
void AddRunnable(CancelableRunnable* aRunnable) {
|
||||
bool AddRunnable(CancelableRunnable* aRunnable) {
|
||||
MutexAutoLock lock(mMutex);
|
||||
if (mActorDestoryed)
|
||||
return false;
|
||||
|
||||
mRunnables.AppendElement(aRunnable);
|
||||
return true;
|
||||
}
|
||||
|
||||
void RemoveRunnable(CancelableRunnable* aRunnable) {
|
||||
MutexAutoLock lock(mMutex);
|
||||
mRunnables.RemoveElement(aRunnable);
|
||||
}
|
||||
|
||||
Mutex mMutex;
|
||||
bool mActorDestoryed;
|
||||
nsTArray<nsRefPtr<CancelableRunnable> > mRunnables;
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче