Title: [222274] trunk/Source/WebCore
Revision
222274
Author
[email protected]
Date
2017-09-20 12:04:00 -0700 (Wed, 20 Sep 2017)

Log Message

Rename CacheStorage to DOMCacheStorage
https://bugs.webkit.org/show_bug.cgi?id=177025

Patch by Youenn Fablet <[email protected]> on 2017-09-20
Reviewed by Chris Dumez.

No change of behavior, just renaming CacheStorage class and files to DOMCacheStorage.

* CMakeLists.txt:
* DerivedSources.make:
* Modules/cache/DOMCacheStorage.cpp: Renamed from Source/WebCore/Modules/cache/CacheStorage.cpp.
(WebCore::DOMCacheStorage::DOMCacheStorage):
(WebCore::DOMCacheStorage::origin const):
(WebCore::doSequentialMatch):
(WebCore::startSequentialMatch):
(WebCore::copyCaches):
(WebCore::DOMCacheStorage::match):
(WebCore::DOMCacheStorage::has):
(WebCore::DOMCacheStorage::retrieveCaches):
(WebCore::logConsolePersistencyError):
(WebCore::DOMCacheStorage::open):
(WebCore::DOMCacheStorage::remove):
(WebCore::DOMCacheStorage::keys):
(WebCore::DOMCacheStorage::stop):
(WebCore::DOMCacheStorage::activeDOMObjectName const):
(WebCore::DOMCacheStorage::canSuspendForDocumentSuspension const):
* Modules/cache/DOMCacheStorage.h: Renamed from Source/WebCore/Modules/cache/CacheStorage.h.
(WebCore::DOMCacheStorage::create):
* Modules/cache/DOMCacheStorage.idl: Renamed from Source/WebCore/Modules/cache/CacheStorage.idl.
* Modules/cache/DOMWindowCaches.cpp:
(WebCore::DOMWindowCaches::caches):
(WebCore::DOMWindowCaches::caches const):
* Modules/cache/DOMWindowCaches.h:
* Modules/cache/DOMWindowCaches.idl:
* Modules/cache/WorkerGlobalScopeCaches.cpp:
(WebCore::WorkerGlobalScopeCaches::caches):
(WebCore::WorkerGlobalScopeCaches::caches const):
* Modules/cache/WorkerGlobalScopeCaches.h:
* Modules/cache/WorkerGlobalScopeCaches.idl:
* WebCore.xcodeproj/project.pbxproj:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (222273 => 222274)


--- trunk/Source/WebCore/CMakeLists.txt	2017-09-20 18:10:56 UTC (rev 222273)
+++ trunk/Source/WebCore/CMakeLists.txt	2017-09-20 19:04:00 UTC (rev 222274)
@@ -188,9 +188,9 @@
 
     Modules/beacon/NavigatorBeacon.idl
 
+    Modules/cache/CacheQueryOptions.idl
     Modules/cache/DOMCache.idl
-    Modules/cache/CacheQueryOptions.idl
-    Modules/cache/CacheStorage.idl
+    Modules/cache/DOMCacheStorage.idl
     Modules/cache/DOMWindowCaches.idl
     Modules/cache/WorkerGlobalScopeCaches.idl
 
@@ -970,9 +970,9 @@
 
     Modules/beacon/NavigatorBeacon.cpp
 
+    Modules/cache/CacheStorageConnection.cpp
     Modules/cache/DOMCache.cpp
-    Modules/cache/CacheStorage.cpp
-    Modules/cache/CacheStorageConnection.cpp
+    Modules/cache/DOMCacheStorage.cpp
     Modules/cache/DOMCacheEngine.cpp
     Modules/cache/DOMWindowCaches.cpp
     Modules/cache/WorkerCacheStorageConnection.cpp

Modified: trunk/Source/WebCore/ChangeLog (222273 => 222274)


--- trunk/Source/WebCore/ChangeLog	2017-09-20 18:10:56 UTC (rev 222273)
+++ trunk/Source/WebCore/ChangeLog	2017-09-20 19:04:00 UTC (rev 222274)
@@ -1,3 +1,45 @@
+2017-09-20  Youenn Fablet  <[email protected]>
+
+        Rename CacheStorage to DOMCacheStorage
+        https://bugs.webkit.org/show_bug.cgi?id=177025
+
+        Reviewed by Chris Dumez.
+
+        No change of behavior, just renaming CacheStorage class and files to DOMCacheStorage.
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * Modules/cache/DOMCacheStorage.cpp: Renamed from Source/WebCore/Modules/cache/CacheStorage.cpp.
+        (WebCore::DOMCacheStorage::DOMCacheStorage):
+        (WebCore::DOMCacheStorage::origin const):
+        (WebCore::doSequentialMatch):
+        (WebCore::startSequentialMatch):
+        (WebCore::copyCaches):
+        (WebCore::DOMCacheStorage::match):
+        (WebCore::DOMCacheStorage::has):
+        (WebCore::DOMCacheStorage::retrieveCaches):
+        (WebCore::logConsolePersistencyError):
+        (WebCore::DOMCacheStorage::open):
+        (WebCore::DOMCacheStorage::remove):
+        (WebCore::DOMCacheStorage::keys):
+        (WebCore::DOMCacheStorage::stop):
+        (WebCore::DOMCacheStorage::activeDOMObjectName const):
+        (WebCore::DOMCacheStorage::canSuspendForDocumentSuspension const):
+        * Modules/cache/DOMCacheStorage.h: Renamed from Source/WebCore/Modules/cache/CacheStorage.h.
+        (WebCore::DOMCacheStorage::create):
+        * Modules/cache/DOMCacheStorage.idl: Renamed from Source/WebCore/Modules/cache/CacheStorage.idl.
+        * Modules/cache/DOMWindowCaches.cpp:
+        (WebCore::DOMWindowCaches::caches):
+        (WebCore::DOMWindowCaches::caches const):
+        * Modules/cache/DOMWindowCaches.h:
+        * Modules/cache/DOMWindowCaches.idl:
+        * Modules/cache/WorkerGlobalScopeCaches.cpp:
+        (WebCore::WorkerGlobalScopeCaches::caches):
+        (WebCore::WorkerGlobalScopeCaches::caches const):
+        * Modules/cache/WorkerGlobalScopeCaches.h:
+        * Modules/cache/WorkerGlobalScopeCaches.idl:
+        * WebCore.xcodeproj/project.pbxproj:
+
 2017-09-20  Eric Carlson  <[email protected]>
 
         Switch PeerConnection to release logging

Modified: trunk/Source/WebCore/DerivedSources.make (222273 => 222274)


--- trunk/Source/WebCore/DerivedSources.make	2017-09-20 18:10:56 UTC (rev 222273)
+++ trunk/Source/WebCore/DerivedSources.make	2017-09-20 19:04:00 UTC (rev 222274)
@@ -105,9 +105,9 @@
     $(WebCore)/Modules/applepay/ApplePayValidateMerchantEvent.idl \
     $(WebCore)/Modules/beacon/NavigatorBeacon.idl \
     $(WebCore)/Modules/cache/DOMWindowCaches.idl \
+    $(WebCore)/Modules/cache/CacheQueryOptions.idl \
     $(WebCore)/Modules/cache/DOMCache.idl \
