Bug 1267195 - Correctly update HTTP cache size in UI only after we actually clear the cache. r=michal a=ritu
authorHonza Bambas <honzab.moz@firemni.cz>
Thu, 12 May 2016 07:57:00 -0400
changeset 333007 15264dfb8421ccf5e6638df332a17153251b67df
parent 333006 6eed58568de0192182a682e718c23b0d0507cbad
child 333008 ea189350742b08c91604fa66d05e259564e63870
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmichal, ritu
bugs1267195
milestone48.0a2
Bug 1267195 - Correctly update HTTP cache size in UI only after we actually clear the cache. r=michal a=ritu
netwerk/cache2/CacheIndex.cpp
--- a/netwerk/cache2/CacheIndex.cpp
+++ b/netwerk/cache2/CacheIndex.cpp
@@ -3128,17 +3128,17 @@ CacheIndex::ChangeState(EState aNewState
   }
 
   NotifyAsyncGetDiskConsumptionCallbacks();
 }
 
 void
 CacheIndex::NotifyAsyncGetDiskConsumptionCallbacks()
 {
-  if (mState == READY && mDiskConsumptionObservers.Length()) {
+  if ((mState == READY || mState == WRITING) && !mAsyncGetDiskConsumptionBlocked && mDiskConsumptionObservers.Length()) {
     for (uint32_t i = 0; i < mDiskConsumptionObservers.Length(); ++i) {
       DiskConsumptionObserver* o = mDiskConsumptionObservers[i];
       // Safe to call under the lock.  We always post to the main thread.
       o->OnDiskConsumption(mIndexStats.Size() << 10);
     }
 
     mDiskConsumptionObservers.Clear();
   }