Merge last PGO-green changeset from m-i to m-c.
authorMs2ger <ms2ger@gmail.com>
Mon, 27 Aug 2012 15:02:11 +0200
changeset 105574 49aded7afc77808e3e6c6917e9fe0cc48d3e376f
parent 105573 a684417d8536290f830eb71ddeb3f217c00df2c8 (current diff)
parent 105560 5c49d6790357cfb8d593e585b43b3cad7c2d28f2 (diff)
child 105575 e934a9d8be1f2c82d36234d007193e6c87290969
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
milestone17.0a1
Merge last PGO-green changeset from m-i to m-c.
old mode 100644
new mode 100755
old mode 100644
new mode 100755
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
--- a/dom/devicestorage/DeviceStorageRequestParent.h
+++ b/dom/devicestorage/DeviceStorageRequestParent.h
@@ -44,21 +44,27 @@ private:
 
     virtual ~CancelableRunnable() {
     }
 
     NS_IMETHOD Run() {
       nsresult rv = NS_OK;
       if (!mCanceled) {
         rv = CancelableRun();
-        mParent->RemoveRunnable(this);
+
+        nsCOMPtr<nsIRunnable> event = NS_NewRunnableMethod(this, &CancelableRunnable::RemoveRunnable);
+        NS_DispatchToMainThread(event);
       }
       return rv;
     }
 
+    void RemoveRunnable() {
+      mParent->RemoveRunnable(this);
+    }
+
     void Cancel() {
       mCanceled = true;
     }
 
     virtual nsresult CancelableRun() = 0;
 
   protected:
     nsRefPtr<DeviceStorageRequestParent> mParent;
@@ -179,19 +185,21 @@ private:
       virtual ~PostStatResultEvent();
       virtual nsresult CancelableRun();
     private:
       int64_t mFreeBytes, mTotalBytes;
    };
 
 protected:
   void AddRunnable(CancelableRunnable* aRunnable) {
+    NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
     mRunnables.AppendElement(aRunnable);
   }
   void RemoveRunnable(CancelableRunnable* aRunnable) {
+    NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
     mRunnables.RemoveElement(aRunnable);
   }
   nsTArray<nsRefPtr<CancelableRunnable> > mRunnables;
 };
 
 } // namespace devicestorage
 } // namespace dom
 } // namespace mozilla