-    $(WebCore)/Modules/cache/CacheQueryOptions.idl \
-    $(WebCore)/Modules/cache/CacheStorage.idl \
+    $(WebCore)/Modules/cache/DOMCacheStorage.idl \
     $(WebCore)/Modules/cache/WorkerGlobalScopeCaches.idl \
     $(WebCore)/Modules/credentials/BasicCredential.idl \
     $(WebCore)/Modules/credentials/CredentialCreationOptions.idl \

Deleted: trunk/Source/WebCore/Modules/cache/CacheStorage.cpp (222273 => 222274)


--- trunk/Source/WebCore/Modules/cache/CacheStorage.cpp	2017-09-20 18:10:56 UTC (rev 222273)
+++ trunk/Source/WebCore/Modules/cache/CacheStorage.cpp	2017-09-20 19:04:00 UTC (rev 222274)
@@ -1,278 +0,0 @@
-/*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "CacheStorage.h"
-
-#include "CacheQueryOptions.h"
-#include "JSDOMCache.h"
-#include "JSFetchResponse.h"
-#include "ScriptExecutionContext.h"
-
-using namespace WebCore::DOMCacheEngine;
-
-namespace WebCore {
-
-CacheStorage::CacheStorage(ScriptExecutionContext& context, Ref<CacheStorageConnection>&& connection)
-    : ActiveDOMObject(&context)
-    , m_connection(WTFMove(connection))
-{
-    suspendIfNeeded();
-}
-
-String CacheStorage::origin() const
-{
-    // FIXME: Do we really need to check for origin being null?
-    auto* origin = scriptExecutionContext() ? scriptExecutionContext()->securityOrigin() : nullptr;
-    return origin ? origin->toString() : String();
-}
-
-static void doSequentialMatch(size_t index, Vector<Ref<DOMCache>>&& caches, DOMCache::RequestInfo&& info, CacheQueryOptions&& options, DOMCache::MatchCallback&& completionHandler)
-{
-    if (index >= caches.size()) {
-        completionHandler(nullptr);
-        return;
-    }
-
-    caches[index]->doMatch(WTFMove(info), WTFMove(options), [caches = WTFMove(caches), info, options, completionHandler = WTFMove(completionHandler), index](ExceptionOr<FetchResponse*>&& result) mutable {
-        if (result.hasException()) {
-            completionHandler(result.releaseException());
-            return;
-        }
-        if (result.returnValue()) {
-            completionHandler(result.returnValue());
-            return;
-        }
-        doSequentialMatch(++index, WTFMove(caches), WTFMove(info), WTFMove(options), WTFMove(completionHandler));
-    });
-}
-
-static inline void startSequentialMatch(Vector<Ref<DOMCache>>&& caches, DOMCache::RequestInfo&& info, CacheQueryOptions&& options, DOMCache::MatchCallback&& completionHandler)
-{
-    doSequentialMatch(0, WTFMove(caches), WTFMove(info), WTFMove(options), WTFMove(completionHandler));
-}
-
-static inline Vector<Ref<DOMCache>> copyCaches(const Vector<Ref<DOMCache>>& caches)
-{
-    Vector<Ref<DOMCache>> copy;
-    copy.reserveInitialCapacity(caches.size());
-    for (auto& cache : caches)
-        copy.uncheckedAppend(cache.copyRef());
-    return copy;
-}
-
-void CacheStorage::match(DOMCache::RequestInfo&& info, CacheQueryOptions&& options, Ref<DeferredPromise>&& promise)
-{
-    retrieveCaches([this, info = WTFMove(info), options = WTFMove(options), promise = WTFMove(promise)](std::optional<Exception>&& exception) mutable {
-        if (exception) {
-            promise->reject(WTFMove(exception.value()));
-            return;
-        }
-
-        if (!options.cacheName.isNull()) {
-            auto position = m_caches.findMatching([&](auto& item) { return item->name() == options.cacheName; });
-            if (position != notFound) {
-                m_caches[position]->match(WTFMove(info), WTFMove(options), WTFMove(promise));
-                return;
-            }
-            promise->resolve();
-            return;
-        }
-
-        setPendingActivity(this);
-        startSequentialMatch(copyCaches(m_caches), WTFMove(info), WTFMove(options), [this, promise = WTFMove(promise)](ExceptionOr<FetchResponse*>&& result) mutable {
-            if (!m_isStopped) {
-                if (result.hasException()) {
-                    promise->reject(result.releaseException());
-                    return;
-                }
-                if (!result.returnValue())
-                    promise->resolve();
-                else
-                    promise->resolve<IDLInterface<FetchResponse>>(*result.returnValue());
-            }
-            unsetPendingActivity(this);
-        });
-    });
-}
-
-void CacheStorage::has(const String& name, DOMPromiseDeferred<IDLBoolean>&& promise)
-{
-    retrieveCaches([this, name, promise = WTFMove(promise)](std::optional<Exception>&& exception) mutable {
-        if (exception) {
-            promise.reject(WTFMove(exception.value()));
-            return;
-        }
-        promise.resolve(m_caches.findMatching([&](auto& item) { return item->name() == name; }) != notFound);
-    });
-}
-
-void CacheStorage::retrieveCaches(WTF::Function<void(std::optional<Exception>&&)>&& callback)
-{
-    String origin = this->origin();
-    if (origin.isNull())
-        return;
-
-    setPendingActivity(this);
-    m_connection->retrieveCaches(origin, m_updateCounter, [this, callback = WTFMove(callback)](CacheInfosOrError&& result) mutable {
-        if (!m_isStopped) {
-            if (!result.hasValue()) {
-                callback(DOMCacheEngine::errorToException(result.error()));
-                return;
-            }
-
-            auto& cachesInfo = result.value();
-
-            if (m_updateCounter != cachesInfo.updateCounter) {
-                m_updateCounter = cachesInfo.updateCounter;
-
-                ASSERT(scriptExecutionContext());
-
-                Vector<Ref<DOMCache>> caches;
-                caches.reserveInitialCapacity(cachesInfo.infos.size());
-                for (auto& info : cachesInfo.infos) {
-                    auto position = m_caches.findMatching([&](const auto& cache) { return info.identifier == cache->identifier(); });
-                    caches.uncheckedAppend(position != notFound ? m_caches[position].copyRef() : DOMCache::create(*scriptExecutionContext(), WTFMove(info.name), info.identifier, m_connection.copyRef()));
-                }
-                m_caches = WTFMove(caches);
-
-            }
-            callback(std::nullopt);
-        }
-        unsetPendingActivity(this);
-    });
-}
-
-static void logConsolePersistencyError(ScriptExecutionContext* context, const String& cacheName)
-{
-    if (!context)
-        return;
-
-    context->addConsoleMessage(MessageSource::JS, MessageLevel::Error, makeString("There was an error making ", cacheName, " persistent on the filesystem"));
-}
-
-void CacheStorage::open(const String& name, DOMPromiseDeferred<IDLInterface<DOMCache>>&& promise)
-{
-    retrieveCaches([this, name, promise = WTFMove(promise)](std::optional<Exception>&& exception) mutable {
-        if (exception) {
-            promise.reject(WTFMove(exception.value()));
-            return;
-        }
-
-        auto position = m_caches.findMatching([&](auto& item) { return item->name() == name; });
-        if (position != notFound) {
-            auto& cache = m_caches[position];
-            promise.resolve(DOMCache::create(*scriptExecutionContext(), String { cache->name() }, cache->identifier(), m_connection.copyRef()));
-            return;
-        }
-
-        String origin = this->origin();
-        ASSERT(!origin.isNull());
-
-        setPendingActivity(this);
-        m_connection->open(origin, name, [this, name, promise = WTFMove(promise)](const CacheIdentifierOrError& result) mutable {
-            if (!m_isStopped) {
-                if (!result.hasValue())
-                    promise.reject(DOMCacheEngine::errorToException(result.error()));
-                else {
-                    if (result.value().hadStorageError)
-                        logConsolePersistencyError(scriptExecutionContext(), name);
-
-                    auto cache = DOMCache::create(*scriptExecutionContext(), String { name }, result.value().identifier, m_connection.copyRef());
-                    promise.resolve(cache);
-                    m_caches.append(WTFMove(cache));
-                }
-            }
-            unsetPendingActivity(this);
-        });
-    });
-}
-
-void CacheStorage::remove(const String& name, DOMPromiseDeferred<IDLBoolean>&& promise)
-{
-    retrieveCaches([this, name, promise = WTFMove(promise)](std::optional<Exception>&& exception) mutable {
-        if (exception) {
-            promise.reject(WTFMove(exception.value()));
-            return;
-        }
-
-        auto position = m_caches.findMatching([&](auto& item) { return item->name() == name; });
-        if (position == notFound) {
-            promise.resolve(false);
-            return;
-        }
-
-        String origin = this->origin();
-        ASSERT(!origin.isNull());
-
-        setPendingActivity(this);
-        m_connection->remove(m_caches[position]->identifier(), [this, name, promise = WTFMove(promise)](const CacheIdentifierOrError& result) mutable {
-            if (!m_isStopped) {
-                if (!result.hasValue())
-                    promise.reject(DOMCacheEngine::errorToException(result.error()));
-                else {
-                    if (result.value().hadStorageError)
-                        logConsolePersistencyError(scriptExecutionContext(), name);
-                    promise.resolve(true);
-                }
-            }
-            unsetPendingActivity(this);
-        });
-        m_caches.remove(position);
-    });
-}
-
-void CacheStorage::keys(KeysPromise&& promise)
-{
-    retrieveCaches([this, promise = WTFMove(promise)](std::optional<Exception>&& exception) mutable {
-        if (exception) {
-            promise.reject(WTFMove(exception.value()));
-            return;
-        }
-
-        Vector<String> keys;
-        keys.reserveInitialCapacity(m_caches.size());
-        for (auto& cache : m_caches)
-            keys.uncheckedAppend(cache->name());
-        promise.resolve(keys);
-    });
-}
-
-void CacheStorage::stop()
-{
-    m_isStopped = true;
-}
-
-const char* CacheStorage::activeDOMObjectName() const
-{
-    return "CacheStorage";
-}
-
-bool CacheStorage::canSuspendForDocumentSuspension() const
-{
-    return !hasPendingActivity();
-}
-
-} // namespace WebCore

Deleted: trunk/Source/WebCore/Modules/cache/CacheStorage.h (222273 => 222274)


--- trunk/Source/WebCore/Modules/cache/CacheStorage.h	2017-09-20 18:10:56 UTC (rev 222273)
+++ trunk/Source/WebCore/Modules/cache/CacheStorage.h	2017-09-20 19:04:00 UTC (rev 222274)
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "CacheStorageConnection.h"
-#include "DOMCache.h"
-#include "FetchRequest.h"
-#include <wtf/Forward.h>
-
-namespace WebCore {
-
-class CacheStorage : public RefCounted<CacheStorage>, public ActiveDOMObject {
-public:
-    static Ref<CacheStorage> create(ScriptExecutionContext& context, Ref<CacheStorageConnection>&& connection) { return adoptRef(*new CacheStorage(context, WTFMove(connection))); }
-
-    using KeysPromise = DOMPromiseDeferred<IDLSequence<IDLDOMString>>;
-
-    void match(DOMCache::RequestInfo&&, CacheQueryOptions&&, Ref<DeferredPromise>&&);
-    void has(const String&, DOMPromiseDeferred<IDLBoolean>&&);
-    void open(const String&, DOMPromiseDeferred<IDLInterface<DOMCache>>&&);
-    void remove(const String&, DOMPromiseDeferred<IDLBoolean>&&);
-    void keys(KeysPromise&&);
-
-private:
-    CacheStorage(ScriptExecutionContext&, Ref<CacheStorageConnection>&&);
-
-    // ActiveDOMObject
-    void stop() final;
-    const char* activeDOMObjectName() const final;
-    bool canSuspendForDocumentSuspension() const final;
-
-    void retrieveCaches(WTF::Function<void(std::optional<Exception>&&)>&&);
-    String origin() const;
-
-    Vector<Ref<DOMCache>> m_caches;
-    uint64_t m_updateCounter { 0 };
-    Ref<CacheStorageConnection> m_connection;
-    bool m_isStopped { false };
-};
-
-} // namespace WebCore

Deleted: trunk/Source/WebCore/Modules/cache/CacheStorage.idl (222273 => 222274)


--- trunk/Source/WebCore/Modules/cache/CacheStorage.idl	2017-09-20 18:10:56 UTC (rev 222273)
+++ trunk/Source/WebCore/Modules/cache/CacheStorage.idl	2017-09-20 19:04:00 UTC (rev 222274)
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-typedef (FetchRequest or USVString) RequestInfo;
-
-[
-    SecureContext,
-    Exposed=(Window,Worker),
-    EnabledAtRuntime=CacheAPI,
-] interface CacheStorage {
-    [NewObject] Promise<any> match(RequestInfo request, optional CacheQueryOptions options);
-    [NewObject] Promise<boolean> has(DOMString cacheName);
-    [NewObject] Promise<Cache> open(DOMString cacheName);
-    [NewObject, ImplementedAs=remove] Promise<boolean> delete(DOMString cacheName);
-    [NewObject] Promise<sequence<DOMString>> keys();
-};

Copied: trunk/Source/WebCore/Modules/cache/DOMCacheStorage.cpp (from rev 222273, trunk/Source/WebCore/Modules/cache/CacheStorage.cpp) (0 => 222274)


--- trunk/Source/WebCore/Modules/cache/DOMCacheStorage.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/cache/DOMCacheStorage.cpp	2017-09-20 19:04:00 UTC (rev 222274)
@@ -0,0 +1,278 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DOMCacheStorage.h"
+
+#include "CacheQueryOptions.h"
+#include "JSDOMCache.h"
+#include "JSFetchResponse.h"
+#include "ScriptExecutionContext.h"
+
+using namespace WebCore::DOMCacheEngine;
+
+namespace WebCore {
+
+DOMCacheStorage::DOMCacheStorage(ScriptExecutionContext& context, Ref<CacheStorageConnection>&& connection)
+    : ActiveDOMObject(&context)
+    , m_connection(WTFMove(connection))
+{
+    suspendIfNeeded();
+}
+
+String DOMCacheStorage::origin() const
+{
+    // FIXME: Do we really need to check for origin being null?
+    auto* origin = scriptExecutionContext() ? scriptExecutionContext()->securityOrigin() : nullptr;
+    return origin ? origin->toString() : String();
+}
+
+static void doSequentialMatch(size_t index, Vector<Ref<DOMCache>>&& caches, DOMCache::RequestInfo&& info, CacheQueryOptions&& options, DOMCache::MatchCallback&& completionHandler)
+{
+    if (index >= caches.size()) {
+        completionHandler(nullptr);
+        return;
+    }
+
+    caches[index]->doMatch(WTFMove(info), WTFMove(options), [caches = WTFMove(caches), info, options, completionHandler = WTFMove(completionHandler), index](ExceptionOr<FetchResponse*>&& result) mutable {
+        if (result.hasException()) {
+            completionHandler(result.releaseException());
+            return;
+        }
+        if (result.returnValue()) {
+            completionHandler(result.returnValue());
+            return;
+        }
+        doSequentialMatch(++index, WTFMove(caches), WTFMove(info), WTFMove(options), WTFMove(completionHandler));
+    });
+}
+
+static inline void startSequentialMatch(Vector<Ref<DOMCache>>&& caches, DOMCache::RequestInfo&& info, CacheQueryOptions&& options, DOMCache::MatchCallback&& completionHandler)
+{
+    doSequentialMatch(0, WTFMove(caches), WTFMove(info), WTFMove(options), WTFMove(completionHandler));
+}
+
+static inline Vector<Ref<DOMCache>> copyCaches(const Vector<Ref<DOMCache>>& caches)
+{
+    Vector<Ref<DOMCache>> copy;
+    copy.reserveInitialCapacity(caches.size());
+    for (auto& cache : caches)
+        copy.uncheckedAppend(cache.copyRef());
+    return copy;
+}
+
+void DOMCacheStorage::match(DOMCache::RequestInfo&& info, CacheQueryOptions&& options, Ref<DeferredPromise>&& promise)
+{
+    retrieveCaches([this, info = WTFMove(info), options = WTFMove(options), promise = WTFMove(promise)](std::optional<Exception>&& exception) mutable {
+        if (exception) {
+            promise->reject(WTFMove(exception.value()));
+            return;
+        }
+
+        if (!options.cacheName.isNull()) {
+            auto position = m_caches.findMatching([&](auto& item) { return item->name() == options.cacheName; });
+            if (position != notFound) {
+                m_caches[position]->match(WTFMove(info), WTFMove(options), WTFMove(promise));
+                return;
+            }
+            promise->resolve();
+            return;
+        }
+
+        setPendingActivity(this);
+        startSequentialMatch(copyCaches(m_caches), WTFMove(info), WTFMove(options), [this, promise = WTFMove(promise)](ExceptionOr<FetchResponse*>&& result) mutable {
+            if (!m_isStopped) {
+                if (result.hasException()) {
+                    promise->reject(result.releaseException());
+                    return;
+                }
+                if (!result.returnValue())
+                    promise->resolve();
+                else
+                    promise->resolve<IDLInterface<FetchResponse>>(*result.returnValue());
+            }
+            unsetPendingActivity(this);
+        });
+    });
+}
+
+void DOMCacheStorage::has(const String& name, DOMPromiseDeferred<IDLBoolean>&& promise)
+{
+    retrieveCaches([this, name, promise = WTFMove(promise)](std::optional<Exception>&& exception) mutable {
+        if (exception) {
+            promise.reject(WTFMove(exception.value()));
+            return;
+        }
+        promise.resolve(m_caches.findMatching([&](auto& item) { return item->name() == name; }) != notFound);
+    });
+}
+
+void DOMCacheStorage::retrieveCaches(WTF::Function<void(std::optional<Exception>&&)>&& callback)
+{
+    String origin = this->origin();
+    if (origin.isNull())
+        return;
+
+    setPendingActivity(this);
+    m_connection->retrieveCaches(origin, m_updateCounter, [this, callback = WTFMove(callback)](CacheInfosOrError&& result) mutable {
+        if (!m_isStopped) {
+            if (!result.hasValue()) {
+                callback(DOMCacheEngine::errorToException(result.error()));
+                return;
+            }
+
+            auto& cachesInfo = result.value();
+
+            if (m_updateCounter != cachesInfo.updateCounter) {
+                m_updateCounter = cachesInfo.updateCounter;
+
+                ASSERT(scriptExecutionContext());
+
+                Vector<Ref<DOMCache>> caches;
+                caches.reserveInitialCapacity(cachesInfo.infos.size());
+                for (auto& info : cachesInfo.infos) {
+                    auto position = m_caches.findMatching([&](const auto& cache) { return info.identifier == cache->identifier(); });
+                    caches.uncheckedAppend(position != notFound ? m_caches[position].copyRef() : DOMCache::create(*scriptExecutionContext(), WTFMove(info.name), info.identifier, m_connection.copyRef()));
+                }
+                m_caches = WTFMove(caches);
+
+            }
+            callback(std::nullopt);
+        }
+        unsetPendingActivity(this);
+    });
+}
+
+static void logConsolePersistencyError(ScriptExecutionContext* context, const String& cacheName)
+{
+    if (!context)
+        return;
+
+    context->addConsoleMessage(MessageSource::JS, MessageLevel::Error, makeString("There was an error making ", cacheName, " persistent on the filesystem"));
+}
+
+void DOMCacheStorage::open(const String& name, DOMPromiseDeferred<IDLInterface<DOMCache>>&& promise)
+{
+    retrieveCaches([this, name, promise = WTFMove(promise)](std::optional<Exception>&& exception) mutable {
+        if (exception) {
+            promise.reject(WTFMove(exception.value()));
+            return;
+        }
+
+        auto position = m_caches.findMatching([&](auto& item) { return item->name() == name; });
+        if (position != notFound) {
+            auto& cache = m_caches[position];
+            promise.resolve(DOMCache::create(*scriptExecutionContext(), String { cache->name() }, cache->identifier(), m_connection.copyRef()));
+            return;
+        }
+
+        String origin = this->origin();
+        ASSERT(!origin.isNull());
+
+        setPendingActivity(this);
+        m_connection->open(origin, name, [this, name, promise = WTFMove(promise)](const CacheIdentifierOrError& result) mutable {
+            if (!m_isStopped) {
+                if (!result.hasValue())
+                    promise.reject(DOMCacheEngine::errorToException(result.error()));
+                else {
+                    if (result.value().hadStorageError)
+                        logConsolePersistencyError(scriptExecutionContext(), name);
+
+                    auto cache = DOMCache::create(*scriptExecutionContext(), String { name }, result.value().identifier, m_connection.copyRef());
+                    promise.resolve(cache);
+                    m_caches.append(WTFMove(cache));
+                }
+            }
+            unsetPendingActivity(this);
+        });
+    });
+}
+
+void DOMCacheStorage::remove(const String& name, DOMPromiseDeferred<IDLBoolean>&& promise)
+{
+    retrieveCaches([this, name, promise = WTFMove(promise)](std::optional<Exception>&& exception) mutable {
+        if (exception) {
+            promise.reject(WTFMove(exception.value()));
+            return;
+        }
+
+        auto position = m_caches.findMatching([&](auto& item) { return item->name() == name; });
+        if (position == notFound) {
+            promise.resolve(false);
+            return;
+        }
+
+        String origin = this->origin();
+        ASSERT(!origin.isNull());
+
+        setPendingActivity(this);
+        m_connection->remove(m_caches[position]->identifier(), [this, name, promise = WTFMove(promise)](const CacheIdentifierOrError& result) mutable {
+            if (!m_isStopped) {
+                if (!result.hasValue())
+                    promise.reject(DOMCacheEngine::errorToException(result.error()));
+                else {
+                    if (result.value().hadStorageError)
+                        logConsolePersistencyError(scriptExecutionContext(), name);
+                    promise.resolve(true);
+                }
+            }
+            unsetPendingActivity(this);
+        });
+        m_caches.remove(position);
+    });
+}
+
+void DOMCacheStorage::keys(KeysPromise&& promise)
+{
+    retrieveCaches([this, promise = WTFMove(promise)](std::optional<Exception>&& exception) mutable {
+        if (exception) {
+            promise.reject(WTFMove(exception.value()));
+            return;
+        }
+
+        Vector<String> keys;
+        keys.reserveInitialCapacity(m_caches.size());
+        for (auto& cache : m_caches)
+            keys.uncheckedAppend(cache->name());
+        promise.resolve(keys);
+    });
+}
+
+void DOMCacheStorage::stop()
+{
+    m_isStopped = true;
+}
+
+const char* DOMCacheStorage::activeDOMObjectName() const
+{
+    return "CacheStorage";
+}
+
+bool DOMCacheStorage::canSuspendForDocumentSuspension() const
+{
+    return !hasPendingActivity();
+}
+
+} // namespace WebCore

Copied: trunk/Source/WebCore/Modules/cache/DOMCacheStorage.h (from rev 222273, trunk/Source/WebCore/Modules/cache/CacheStorage.h) (0 => 222274)


--- trunk/Source/WebCore/Modules/cache/DOMCacheStorage.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/cache/DOMCacheStorage.h	2017-09-20 19:04:00 UTC (rev 222274)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "CacheStorageConnection.h"
+#include "DOMCache.h"
+#include "FetchRequest.h"
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+class DOMCacheStorage : public RefCounted<DOMCacheStorage>, public ActiveDOMObject {
+public:
+    static Ref<DOMCacheStorage> create(ScriptExecutionContext& context, Ref<CacheStorageConnection>&& connection) { return adoptRef(*new DOMCacheStorage(context, WTFMove(connection))); }
+
+    using KeysPromise = DOMPromiseDeferred<IDLSequence<IDLDOMString>>;
+
+    void match(DOMCache::RequestInfo&&, CacheQueryOptions&&, Ref<DeferredPromise>&&);
+    void has(const String&, DOMPromiseDeferred<IDLBoolean>&&);
+    void open(const String&, DOMPromiseDeferred<IDLInterface<DOMCache>>&&);
+    void remove(const String&, DOMPromiseDeferred<IDLBoolean>&&);
+    void keys(KeysPromise&&);
+
+private:
+    DOMCacheStorage(ScriptExecutionContext&, Ref<CacheStorageConnection>&&);
+
+    // ActiveDOMObject
+    void stop() final;
+    const char* activeDOMObjectName() const final;
+    bool canSuspendForDocumentSuspension() const final;
+
+    void retrieveCaches(WTF::Function<void(std::optional<Exception>&&)>&&);
+    String origin() const;
+
+    Vector<Ref<DOMCache>> m_caches;
+    uint64_t m_updateCounter { 0 };
+    Ref<CacheStorageConnection> m_connection;
+    bool m_isStopped { false };
+};
+
+} // namespace WebCore

Copied: trunk/Source/WebCore/Modules/cache/DOMCacheStorage.idl (from rev 222273, trunk/Source/WebCore/Modules/cache/CacheStorage.idl) (0 => 222274)


--- trunk/Source/WebCore/Modules/cache/DOMCacheStorage.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/cache/DOMCacheStorage.idl	2017-09-20 19:04:00 UTC (rev 222274)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+typedef (FetchRequest or USVString) RequestInfo;
+
+[
+    SecureContext,
+    Exposed=(Window,Worker),
+    EnabledAtRuntime=CacheAPI,
+    InterfaceName=CacheStorage,
+] interface DOMCacheStorage {
+    [NewObject] Promise<any> match(RequestInfo request, optional CacheQueryOptions options);
+    [NewObject] Promise<boolean> has(DOMString cacheName);
+    [NewObject] Promise<Cache> open(DOMString cacheName);
+    [NewObject, ImplementedAs=remove] Promise<boolean> delete(DOMString cacheName);
+    [NewObject] Promise<sequence<DOMString>> keys();
+};

Modified: trunk/Source/WebCore/Modules/cache/DOMWindowCaches.cpp (222273 => 222274)


--- trunk/Source/WebCore/Modules/cache/DOMWindowCaches.cpp	2017-09-20 18:10:56 UTC (rev 222273)
+++ trunk/Source/WebCore/Modules/cache/DOMWindowCaches.cpp	2017-09-20 19:04:00 UTC (rev 222274)
@@ -26,8 +26,8 @@
 #include "config.h"
 #include "DOMWindowCaches.h"
 
-#include "CacheStorage.h"
 #include "CacheStorageProvider.h"
+#include "DOMCacheStorage.h"
 #include "DOMWindow.h"
 #include "Document.h"
 #include "Frame.h"
@@ -56,7 +56,7 @@
     return supplement;
 }
 
-CacheStorage* DOMWindowCaches::caches(DOMWindow& window)
+DOMCacheStorage* DOMWindowCaches::caches(DOMWindow& window)
 {
     if (!window.isCurrentlyDisplayedInFrame())
         return nullptr;
@@ -64,12 +64,12 @@
     return DOMWindowCaches::from(&window)->caches();
 }
 
-CacheStorage* DOMWindowCaches::caches() const
+DOMCacheStorage* DOMWindowCaches::caches() const
 {
     ASSERT(frame());
     ASSERT(frame()->document());
     if (!m_caches && frame()->page())
-        m_caches = CacheStorage::create(*frame()->document(), frame()->page()->cacheStorageProvider().createCacheStorageConnection(frame()->page()->sessionID()));
+        m_caches = DOMCacheStorage::create(*frame()->document(), frame()->page()->cacheStorageProvider().createCacheStorageConnection(frame()->page()->sessionID()));
     return m_caches.get();
 }
 

Modified: trunk/Source/WebCore/Modules/cache/DOMWindowCaches.h (222273 => 222274)


--- trunk/Source/WebCore/Modules/cache/DOMWindowCaches.h	2017-09-20 18:10:56 UTC (rev 222273)
+++ trunk/Source/WebCore/Modules/cache/DOMWindowCaches.h	2017-09-20 19:04:00 UTC (rev 222274)
@@ -31,7 +31,7 @@
 namespace WebCore {
 
 class DOMWindow;
-class CacheStorage;
+class DOMCacheStorage;
 
 class DOMWindowCaches : public Supplement<DOMWindow>, public DOMWindowProperty {
 public:
@@ -38,13 +38,13 @@
     explicit DOMWindowCaches(DOMWindow*);
 
     static DOMWindowCaches* from(DOMWindow*);
-    static CacheStorage* caches(DOMWindow&);
+    static DOMCacheStorage* caches(DOMWindow&);
 
 private:
     static const char* supplementName();
-    CacheStorage* caches() const;
+    DOMCacheStorage* caches() const;
 
-    mutable RefPtr<CacheStorage> m_caches;
+    mutable RefPtr<DOMCacheStorage> m_caches;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/Modules/cache/DOMWindowCaches.idl (222273 => 222274)


--- trunk/Source/WebCore/Modules/cache/DOMWindowCaches.idl	2017-09-20 18:10:56 UTC (rev 222273)
+++ trunk/Source/WebCore/Modules/cache/DOMWindowCaches.idl	2017-09-20 19:04:00 UTC (rev 222274)
@@ -26,5 +26,5 @@
 [
     EnabledAtRuntime=CacheAPI,
 ] partial interface DOMWindow {
-    [SecureContext, SameObject] readonly attribute CacheStorage caches;
+    [SecureContext, SameObject] readonly attribute DOMCacheStorage caches;
 };

Modified: trunk/Source/WebCore/Modules/cache/WorkerGlobalScopeCaches.cpp (222273 => 222274)


--- trunk/Source/WebCore/Modules/cache/WorkerGlobalScopeCaches.cpp	2017-09-20 18:10:56 UTC (rev 222273)
+++ trunk/Source/WebCore/Modules/cache/WorkerGlobalScopeCaches.cpp	2017-09-20 19:04:00 UTC (rev 222274)
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "WorkerGlobalScopeCaches.h"
 
-#include "CacheStorage.h"
+#include "DOMCacheStorage.h"
 #include "WorkerGlobalScope.h"
 
 namespace WebCore {
@@ -47,15 +47,15 @@
     return supplement;
 }
 
-CacheStorage* WorkerGlobalScopeCaches::caches(WorkerGlobalScope& scope)
+DOMCacheStorage* WorkerGlobalScopeCaches::caches(WorkerGlobalScope& scope)
 {
     return WorkerGlobalScopeCaches::from(scope)->caches();
 }
 
-CacheStorage* WorkerGlobalScopeCaches::caches() const
+DOMCacheStorage* WorkerGlobalScopeCaches::caches() const
 {
     if (!m_caches)
-        m_caches = CacheStorage::create(m_scope, m_scope.cacheStorageConnection());
+        m_caches = DOMCacheStorage::create(m_scope, m_scope.cacheStorageConnection());
     return m_caches.get();
 }
 

Modified: trunk/Source/WebCore/Modules/cache/WorkerGlobalScopeCaches.h (222273 => 222274)


--- trunk/Source/WebCore/Modules/cache/WorkerGlobalScopeCaches.h	2017-09-20 18:10:56 UTC (rev 222273)
+++ trunk/Source/WebCore/Modules/cache/WorkerGlobalScopeCaches.h	2017-09-20 19:04:00 UTC (rev 222274)
@@ -29,7 +29,7 @@
 
 namespace WebCore {
 
-class CacheStorage;
+class DOMCacheStorage;
 class WorkerGlobalScope;
 
 class WorkerGlobalScopeCaches : public Supplement<WorkerGlobalScope> {
@@ -39,15 +39,15 @@
     {
     }
 
-    static CacheStorage* caches(WorkerGlobalScope&);
+    static DOMCacheStorage* caches(WorkerGlobalScope&);
 
 private:
     static WorkerGlobalScopeCaches* from(WorkerGlobalScope&);
     static const char* supplementName();
-    CacheStorage* caches() const;
+    DOMCacheStorage* caches() const;
 
     WorkerGlobalScope& m_scope;
-    mutable RefPtr<CacheStorage> m_caches;
+    mutable RefPtr<DOMCacheStorage> m_caches;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/Modules/cache/WorkerGlobalScopeCaches.idl (222273 => 222274)


--- trunk/Source/WebCore/Modules/cache/WorkerGlobalScopeCaches.idl	2017-09-20 18:10:56 UTC (rev 222273)
+++ trunk/Source/WebCore/Modules/cache/WorkerGlobalScopeCaches.idl	2017-09-20 19:04:00 UTC (rev 222274)
@@ -26,5 +26,5 @@
 [
     EnabledAtRuntime=CacheAPI,
 ] partial interface WorkerGlobalScope {
-    [SecureContext, SameObject] readonly attribute CacheStorage caches;
+    [SecureContext, SameObject] readonly attribute DOMCacheStorage caches;
 };

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (222273 => 222274)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-09-20 18:10:56 UTC (rev 222273)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-09-20 19:04:00 UTC (rev 222274)
@@ -1713,8 +1713,8 @@
 		413015D91C7B571400091C6F /* FetchBodySource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 413015D51C7B570400091C6F /* FetchBodySource.cpp */; };
 		41380C261F3436A600155FDA /* DOMCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41380C201F34368A00155FDA /* DOMCache.cpp */; };
 		41380C271F3436AC00155FDA /* DOMCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 41380C251F34369A00155FDA /* DOMCache.h */; };
