From 19402ec86a7a0e6c5beccf2dc80f6a06bbe8f5d9 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Fri, 20 Nov 2015 18:47:49 +1100 Subject: [PATCH] Bug 1186750 part 8 - Convert DeviceStorageUsedSpaceCache::Dispatch to use already_AddRef&&. r=dhylands --HG-- extra : source : f189f9cd657e665d032aa05812e8479e0eb85a43 --- dom/devicestorage/DeviceStorageRequestParent.cpp | 5 ++--- dom/devicestorage/nsDeviceStorage.cpp | 3 ++- dom/devicestorage/nsDeviceStorage.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dom/devicestorage/DeviceStorageRequestParent.cpp b/dom/devicestorage/DeviceStorageRequestParent.cpp index 8e264a35bc01..a209899a2b1b 100644 --- a/dom/devicestorage/DeviceStorageRequestParent.cpp +++ b/dom/devicestorage/DeviceStorageRequestParent.cpp @@ -158,9 +158,8 @@ DeviceStorageRequestParent::Dispatch() RefPtr dsf = new DeviceStorageFile(p.type(), p.storageName()); - RefPtr r = new UsedSpaceFileEvent(this, dsf.forget()); - - usedSpaceCache->Dispatch(r); + usedSpaceCache->Dispatch( + MakeAndAddRef(this, dsf.forget())); break; } diff --git a/dom/devicestorage/nsDeviceStorage.cpp b/dom/devicestorage/nsDeviceStorage.cpp index 78bfa1109f33..860c2aed19ac 100644 --- a/dom/devicestorage/nsDeviceStorage.cpp +++ b/dom/devicestorage/nsDeviceStorage.cpp @@ -2217,7 +2217,8 @@ public: DeviceStorageUsedSpaceCache* usedSpaceCache = DeviceStorageUsedSpaceCache::CreateOrGet(); MOZ_ASSERT(usedSpaceCache); - usedSpaceCache->Dispatch(this); + nsCOMPtr self = this; + usedSpaceCache->Dispatch(self.forget()); return NS_OK; } diff --git a/dom/devicestorage/nsDeviceStorage.h b/dom/devicestorage/nsDeviceStorage.h index 70d2ad473378..c15ba985b690 100644 --- a/dom/devicestorage/nsDeviceStorage.h +++ b/dom/devicestorage/nsDeviceStorage.h @@ -134,12 +134,12 @@ public: mIOThread->Dispatch(r, NS_DISPATCH_NORMAL); } - void Dispatch(nsIRunnable* aRunnable) + void Dispatch(already_AddRefed&& aRunnable) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(mIOThread); - mIOThread->Dispatch(aRunnable, NS_DISPATCH_NORMAL); + mIOThread->Dispatch(mozilla::Move(aRunnable), NS_DISPATCH_NORMAL); } nsresult AccumUsedSizes(const nsAString& aStorageName,