Backed out changeset b28740aedf34 (bug 1397128)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Fri, 15 Sep 2017 18:28:27 +0200
changeset 381172 ea17b06fd8eb6e5cdd6021f8095c25d640b226d8
parent 381171 768e5defb464e14a76b83884702b9ed5bff07401
child 381173 852e0b52c84f041880f1ed404be20d6c8022977f
push id32512
push userarchaeopteryx@coole-files.de
push dateFri, 15 Sep 2017 19:33:47 +0000
treeherdermozilla-central@6be5c7d30d2d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1397128
milestone57.0a1
backs outb28740aedf34db48a9d5221bd49341d708d4cf00
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
Backed out changeset b28740aedf34 (bug 1397128)
dom/cache/Cache.cpp
dom/cache/CacheStorage.cpp
dom/cache/CacheTypes.ipdlh
dom/cache/IPCUtils.h
dom/cache/Manager.cpp
dom/cache/Types.h
--- a/dom/cache/Cache.cpp
+++ b/dom/cache/Cache.cpp
@@ -280,19 +280,17 @@ Cache::Match(JSContext* aCx, const Reque
     ToInternalRequest(aCx, aRequest, IgnoreBody, aRv);
   if (NS_WARN_IF(aRv.Failed())) {
     return nullptr;
   }
 
   CacheQueryParams params;
   ToCacheQueryParams(params, aOptions);
 
-  AutoChildOpArgs args(this,
-                       CacheMatchArgs(CacheRequest(), params, OpenMode::Eager),
-                       1);
+  AutoChildOpArgs args(this, CacheMatchArgs(CacheRequest(), params), 1);
 
   args.Add(ir, IgnoreBody, IgnoreInvalidScheme, aRv);
   if (NS_WARN_IF(aRv.Failed())) {
     return nullptr;
   }
 
   return ExecuteOp(args, aRv);
 }
@@ -306,19 +304,17 @@ Cache::MatchAll(JSContext* aCx, const Op
     return nullptr;
   }
 
   CacheChild::AutoLock actorLock(mActor);
 
   CacheQueryParams params;
   ToCacheQueryParams(params, aOptions);
 
-  AutoChildOpArgs args(this,
-                       CacheMatchAllArgs(void_t(), params, OpenMode::Eager),
-                       1);
+  AutoChildOpArgs args(this, CacheMatchAllArgs(void_t(), params), 1);
 
   if (aRequest.WasPassed()) {
     RefPtr<InternalRequest> ir = ToInternalRequest(aCx, aRequest.Value(),
                                                    IgnoreBody, aRv);
     if (aRv.Failed()) {
       return nullptr;
     }
 
@@ -490,19 +486,17 @@ Cache::Keys(JSContext* aCx, const Option
     return nullptr;
   }
 
   CacheChild::AutoLock actorLock(mActor);
 
   CacheQueryParams params;
   ToCacheQueryParams(params, aOptions);
 
-  AutoChildOpArgs args(this,
-                       CacheKeysArgs(void_t(), params, OpenMode::Eager),
-                       1);
+  AutoChildOpArgs args(this, CacheKeysArgs(void_t(), params), 1);
 
   if (aRequest.WasPassed()) {
     RefPtr<InternalRequest> ir =
       ToInternalRequest(aCx, aRequest.Value(), IgnoreBody, aRv);
     if (NS_WARN_IF(aRv.Failed())) {
       return nullptr;
     }
 
--- a/dom/cache/CacheStorage.cpp
+++ b/dom/cache/CacheStorage.cpp
@@ -328,17 +328,17 @@ CacheStorage::Match(JSContext* aCx, cons
     return nullptr;
   }
 
   CacheQueryParams params;
   ToCacheQueryParams(params, aOptions);
 
   nsAutoPtr<Entry> entry(new Entry());
   entry->mPromise = promise;
-  entry->mArgs = StorageMatchArgs(CacheRequest(), params, OpenMode::Eager);
+  entry->mArgs = StorageMatchArgs(CacheRequest(), params);
   entry->mRequest = request;
 
   mPendingRequests.AppendElement(entry.forget());
   MaybeRunPendingRequests();
 
   return promise.forget();
 }
 
--- a/dom/cache/CacheTypes.ipdlh
+++ b/dom/cache/CacheTypes.ipdlh
@@ -5,17 +5,16 @@
 include protocol PCache;
 include protocol PCacheStreamControl;
 include protocol PChildToParentStream;
 include IPCStream;
 include ChannelInfo;
 include PBackgroundSharedTypes;
 
 using HeadersGuardEnum from "mozilla/dom/FetchIPCTypes.h";
-using OpenMode from "mozilla/dom/cache/IPCUtils.h";
 using ReferrerPolicy from "mozilla/dom/FetchIPCTypes.h";
 using RequestCredentials from "mozilla/dom/FetchIPCTypes.h";
 using RequestMode from "mozilla/dom/FetchIPCTypes.h";
 using RequestCache from "mozilla/dom/FetchIPCTypes.h";
 using RequestRedirect from "mozilla/dom/FetchIPCTypes.h";
 using ResponseType from "mozilla/dom/FetchIPCTypes.h";
 using mozilla::void_t from "ipc/IPCMessageUtils.h";
 using struct nsID from "nsID.h";
@@ -102,24 +101,22 @@ struct CacheRequestResponse
   CacheRequest request;
   CacheResponse response;
 };
 
 struct CacheMatchArgs
 {
   CacheRequest request;
   CacheQueryParams params;
-  OpenMode openMode;
 };
 
 struct CacheMatchAllArgs
 {
   CacheRequestOrVoid requestOrVoid;
   CacheQueryParams params;
-  OpenMode openMode;
 };
 
 struct CachePutAllArgs
 {
   CacheRequestResponse[] requestResponseList;
 };
 
 struct CacheDeleteArgs