-		41380C281F3436AC00155FDA /* CacheStorage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41380C211F34368D00155FDA /* CacheStorage.cpp */; };
-		41380C291F3436AC00155FDA /* CacheStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 41380C221F34369000155FDA /* CacheStorage.h */; };
+		41380C281F3436AC00155FDA /* DOMCacheStorage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41380C211F34368D00155FDA /* DOMCacheStorage.cpp */; };
+		41380C291F3436AC00155FDA /* DOMCacheStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 41380C221F34369000155FDA /* DOMCacheStorage.h */; };
 		4138D3351244054800323D33 /* EventContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 4138D3331244054800323D33 /* EventContext.h */; };
 		4138D3361244054800323D33 /* EventContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4138D3341244054800323D33 /* EventContext.cpp */; };
 		4138F8571D253F08001CB61E /* JSDOMIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4138F8551D253EEE001CB61E /* JSDOMIterator.cpp */; };
@@ -3365,11 +3365,11 @@
 		7CE191711F2ABE7100272F78 /* JSFetchReferrerPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE191681F2AB70300272F78 /* JSFetchReferrerPolicy.h */; };
 		7CE191721F2ABE7100272F78 /* JSFetchRequestCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE1916E1F2AB70D00272F78 /* JSFetchRequestCache.cpp */; };
 		7CE191721F2ABE7100272F79 /* JSDOMCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE1916E1F2AB70D00272F79 /* JSDOMCache.cpp */; };
