Bug 1112972 (Part 5) - Remove almost all special handling of multipart images in ProgressTracker. r=tn
authorSeth Fowler <seth@mozilla.com>
Wed, 07 Jan 2015 01:37:20 -0800
changeset 222482 da5084c9e3e640723ff9541da88fe150c294739c
parent 222481 82ff19dfa592e8713979896a2c416a38c263ef0b
child 222483 3f32666fc1dc747ade2aa2d5d9db7e59cc934cd9
push id28067
push userkwierso@gmail.com
push dateWed, 07 Jan 2015 23:41:38 +0000
treeherdermozilla-central@70de2960aa87 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstn
bugs1112972
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1112972 (Part 5) - Remove almost all special handling of multipart images in ProgressTracker. r=tn
image/src/ProgressTracker.cpp
image/src/ProgressTracker.h
--- a/image/src/ProgressTracker.cpp
+++ b/image/src/ProgressTracker.cpp
@@ -58,38 +58,29 @@ CheckProgressConsistency(Progress aProgr
   }
   if (aProgress & FLAG_FRAME_COMPLETE) {
     MOZ_ASSERT(aProgress & FLAG_DECODE_STARTED);
   }
   if (aProgress & FLAG_LOAD_COMPLETE) {
     // No preconditions.
   }
   if (aProgress & FLAG_ONLOAD_BLOCKED) {
-    if (aProgress & FLAG_IS_MULTIPART) {
-      MOZ_ASSERT(aProgress & FLAG_ONLOAD_UNBLOCKED);
-    } else {
-      MOZ_ASSERT(aProgress & FLAG_DECODE_STARTED);
-    }
+    MOZ_ASSERT(aProgress & FLAG_DECODE_STARTED);
   }
   if (aProgress & FLAG_ONLOAD_UNBLOCKED) {
     MOZ_ASSERT(aProgress & FLAG_ONLOAD_BLOCKED);
-    MOZ_ASSERT(aProgress & (FLAG_FRAME_COMPLETE |
-                            FLAG_IS_MULTIPART |
-                            FLAG_HAS_ERROR));
+    MOZ_ASSERT(aProgress & (FLAG_FRAME_COMPLETE | FLAG_HAS_ERROR));
   }
   if (aProgress & FLAG_IS_ANIMATED) {
     MOZ_ASSERT(aProgress & FLAG_DECODE_STARTED);
     MOZ_ASSERT(aProgress & FLAG_SIZE_AVAILABLE);
   }
   if (aProgress & FLAG_HAS_TRANSPARENCY) {
     MOZ_ASSERT(aProgress & FLAG_SIZE_AVAILABLE);
   }
-  if (aProgress & FLAG_IS_MULTIPART) {
-    // No preconditions.
-  }
   if (aProgress & FLAG_LAST_PART_COMPLETE) {
     MOZ_ASSERT(aProgress & FLAG_LOAD_COMPLETE);
   }
   if (aProgress & FLAG_HAS_ERROR) {
     // No preconditions.
   }
 }
 
@@ -103,32 +94,16 @@ ProgressTracker::SetImage(Image* aImage)
 
 void
 ProgressTracker::ResetImage()
 {
   NS_ABORT_IF_FALSE(mImage, "Resetting image when it's already null!");
   mImage = nullptr;
 }
 
-void
-ProgressTracker::SetIsMultipart()
-{
-  if (mProgress & FLAG_IS_MULTIPART) {
-    return;
-  }
-
-  MOZ_ASSERT(!(mProgress & FLAG_ONLOAD_BLOCKED),
-             "Blocked onload before we knew we were multipart?");
-
-  // Set the MULTIPART flag and ensure that we never block onload.
-  mProgress |= FLAG_IS_MULTIPART | FLAG_ONLOAD_BLOCKED | FLAG_ONLOAD_UNBLOCKED;
-
-  CheckProgressConsistency(mProgress);
-}
-
 bool
 ProgressTracker::IsLoading() const
 {
   // Checking for whether OnStopRequest has fired allows us to say we're
   // loading before OnStartRequest gets called, letting the request properly
   // get removed from the cache in certain cases.
   return !(mProgress & FLAG_LOAD_COMPLETE);
 }
--- a/image/src/ProgressTracker.h
+++ b/image/src/ProgressTracker.h
@@ -31,19 +31,18 @@ enum {
   FLAG_DECODE_STARTED     = 1u << 1,  // STATUS_DECODE_STARTED
   FLAG_DECODE_COMPLETE    = 1u << 2,  // STATUS_DECODE_COMPLETE
   FLAG_FRAME_COMPLETE     = 1u << 3,  // STATUS_FRAME_COMPLETE
   FLAG_LOAD_COMPLETE      = 1u << 4,  // STATUS_LOAD_COMPLETE
   FLAG_ONLOAD_BLOCKED     = 1u << 5,
   FLAG_ONLOAD_UNBLOCKED   = 1u << 6,
   FLAG_IS_ANIMATED        = 1u << 7,  // STATUS_IS_ANIMATED
   FLAG_HAS_TRANSPARENCY   = 1u << 8,  // STATUS_HAS_TRANSPARENCY
-  FLAG_IS_MULTIPART       = 1u << 9,
-  FLAG_LAST_PART_COMPLETE = 1u << 10,
-  FLAG_HAS_ERROR          = 1u << 11  // STATUS_ERROR
+  FLAG_LAST_PART_COMPLETE = 1u << 9,
+  FLAG_HAS_ERROR          = 1u << 10  // STATUS_ERROR
 };
 
 typedef uint32_t Progress;
 
 const uint32_t NoProgress = 0;
 
 inline Progress LoadCompleteProgress(bool aLastPart,
                                      bool aError,
@@ -84,19 +83,16 @@ public:
 
   bool HasImage() const { return mImage; }
   already_AddRefed<Image> GetImage() const
   {
     nsRefPtr<Image> image = mImage;
     return image.forget();
   }
 
-  // Informs this ProgressTracker that it's associated with a multipart image.
-  void SetIsMultipart();
-
   // Returns whether we are in the process of loading; that is, whether we have
   // not received OnStopRequest from Necko.
   bool IsLoading() const;
 
   // Get the current image status (as in imgIRequest).
   uint32_t GetImageStatus() const;
 
   // Get the current Progress.
@@ -162,22 +158,16 @@ public:
     return mObservers.Length();
   }
 
   // This is intentionally non-general because its sole purpose is to support
   // some obscure network priority logic in imgRequest. That stuff could
   // probably be improved, but it's too scary to mess with at the moment.
   bool FirstObserverIs(IProgressObserver* aObserver);
 
-  void AdoptObservers(ProgressTracker* aTracker) {
-    MOZ_ASSERT(NS_IsMainThread(), "Use mObservers on main thread only");
-    MOZ_ASSERT(aTracker);
-    mObservers = aTracker->mObservers;
-  }
-
 private:
   typedef nsTObserverArray<mozilla::WeakPtr<IProgressObserver>> ObserverArray;
   friend class AsyncNotifyRunnable;
   friend class AsyncNotifyCurrentStateRunnable;
   friend class ProgressTrackerInit;
 
   ProgressTracker(const ProgressTracker& aOther) MOZ_DELETE;