@@ -127,24 +124,22 @@ struct CacheDeleteArgs
   CacheRequest request;
   CacheQueryParams params;
 };
 
 struct CacheKeysArgs
 {
   CacheRequestOrVoid requestOrVoid;
   CacheQueryParams params;
-  OpenMode openMode;
 };
 
 struct StorageMatchArgs
 {
   CacheRequest request;
   CacheQueryParams params;
-  OpenMode openMode;
 };
 
 struct StorageHasArgs
 {
   nsString key;
 };
 
 struct StorageOpenArgs
--- a/dom/cache/IPCUtils.h
+++ b/dom/cache/IPCUtils.h
@@ -13,18 +13,11 @@
 
 namespace IPC {
   template<>
   struct ParamTraits<mozilla::dom::cache::Namespace> :
     public ContiguousEnumSerializer<mozilla::dom::cache::Namespace,
                                     mozilla::dom::cache::DEFAULT_NAMESPACE,
                                     mozilla::dom::cache::NUMBER_OF_NAMESPACES>
   {};
-
-  template<>
-  struct ParamTraits<mozilla::dom::cache::OpenMode> :
-    public ContiguousEnumSerializer<mozilla::dom::cache::OpenMode,
-                                    mozilla::dom::cache::OpenMode::Eager,
-                                    mozilla::dom::cache::OpenMode::NumTypes>
-  {};
 } // namespace IPC
 
 #endif // mozilla_dom_cache_IPCUtils_h
--- a/dom/cache/Manager.cpp
+++ b/dom/cache/Manager.cpp
@@ -539,21 +539,19 @@ public:
 
     if (!mFoundResponse || !mResponse.mHasBodyId
                         || IsHeadRequest(mArgs.request(), mArgs.params())) {
       mResponse.mHasBodyId = false;
       return rv;
     }
 
     nsCOMPtr<nsIInputStream> stream;
-    if (mArgs.openMode() == OpenMode::Eager) {
-      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; }
-    }
+    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));
 
     return rv;
   }
 
   virtual void
   Complete(Listener* aListener, ErrorResult&& aRv) override
@@ -606,22 +604,20 @@ public:
     for (uint32_t i = 0; i < mSavedResponses.Length(); ++i) {
       if (!mSavedResponses[i].mHasBodyId
           || IsHeadRequest(mArgs.requestOrVoid(), mArgs.params())) {
         mSavedResponses[i].mHasBodyId = false;
         continue;
       }
 
       nsCOMPtr<nsIInputStream> stream;
-      if (mArgs.openMode() == OpenMode::Eager) {
-        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; }
-      }
+      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));
     }
 
     return rv;
   }
 
   virtual void
@@ -1156,22 +1152,20 @@ public:
     for (uint32_t i = 0; i < mSavedRequests.Length(); ++i) {
       if (!mSavedRequests[i].mHasBodyId
           || IsHeadRequest(mArgs.requestOrVoid(), mArgs.params())) {
         mSavedRequests[i].mHasBodyId = false;
         continue;
       }
 
       nsCOMPtr<nsIInputStream> stream;
-      if (mArgs.openMode() == OpenMode::Eager) {
-        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; }
-      }
+      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));
     }
 
     return rv;
   }
 
   virtual void
@@ -1222,22 +1216,20 @@ public:
 
     if (!mFoundResponse || !mSavedResponse.mHasBodyId
                         || IsHeadRequest(mArgs.request(), mArgs.params())) {
       mSavedResponse.mHasBodyId = false;
       return rv;
     }
 
     nsCOMPtr<nsIInputStream> stream;
-    if (mArgs.openMode() == OpenMode::Eager) {
-      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; }
-    }
+    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));
 
     return rv;
   }
 
   virtual void
   Complete(Listener* aListener, ErrorResult&& aRv) override
--- a/dom/cache/Types.h
+++ b/dom/cache/Types.h
@@ -34,20 +34,13 @@ struct QuotaInfo
   nsCOMPtr<nsIFile> mDir;
   nsCString mSuffix;
   nsCString mGroup;
   nsCString mOrigin;
 };
 
 typedef std::function<void(nsCOMPtr<nsIInputStream>&&)> InputStreamResolver;
 
-enum class OpenMode : uint8_t
-{
-  Eager,
-  Lazy,
-  NumTypes
-};
-
 } // namespace cache
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_cache_Types_h