-		7CE191721F2ABE7100272F7A /* JSCacheStorage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE1916E1F2AB70D00272F7A /* JSCacheStorage.cpp */; };
+		7CE191721F2ABE7100272F7A /* JSDOMCacheStorage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE1916E1F2AB70D00272F7A /* JSDOMCacheStorage.cpp */; };
 		7CE191721F2ABE7100272F7B /* JSCacheQueryOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE1916E1F2AB70D00272F7B /* JSCacheQueryOptions.cpp */; };
 		7CE191731F2ABE7100272F78 /* JSFetchRequestCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE191641F2AB6FB00272F78 /* JSFetchRequestCache.h */; };
 		7CE191731F2ABE7100272F79 /* JSDOMCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE191641F2AB6FB00272F79 /* JSDOMCache.h */; };
-		7CE191731F2ABE7100272F7A /* JSCacheStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE191641F2AB6FB00272F7A /* JSCacheStorage.h */; };
+		7CE191731F2ABE7100272F7A /* JSDOMCacheStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE191641F2AB6FB00272F7A /* JSDOMCacheStorage.h */; };
 		7CE191741F2ABE7100272F78 /* JSFetchRequestCredentials.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE1916B1F2AB70800272F78 /* JSFetchRequestCredentials.cpp */; };
 		7CE191751F2ABE7100272F78 /* JSFetchRequestCredentials.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE191661F2AB6FF00272F78 /* JSFetchRequestCredentials.h */; };
 		7CE191761F2ABE7100272F78 /* JSFetchRequestInit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE1916D1F2AB70C00272F78 /* JSFetchRequestInit.cpp */; };
