Backed out changeset 15edfaab92f6 (bug 1397128)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Fri, 15 Sep 2017 18:28:54 +0200
changeset 665646 c0a6198c2345c243a40f82220f7640ddcb755515
parent 665645 3011315fd77cd184ca7e4721b7e35233b945b0c9
child 665647 ee4c8b6d9a083e24a6f902e9f3b3621561ab9451
push id80127
push userbmo:ato@sny.no
push dateFri, 15 Sep 2017 19:43:59 +0000
bugs1397128
milestone57.0a1
backs out15edfaab92f6d812256252e8efc6b8574cd7c381
Backed out changeset 15edfaab92f6 (bug 1397128)
dom/cache/Manager.cpp
dom/cache/StreamList.cpp
dom/cache/StreamList.h
--- a/dom/cache/Manager.cpp
+++ b/dom/cache/Manager.cpp
@@ -543,17 +543,17 @@ public:
       return rv;
     }
 
     nsCOMPtr<nsIInputStream> stream;
     rv = BodyOpen(aQuotaInfo, aDBDir, mResponse.mBodyId, getter_AddRefs(stream));
     if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
     if (NS_WARN_IF(!stream)) { return NS_ERROR_FILE_NOT_FOUND; }
 
-    mStreamList->Add(mResponse.mBodyId, Move(stream));
+    mStreamList->Add(mResponse.mBodyId, stream);
 
     return rv;
   }
 
   virtual void
   Complete(Listener* aListener, ErrorResult&& aRv) override
   {
     if (!mFoundResponse) {
@@ -609,17 +609,17 @@ public:
       }
 
       nsCOMPtr<nsIInputStream> stream;
       rv = BodyOpen(aQuotaInfo, aDBDir, mSavedResponses[i].mBodyId,
                     getter_AddRefs(stream));
       if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
       if (NS_WARN_IF(!stream)) { return NS_ERROR_FILE_NOT_FOUND; }
 
-      mStreamList->Add(mSavedResponses[i].mBodyId, Move(stream));
+      mStreamList->Add(mSavedResponses[i].mBodyId, stream);
     }
 
     return rv;
   }
 
   virtual void
   Complete(Listener* aListener, ErrorResult&& aRv) override
   {
@@ -1157,17 +1157,17 @@ public:
       }
 
       nsCOMPtr<nsIInputStream> stream;
       rv = BodyOpen(aQuotaInfo, aDBDir, mSavedRequests[i].mBodyId,
                     getter_AddRefs(stream));
       if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
       if (NS_WARN_IF(!stream)) { return NS_ERROR_FILE_NOT_FOUND; }
 
-      mStreamList->Add(mSavedRequests[i].mBodyId, Move(stream));
+      mStreamList->Add(mSavedRequests[i].mBodyId, stream);
     }
 
     return rv;
   }
 
   virtual void
   Complete(Listener* aListener, ErrorResult&& aRv) override
   {
@@ -1221,17 +1221,17 @@ public:
     }
 
     nsCOMPtr<nsIInputStream> stream;
     rv = BodyOpen(aQuotaInfo, aDBDir, mSavedResponse.mBodyId,
                   getter_AddRefs(stream));
     if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
     if (NS_WARN_IF(!stream)) { return NS_ERROR_FILE_NOT_FOUND; }
 
-    mStreamList->Add(mSavedResponse.mBodyId, Move(stream));
+    mStreamList->Add(mSavedResponse.mBodyId, stream);
 
     return rv;
   }
 
   virtual void
   Complete(Listener* aListener, ErrorResult&& aRv) override
   {
     if (!mFoundResponse) {
--- a/dom/cache/StreamList.cpp
+++ b/dom/cache/StreamList.cpp
@@ -65,22 +65,25 @@ StreamList::Activate(CacheId aCacheId)
   mManager->AddStreamList(this);
 
   for (uint32_t i = 0; i < mList.Length(); ++i) {
     mManager->AddRefBodyId(mList[i].mId);
   }
 }
 
 void
-StreamList::Add(const nsID& aId, nsCOMPtr<nsIInputStream>&& aStream)
+StreamList::Add(const nsID& aId, nsIInputStream* aStream)
 {
   // All streams should be added on IO thread before we set the stream
   // control on the owning IPC thread.
   MOZ_DIAGNOSTIC_ASSERT(!mStreamControl);
-  mList.AppendElement(Entry(aId, Move(aStream)));
+  MOZ_DIAGNOSTIC_ASSERT(aStream);
+  Entry* entry = mList.AppendElement();
+  entry->mId = aId;
+  entry->mStream = aStream;
 }
 
 already_AddRefed<nsIInputStream>
 StreamList::Extract(const nsID& aId)
 {
   NS_ASSERT_OWNINGTHREAD(StreamList);
   for (uint32_t i = 0; i < mList.Length(); ++i) {
     if (mList[i].mId == aId) {
--- a/dom/cache/StreamList.h
+++ b/dom/cache/StreamList.h
@@ -26,37 +26,32 @@ class StreamList final : public Context:
 public:
   StreamList(Manager* aManager, Context* aContext);
 
   void SetStreamControl(CacheStreamControlParent* aStreamControl);
   void RemoveStreamControl(CacheStreamControlParent* aStreamControl);
 
   void Activate(CacheId aCacheId);
 
-  void Add(const nsID& aId, nsCOMPtr<nsIInputStream>&& aStream);
+  void Add(const nsID& aId, nsIInputStream* aStream);
   already_AddRefed<nsIInputStream> Extract(const nsID& aId);
 
   void NoteClosed(const nsID& aId);
   void NoteClosedAll();
   void Close(const nsID& aId);
   void CloseAll();
 
   // Context::Activity methods
   virtual void Cancel() override;
   virtual bool MatchesCacheId(CacheId aCacheId) const override;
 
 private:
   ~StreamList();
   struct Entry
   {
-    explicit Entry(const nsID& aId, nsCOMPtr<nsIInputStream>&& aStream)
-      : mId(aId)
-      , mStream(Move(aStream))
-    {}
-
     nsID mId;
     nsCOMPtr<nsIInputStream> mStream;
   };
   RefPtr<Manager> mManager;
   RefPtr<Context> mContext;
   CacheId mCacheId;
   CacheStreamControlParent* mStreamControl;
   nsTArray<Entry> mList;