Merge last PGO-green changeset from m-i to m-c.
authorMs2ger <ms2ger@gmail.com>
Mon, 27 Aug 2012 10:52:35 +0200
changeset 105560 5c49d6790357cfb8d593e585b43b3cad7c2d28f2
parent 105548 8af6a22827ecaffe6328a02633411da0421ccb90 (diff)
parent 105559 6bf3ae02890edbd368c03e13f9cb16a2791fad55 (current diff)
child 105574 49aded7afc77808e3e6c6917e9fe0cc48d3e376f
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