@@ -9504,10 +9504,10 @@
 		413015D61C7B570400091C6F /* FetchBodySource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchBodySource.h; sourceTree = "<group>"; };
 		413015D71C7B570400091C6E /* FetchResponse.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FetchResponse.idl; sourceTree = "<group>"; };
 		41380C201F34368A00155FDA /* DOMCache.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = DOMCache.cpp; path = Modules/cache/DOMCache.cpp; sourceTree = SOURCE_ROOT; };
-		41380C211F34368D00155FDA /* CacheStorage.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = CacheStorage.cpp; path = Modules/cache/CacheStorage.cpp; sourceTree = SOURCE_ROOT; };
-		41380C221F34369000155FDA /* CacheStorage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CacheStorage.h; path = Modules/cache/CacheStorage.h; sourceTree = SOURCE_ROOT; };
+		41380C211F34368D00155FDA /* DOMCacheStorage.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = DOMCacheStorage.cpp; path = Modules/cache/DOMCacheStorage.cpp; sourceTree = SOURCE_ROOT; };
+		41380C221F34369000155FDA /* DOMCacheStorage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = DOMCacheStorage.h; path = Modules/cache/DOMCacheStorage.h; sourceTree = SOURCE_ROOT; };
 		41380C231F34369400155FDA /* DOMCache.idl */ = {isa = PBXFileReference; lastKnownFileType = text; name = DOMCache.idl; path = Modules/cache/DOMCache.idl; sourceTree = SOURCE_ROOT; };
-		41380C241F34369700155FDA /* CacheStorage.idl */ = {isa = PBXFileReference; lastKnownFileType = text; name = CacheStorage.idl; path = Modules/cache/CacheStorage.idl; sourceTree = SOURCE_ROOT; };
+		41380C241F34369700155FDA /* DOMCacheStorage.idl */ = {isa = PBXFileReference; lastKnownFileType = text; name = DOMCacheStorage.idl; path = Modules/cache/DOMCacheStorage.idl; sourceTree = SOURCE_ROOT; };
 		41380C251F34369A00155FDA /* DOMCache.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = DOMCache.h; path = Modules/cache/DOMCache.h; sourceTree = SOURCE_ROOT; };
 		41380C2A1F343E2F00155FDA /* WorkerGlobalScopeCaches.idl */ = {isa = PBXFileReference; lastKnownFileType = text; name = WorkerGlobalScopeCaches.idl; path = Modules/cache/WorkerGlobalScopeCaches.idl; sourceTree = SOURCE_ROOT; };
 		41380C2B1F343E2F00155FDA /* DOMWindowCaches.idl */ = {isa = PBXFileReference; lastKnownFileType = text; name = DOMWindowCaches.idl; path = Modules/cache/DOMWindowCaches.idl; sourceTree = SOURCE_ROOT; };
@@ -11625,7 +11625,7 @@
 		7CE1915F1F2A9B4F00272F78 /* FetchRequestRedirect.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = FetchRequestRedirect.idl; sourceTree = "<group>"; };
 		7CE191641F2AB6FB00272F78 /* JSFetchRequestCache.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSFetchRequestCache.h; sourceTree = "<group>"; };
 		7CE191641F2AB6FB00272F79 /* JSDOMCache.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSDOMCache.h; sourceTree = "<group>"; };
-		7CE191641F2AB6FB00272F7A /* JSCacheStorage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSCacheStorage.h; sourceTree = "<group>"; };
+		7CE191641F2AB6FB00272F7A /* JSDOMCacheStorage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSDOMCacheStorage.h; sourceTree = "<group>"; };
 		7CE191651F2AB6FD00272F78 /* JSFetchRequestMode.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSFetchRequestMode.cpp; sourceTree = "<group>"; };
 		7CE191661F2AB6FF00272F78 /* JSFetchRequestCredentials.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSFetchRequestCredentials.h; sourceTree = "<group>"; };
 		7CE191671F2AB70100272F78 /* JSFetchReferrerPolicy.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSFetchReferrerPolicy.cpp; sourceTree = "<group>"; };
@@ -11637,7 +11637,7 @@
 		7CE1916D1F2AB70C00272F78 /* JSFetchRequestInit.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSFetchRequestInit.cpp; sourceTree = "<group>"; };
 		7CE1916E1F2AB70D00272F78 /* JSFetchRequestCache.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSFetchRequestCache.cpp; sourceTree = "<group>"; };
 		7CE1916E1F2AB70D00272F79 /* JSDOMCache.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMCache.cpp; sourceTree = "<group>"; };
-		7CE1916E1F2AB70D00272F7A /* JSCacheStorage.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSCacheStorage.cpp; sourceTree = "<group>"; };
+		7CE1916E1F2AB70D00272F7A /* JSDOMCacheStorage.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMCacheStorage.cpp; sourceTree = "<group>"; };
 		7CE1916E1F2AB70D00272F7B /* JSCacheQueryOptions.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSCacheQueryOptions.cpp; sourceTree = "<group>"; };
 		7CE1916F1F2AB70F00272F78 /* JSFetchRequestRedirect.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSFetchRequestRedirect.cpp; sourceTree = "<group>"; };
 		7CE58D491DD64A5B00128552 /* SVGPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPoint.h; sourceTree = "<group>"; };
@@ -18029,9 +18029,6 @@
 			children = (
 				41FB279B1F34CEF000795487 /* CacheQueryOptions.h */,
 				41FB27991F34CE9C00795487 /* CacheQueryOptions.idl */,
-				41380C211F34368D00155FDA /* CacheStorage.cpp */,
-				41380C221F34369000155FDA /* CacheStorage.h */,
-				41380C241F34369700155FDA /* CacheStorage.idl */,
 				41D129C91F3D0EE300D15E47 /* CacheStorageConnection.cpp */,
 				41D129CC1F3D0EE300D15E47 /* CacheStorageConnection.h */,
 				41D129CA1F3D0EE300D15E47 /* CacheStorageRecord.h */,
@@ -18040,6 +18037,9 @@
 				41380C231F34369400155FDA /* DOMCache.idl */,
 				41FABD2E1F4E0251006A6C97 /* DOMCacheEngine.cpp */,
 				41FABD2B1F4DFE42006A6C97 /* DOMCacheEngine.h */,
+				41380C211F34368D00155FDA /* DOMCacheStorage.cpp */,
+				41380C221F34369000155FDA /* DOMCacheStorage.h */,
+				41380C241F34369700155FDA /* DOMCacheStorage.idl */,
 				41FB278E1F34C28200795487 /* DOMWindowCaches.cpp */,
 				41FB278C1F34C28200795487 /* DOMWindowCaches.h */,
 				41380C2B1F343E2F00155FDA /* DOMWindowCaches.idl */,
@@ -18303,10 +18303,10 @@
 			isa = PBXGroup;
 			children = (
 				7CE1916E1F2AB70D00272F7B /* JSCacheQueryOptions.cpp */,
-				7CE1916E1F2AB70D00272F7A /* JSCacheStorage.cpp */,
-				7CE191641F2AB6FB00272F7A /* JSCacheStorage.h */,
 				7CE1916E1F2AB70D00272F79 /* JSDOMCache.cpp */,
 				7CE191641F2AB6FB00272F79 /* JSDOMCache.h */,
+				7CE1916E1F2AB70D00272F7A /* JSDOMCacheStorage.cpp */,
+				7CE191641F2AB6FB00272F7A /* JSDOMCacheStorage.h */,
 			);
 			name = CacheAPI;
 			sourceTree = "<group>";
@@ -27271,7 +27271,6 @@
 				BCB16C280979C3BD00467741 /* CachedXSLStyleSheet.h in Headers */,
 				93F1995008245E59001E9ABC /* CachePolicy.h in Headers */,
 				41D129D01F3D0F0500D15E47 /* CacheQueryOptions.h in Headers */,
-				41380C291F3436AC00155FDA /* CacheStorage.h in Headers */,
 				41D129D31F3D0F1600D15E47 /* CacheStorageConnection.h in Headers */,
 				41D129D51F3D0F6900D15E47 /* CacheStorageProvider.h in Headers */,
 				41D129D21F3D0F1200D15E47 /* CacheStorageRecord.h in Headers */,
@@ -27700,6 +27699,7 @@
 				1A8F6BC30DB55CDC001DB794 /* DOMApplicationCache.h in Headers */,
 				41380C271F3436AC00155FDA /* DOMCache.h in Headers */,
 				41FABD2D1F4DFE4A006A6C97 /* DOMCacheEngine.h in Headers */,
+				41380C291F3436AC00155FDA /* DOMCacheStorage.h in Headers */,
 				FC9A0F75164094CF003D6B8D /* DOMCSSNamespace.h in Headers */,
 				9B3A8872145632F9003AE8F5 /* DOMDOMSettableTokenList.h in Headers */,
 				7AABA25A14BC613300AA9A11 /* DOMEditor.h in Headers */,
@@ -28370,7 +28370,6 @@
 				7C77C3DC1DEF86D700A50BFA /* JSBlobLineEndings.h in Headers */,
 				7C77C3D51DEF178E00A50BFA /* JSBlobPropertyBag.h in Headers */,
 				14DCF3B31B6BE2080062D4C3 /* JSByteLengthQueuingStrategy.h in Headers */,
-				7CE191731F2ABE7100272F7A /* JSCacheStorage.h in Headers */,
 				1449E24C107D4A8400B5793F /* JSCallbackData.h in Headers */,
 				07277E4D17D018CC0015534E /* JSCanvasCaptureMediaStreamTrack.h in Headers */,
 				7C193BF01F5E10990088F3E6 /* JSCanvasDirection.h in Headers */,
@@ -28456,6 +28455,7 @@
 				416E6FE81BBD12DF000A3F65 /* JSDOMBindingInternalsBuiltins.h in Headers */,
 				7C45C9D41E3FCBDF00AAB558 /* JSDOMBindingSecurity.h in Headers */,
 				7CE191731F2ABE7100272F79 /* JSDOMCache.h in Headers */,
+				7CE191731F2ABE7100272F7A /* JSDOMCacheStorage.h in Headers */,
 				7C8139AA1ED6604B00CE26E8 /* JSDOMCastedThisErrorBehavior.h in Headers */,
 				413C2C341BC29A8F0075204C /* JSDOMConstructor.h in Headers */,
 				930841341CDDB15500B0958C /* JSDOMConvert.h in Headers */,
@@ -31416,7 +31416,6 @@
 				1C0939EA1A13E12900B788E5 /* CachedSVGFont.cpp in Sources */,
 				0753860214489E9800B78452 /* CachedTextTrack.cpp in Sources */,
 				BCB16C270979C3BD00467741 /* CachedXSLStyleSheet.cpp in Sources */,
-				41380C281F3436AC00155FDA /* CacheStorage.cpp in Sources */,
 				41D129CF1F3D0EFE00D15E47 /* CacheStorageConnection.cpp in Sources */,
 				E43AF8E61AC5B7E800CA717E /* CacheValidation.cpp in Sources */,
 				49AE2D96134EE5F90072920A /* CalculationValue.cpp in Sources */,
@@ -31776,6 +31775,7 @@
 				1A8F6BC20DB55CDC001DB794 /* DOMApplicationCache.cpp in Sources */,
 				41380C261F3436A600155FDA /* DOMCache.cpp in Sources */,
 				41FABD2F1F4E02CB006A6C97 /* DOMCacheEngine.cpp in Sources */,
+				41380C281F3436AC00155FDA /* DOMCacheStorage.cpp in Sources */,
 				FD677738195CAF3D0072E0D3 /* DOMCSSNamespace.cpp in Sources */,
 				7AABA25914BC613300AA9A11 /* DOMEditor.cpp in Sources */,
 				BC1BDF24156C1883001C1243 /* DOMError.cpp in Sources */,
@@ -32071,7 +32071,6 @@
 				E12DE7171E4B749C00F9ACCF /* GridTrackSizingAlgorithm.cpp in Sources */,
 				414C25D71E9EFEDE00BEE141 /* H264VideoToolBoxEncoder.mm in Sources */,
 				F55B3DBF1251F12D003EF269 /* HiddenInputType.cpp in Sources */,
-				073BDC051F68436100EE34ED /* TrackPrivateBase.cpp in Sources */,
 				515BE19B1D54F6C100DD7C68 /* HIDGamepad.cpp in Sources */,
 				515BE19D1D54F6C100DD7C68 /* HIDGamepadProvider.cpp in Sources */,
 				BC94D1530C275C8B006BC617 /* History.cpp in Sources */,
@@ -32406,7 +32405,6 @@
 				7C77C3D41DEF178E00A50BFA /* JSBlobPropertyBag.cpp in Sources */,
 				14DCF3B21B6BE2080062D4C3 /* JSByteLengthQueuingStrategy.cpp in Sources */,
 				7CE191721F2ABE7100272F7B /* JSCacheQueryOptions.cpp in Sources */,
-				7CE191721F2ABE7100272F7A /* JSCacheStorage.cpp in Sources */,
 				1449E287107D4DB400B5793F /* JSCallbackData.cpp in Sources */,
 				07277E4C17D018CC0015534E /* JSCanvasCaptureMediaStreamTrack.cpp in Sources */,
 				7C193BEF1F5E10990088F3E6 /* JSCanvasDirection.cpp in Sources */,
@@ -32499,6 +32497,7 @@
 				7C45C9CF1E3EFDF700AAB558 /* JSDOMBindingSecurity.cpp in Sources */,
 				7CC01D0A1E4A7B0400E529CC /* JSDOMBuiltinConstructorBase.cpp in Sources */,
 				7CE191721F2ABE7100272F79 /* JSDOMCache.cpp in Sources */,
+				7CE191721F2ABE7100272F7A /* JSDOMCacheStorage.cpp in Sources */,
 				7CC01D0B1E4A7B0400E529CC /* JSDOMConstructorBase.cpp in Sources */,
 				7CC01D0C1E4A7B0400E529CC /* JSDOMConstructorWithDocument.cpp in Sources */,
 				7C8E34B21E4A33B00054CE23 /* JSDOMConvertDate.cpp in Sources */,
@@ -34329,6 +34328,7 @@
 				070334D9145A006F008D8D45 /* TrackBase.cpp in Sources */,
 				070334D31459FFAD008D8D45 /* TrackEvent.cpp in Sources */,
 				BE88E0C11715CE2600658D98 /* TrackListBase.cpp in Sources */,
+				073BDC051F68436100EE34ED /* TrackPrivateBase.cpp in Sources */,
 				FFAC30FF184FB145008C4F1E /* TrailingObjects.cpp in Sources */,
 				51D7EFEC1BDEFA5100E93E10 /* TransactionOperation.cpp in Sources */,
 				49E911C30EF86D47009D0CAF /* TransformationMatrix.cpp in Sources */,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to