Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (221111 => 221112)
--- trunk/Source/WebCore/CMakeLists.txt 2017-08-23 22:24:30 UTC (rev 221111)
+++ trunk/Source/WebCore/CMakeLists.txt 2017-08-23 22:33:15 UTC (rev 221112)
@@ -897,6 +897,7 @@
Modules/cache/Cache.cpp
Modules/cache/CacheStorage.cpp
Modules/cache/CacheStorageConnection.cpp
+ Modules/cache/DOMCache.cpp
Modules/cache/DOMWindowCaches.cpp
Modules/cache/WorkerCacheStorageConnection.cpp
Modules/cache/WorkerGlobalScopeCaches.cpp
Modified: trunk/Source/WebCore/ChangeLog (221111 => 221112)
--- trunk/Source/WebCore/ChangeLog 2017-08-23 22:24:30 UTC (rev 221111)
+++ trunk/Source/WebCore/ChangeLog 2017-08-23 22:33:15 UTC (rev 221112)
@@ -1,3 +1,73 @@
+2017-08-23 Youenn Fablet <[email protected]>
+
+ [Cache API] Unify WebCore and WebKit error handling
+ https://bugs.webkit.org/show_bug.cgi?id=175902
+
+ Reviewed by Alex Christensen.
+
+ No change of behavior.
+
+ Introducing a DOMCache namespace enclosing structures, callbacks and function definitions
+ previously found in either WebCore::CacheStorageConnection or WebKit::CacheStorage.
+
+ Some previously used callbacks had no way to pass errors in WebCore while they had in WebKit.
+ Updated Cache, CacheStorage, CacheStorageConnection and WorkerCacheStorageConnection to deal with these potential errors.
+
+ * CMakeLists.txt:
+ * Modules/cache/Cache.cpp:
+ (WebCore::FetchTasksHandler::FetchTasksHandler):
+ (WebCore::FetchTasksHandler::records const):
+ (WebCore::FetchTasksHandler::addRecord):
+ (WebCore::Cache::addAll):
+ (WebCore::Cache::put):
+ (WebCore::Cache::retrieveRecords):
+ (WebCore::queryCacheMatch):
+ (WebCore::Cache::batchDeleteOperation):
+ (WebCore::toConnectionRecord):
+ (WebCore::Cache::batchPutOperation):
+ (WebCore::Cache::updateRecords):
+ * Modules/cache/Cache.h:
+ * Modules/cache/CacheStorage.cpp:
+ (WebCore::CacheStorage::retrieveCaches):
+ (WebCore::CacheStorage::open):
+ (WebCore::CacheStorage::remove):
+ * Modules/cache/CacheStorage.h:
+ * Modules/cache/CacheStorageConnection.cpp:
+ (WebCore::CacheStorageConnection::open):
+ (WebCore::CacheStorageConnection::remove):
+ (WebCore::CacheStorageConnection::retrieveCaches):
+ (WebCore::CacheStorageConnection::batchDeleteOperation):
+ (WebCore::CacheStorageConnection::batchPutOperation):
+ (WebCore::CacheStorageConnection::openOrRemoveCompleted):
+ (WebCore::CacheStorageConnection::updateCaches):
+ (WebCore::CacheStorageConnection::updateRecords):
+ (WebCore::CacheStorageConnection::deleteRecordsCompleted):
+ (WebCore::CacheStorageConnection::putRecordsCompleted):
+ * Modules/cache/CacheStorageConnection.h:
+ (WebCore::CacheStorageConnection::openCompleted):
+ (WebCore::CacheStorageConnection::removeCompleted):
+ (WebCore::CacheStorageConnection::doOpen):
+ (WebCore::CacheStorageConnection::doRemove):
+ (WebCore::CacheStorageConnection::doBatchDeleteOperation):
+ (WebCore::CacheStorageConnection::doBatchPutOperation):
+ * Modules/cache/WorkerCacheStorageConnection.cpp:
+ (WebCore::toCrossThreadRecordData):
+ (WebCore::fromCrossThreadRecordData):
+ (WebCore::WorkerCacheStorageConnection::doOpen):
+ (WebCore::WorkerCacheStorageConnection::doRemove):
+ (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
+ (WebCore::recordsDataFromRecords):
+ (WebCore::recordsDataOrErrorFromRecords):
+ (WebCore::recordsFromRecordsData):
+ (WebCore::recordsOrErrorFromRecordsData):
+ (WebCore::WorkerCacheStorageConnection::doRetrieveRecords):
+ (WebCore::WorkerCacheStorageConnection::doBatchDeleteOperation):
+ (WebCore::WorkerCacheStorageConnection::doBatchPutOperation):
+ * Modules/cache/DOMCache.cpp: Added.
+ * Modules/cache/DOMCache.h: Added.
+ * Modules/cache/WorkerCacheStorageConnection.h:
+ * WebCore.xcodeproj/project.pbxproj:
+
2017-08-23 Yusuke Suzuki <[email protected]>
[JSC] Optimize Map iteration with intrinsic
Modified: trunk/Source/WebCore/Modules/cache/Cache.cpp (221111 => 221112)
--- trunk/Source/WebCore/Modules/cache/Cache.cpp 2017-08-23 22:24:30 UTC (rev 221111)
+++ trunk/Source/WebCore/Modules/cache/Cache.cpp 2017-08-23 22:33:15 UTC (rev 221112)
@@ -34,9 +34,11 @@
#include "ScriptExecutionContext.h"
#include "URL.h"
+using namespace WebCore::DOMCache;
+
namespace WebCore {
-static CacheStorageConnection::Record toConnectionRecord(const FetchRequest&, FetchResponse&, CacheStorageConnection::ResponseBody&&);
+static Record toConnectionRecord(const FetchRequest&, FetchResponse&, ResponseBody&&);
Cache::Cache(ScriptExecutionContext& context, String&& name, uint64_t identifier, Ref<CacheStorageConnection>&& connection)
: ActiveDOMObject(&context)
@@ -135,7 +137,7 @@
class FetchTasksHandler : public RefCounted<FetchTasksHandler> {
public:
- explicit FetchTasksHandler(Function<void(ExceptionOr<Vector<CacheStorageConnection::Record>>&&)>&& callback)
+ explicit FetchTasksHandler(Function<void(ExceptionOr<Vector<Record>>&&)>&& callback)
: m_callback(WTFMove(callback))
{
}
@@ -146,9 +148,9 @@
m_callback(WTFMove(m_records));
}
- const Vector<CacheStorageConnection::Record>& records() const { return m_records; }
+ const Vector<Record>& records() const { return m_records; }
- size_t addRecord(CacheStorageConnection::Record&& record)
+ size_t addRecord(Record&& record)
{
ASSERT(!isDone());
m_records.append(WTFMove(record));
@@ -170,8 +172,8 @@
}
private:
- Vector<CacheStorageConnection::Record> m_records;
- Function<void(ExceptionOr<Vector<CacheStorageConnection::Record>>&&)> m_callback;
+ Vector<Record> m_records;
+ Function<void(ExceptionOr<Vector<Record>>&&)> m_callback;
};
ExceptionOr<Ref<FetchRequest>> Cache::requestFromInfo(RequestInfo&& info, bool ignoreMethod)
@@ -207,7 +209,7 @@
requests.uncheckedAppend(requestOrException.releaseReturnValue());
}
- auto taskHandler = adoptRef(*new FetchTasksHandler([protectedThis = makeRef(*this), this, promise = WTFMove(promise)](ExceptionOr<Vector<CacheStorageConnection::Record>>&& result) mutable {
+ auto taskHandler = adoptRef(*new FetchTasksHandler([protectedThis = makeRef(*this), this, promise = WTFMove(promise)](ExceptionOr<Vector<Record>>&& result) mutable {
if (result.hasException()) {
promise.reject(result.releaseException());
return;
@@ -248,7 +250,7 @@
CacheQueryOptions options;
for (const auto& record : taskHandler->records()) {
- if (CacheStorageConnection::queryCacheMatch(request->resourceRequest(), record.request, record.response, options)) {
+ if (DOMCache::queryCacheMatch(request->resourceRequest(), record.request, record.response, options)) {
taskHandler->error(Exception { InvalidStateError, ASCIILiteral("addAll cannot store several matching requests")});
return;
}
@@ -310,7 +312,7 @@
if (result.hasException())
promise.reject(result.releaseException());
else {
- CacheStorageConnection::ResponseBody body;
+ DOMCache::ResponseBody body;
if (auto buffer = result.releaseReturnValue())
body = buffer.releaseNonNull();
batchPutOperation(request.get(), response.get(), WTFMove(body), [promise = WTFMove(promise)](ExceptionOr<void>&& result) mutable {
@@ -381,9 +383,12 @@
void Cache::retrieveRecords(WTF::Function<void()>&& callback)
{
setPendingActivity(this);
- m_connection->retrieveRecords(m_identifier, [this, callback = WTFMove(callback)](Vector<CacheStorageConnection::Record>&& records) {
+ m_connection->retrieveRecords(m_identifier, [this, callback = WTFMove(callback)](RecordsOrError&& result) {
if (!m_isStopped) {
- updateRecords(WTFMove(records));
+ // FIXME: We should probably propagate that error up to the promise based operation.
+ ASSERT(result.hasValue());
+ if (result.hasValue())
+ updateRecords(WTFMove(result.value()));
callback();
}
unsetPendingActivity(this);
@@ -400,7 +405,7 @@
static inline bool queryCacheMatch(const FetchRequest& request, const FetchRequest& cachedRequest, const ResourceResponse& cachedResponse, const CacheQueryOptions& options)
{
// We need to pass the resource request with all correct headers hence why we call resourceRequest().
- return CacheStorageConnection::queryCacheMatch(request.resourceRequest(), cachedRequest.resourceRequest(), cachedResponse, options);
+ return DOMCache::queryCacheMatch(request.resourceRequest(), cachedRequest.resourceRequest(), cachedResponse, options);
}
Vector<CacheStorageRecord> Cache::queryCacheWithTargetStorage(const FetchRequest& request, const CacheQueryOptions& options, const Vector<CacheStorageRecord>& targetStorage)
@@ -419,15 +424,18 @@
void Cache::batchDeleteOperation(const FetchRequest& request, CacheQueryOptions&& options, WTF::Function<void(ExceptionOr<bool>&&)>&& callback)
{
setPendingActivity(this);
- m_connection->batchDeleteOperation(m_identifier, request.internalRequest(), WTFMove(options), [this, callback = WTFMove(callback)](Vector<uint64_t>&& records, CacheStorageConnection::Error error) {
- if (!m_isStopped)
- callback(CacheStorageConnection::exceptionOrResult(!records.isEmpty(), error));
-
+ m_connection->batchDeleteOperation(m_identifier, request.internalRequest(), WTFMove(options), [this, callback = WTFMove(callback)](RecordIdentifiersOrError&& result) {
+ if (!m_isStopped) {
+ if (!result.hasValue())
+ callback(DOMCache::errorToException(result.error()));
+ else
+ callback(!result.value().isEmpty());
+ }
unsetPendingActivity(this);
});
}
-CacheStorageConnection::Record toConnectionRecord(const FetchRequest& request, FetchResponse& response, CacheStorageConnection::ResponseBody&& responseBody)
+Record toConnectionRecord(const FetchRequest& request, FetchResponse& response, DOMCache::ResponseBody&& responseBody)
{
// FIXME: Add a setHTTPHeaderFields on ResourceResponseBase.
ResourceResponse cachedResponse = response.resourceResponse();
@@ -446,26 +454,29 @@
};
}
-void Cache::batchPutOperation(const FetchRequest& request, FetchResponse& response, CacheStorageConnection::ResponseBody&& responseBody, WTF::Function<void(ExceptionOr<void>&&)>&& callback)
+void Cache::batchPutOperation(const FetchRequest& request, FetchResponse& response, DOMCache::ResponseBody&& responseBody, WTF::Function<void(ExceptionOr<void>&&)>&& callback)
{
- Vector<CacheStorageConnection::Record> records;
+ Vector<Record> records;
records.append(toConnectionRecord(request, response, WTFMove(responseBody)));
batchPutOperation(WTFMove(records), WTFMove(callback));
}
-void Cache::batchPutOperation(Vector<CacheStorageConnection::Record>&& records, WTF::Function<void(ExceptionOr<void>&&)>&& callback)
+void Cache::batchPutOperation(Vector<Record>&& records, WTF::Function<void(ExceptionOr<void>&&)>&& callback)
{
setPendingActivity(this);
- m_connection->batchPutOperation(m_identifier, WTFMove(records), [this, callback = WTFMove(callback)](Vector<uint64_t>&&, CacheStorageConnection::Error error) {
- if (!m_isStopped)
- callback(CacheStorageConnection::errorToException(error));
-
+ m_connection->batchPutOperation(m_identifier, WTFMove(records), [this, callback = WTFMove(callback)](RecordIdentifiersOrError&& result) {
+ if (!m_isStopped) {
+ if (!result.hasValue())
+ callback(DOMCache::errorToException(result.error()));
+ else
+ callback({ });
+ }
unsetPendingActivity(this);
});
}
-void Cache::updateRecords(Vector<CacheStorageConnection::Record>&& records)
+void Cache::updateRecords(Vector<Record>&& records)
{
ASSERT(scriptExecutionContext());
Vector<CacheStorageRecord> newRecords;
Modified: trunk/Source/WebCore/Modules/cache/Cache.h (221111 => 221112)
--- trunk/Source/WebCore/Modules/cache/Cache.h 2017-08-23 22:24:30 UTC (rev 221111)
+++ trunk/Source/WebCore/Modules/cache/Cache.h 2017-08-23 22:33:15 UTC (rev 221112)
@@ -73,10 +73,10 @@
Vector<CacheStorageRecord> queryCacheWithTargetStorage(const FetchRequest&, const CacheQueryOptions&, const Vector<CacheStorageRecord>&);
void queryCache(Ref<FetchRequest>&&, CacheQueryOptions&&, WTF::Function<void(const Vector<CacheStorageRecord>&)>&&);
void batchDeleteOperation(const FetchRequest&, CacheQueryOptions&&, WTF::Function<void(ExceptionOr<bool>&&)>&&);
- void batchPutOperation(const FetchRequest&, FetchResponse&, CacheStorageConnection::ResponseBody&&, WTF::Function<void(ExceptionOr<void>&&)>&&);
- void batchPutOperation(Vector<CacheStorageConnection::Record>&&, WTF::Function<void(ExceptionOr<void>&&)>&&);
+ void batchPutOperation(const FetchRequest&, FetchResponse&, DOMCache::ResponseBody&&, WTF::Function<void(ExceptionOr<void>&&)>&&);
+ void batchPutOperation(Vector<DOMCache::Record>&&, WTF::Function<void(ExceptionOr<void>&&)>&&);
- void updateRecords(Vector<CacheStorageConnection::Record>&&);
+ void updateRecords(Vector<DOMCache::Record>&&);
String m_name;
uint64_t m_identifier;
Modified: trunk/Source/WebCore/Modules/cache/CacheStorage.cpp (221111 => 221112)
--- trunk/Source/WebCore/Modules/cache/CacheStorage.cpp 2017-08-23 22:24:30 UTC (rev 221111)
+++ trunk/Source/WebCore/Modules/cache/CacheStorage.cpp 2017-08-23 22:33:15 UTC (rev 221112)
@@ -31,6 +31,8 @@
#include "JSFetchResponse.h"
#include "ScriptExecutionContext.h"
+using namespace WebCore::DOMCache;
+
namespace WebCore {
CacheStorage::CacheStorage(ScriptExecutionContext& context, Ref<CacheStorageConnection>&& connection)
@@ -117,8 +119,16 @@
return;
setPendingActivity(this);
- m_connection->retrieveCaches(origin, [this, callback = WTFMove(callback)](Vector<CacheStorageConnection::CacheInfo>&& cachesInfo) {
+ m_connection->retrieveCaches(origin, [this, callback = WTFMove(callback)](CacheInfosOrError&& result) {
if (!m_isStopped) {
+ // FIXME: We should probably propagate that error up to the promise based operation.
+ ASSERT(result.hasValue());
+ if (!result.hasValue()) {
+ callback();
+ return;
+ }
+ auto& cachesInfo = result.value();
+
ASSERT(scriptExecutionContext());
m_caches.removeAllMatching([&](auto& cache) {
return cachesInfo.findMatching([&](const auto& info) { return info.identifier == cache->identifier(); }) == notFound;
@@ -152,13 +162,13 @@
ASSERT(!origin.isNull());
setPendingActivity(this);
- m_connection->open(origin, name, [this, name, promise = WTFMove(promise)](uint64_t cacheIdentifier, CacheStorageConnection::Error error) mutable {
+ m_connection->open(origin, name, [this, name, promise = WTFMove(promise)](const CacheIdentifierOrError& result) mutable {
if (!m_isStopped) {
- auto result = CacheStorageConnection::errorToException(error);
- if (result.hasException())
- promise.reject(result.releaseException());
+
+ if (!result.hasValue())
+ promise.reject(DOMCache::errorToException(result.error()));
else {
- auto cache = Cache::create(*scriptExecutionContext(), String { name }, cacheIdentifier, m_connection.copyRef());
+ auto cache = Cache::create(*scriptExecutionContext(), String { name }, result.value(), m_connection.copyRef());
promise.resolve(cache);
m_caches.append(WTFMove(cache));
}
@@ -181,11 +191,13 @@
ASSERT(!origin.isNull());
setPendingActivity(this);
- m_connection->remove(m_caches[position]->identifier(), [this, name, promise = WTFMove(promise)](uint64_t cacheIdentifier, CacheStorageConnection::Error error) mutable {
- UNUSED_PARAM(cacheIdentifier);
- if (!m_isStopped)
- promise.settle(CacheStorageConnection::exceptionOrResult(true, error));
-
+ m_connection->remove(m_caches[position]->identifier(), [this, name, promise = WTFMove(promise)](const CacheIdentifierOrError& result) mutable {
+ if (!m_isStopped) {
+ if (!result.hasValue())
+ promise.reject(DOMCache::errorToException(result.error()));
+ else
+ promise.resolve(true);
+ }
unsetPendingActivity(this);
});
m_caches.remove(position);
Modified: trunk/Source/WebCore/Modules/cache/CacheStorageConnection.cpp (221111 => 221112)
--- trunk/Source/WebCore/Modules/cache/CacheStorageConnection.cpp 2017-08-23 22:24:30 UTC (rev 221111)
+++ trunk/Source/WebCore/Modules/cache/CacheStorageConnection.cpp 2017-08-23 22:33:15 UTC (rev 221112)
@@ -27,59 +27,12 @@
#include "config.h"
#include "CacheStorageConnection.h"
-#include "CacheQueryOptions.h"
-#include "Exception.h"
-#include "HTTPParsers.h"
+using namespace WebCore::DOMCache;
namespace WebCore {
-ExceptionOr<void> CacheStorageConnection::errorToException(Error error)
+void CacheStorageConnection::open(const String& origin, const String& cacheName, CacheIdentifierCallback&& callback)
{
- switch (error) {
- case Error::None:
- return { };
- case Error::NotImplemented:
- return Exception { NotSupportedError, ASCIILiteral("Not implemented") };
- default:
- return Exception { NotSupportedError, ASCIILiteral("Internal error") };
- }
-}
-
-bool CacheStorageConnection::queryCacheMatch(const ResourceRequest& request, const ResourceRequest& cachedRequest, const ResourceResponse& cachedResponse, const CacheQueryOptions& options)
-{
- ASSERT(options.ignoreMethod || request.httpMethod() == "GET");
-
- URL requestURL = request.url();
- URL cachedRequestURL = cachedRequest.url();
-
- if (options.ignoreSearch) {
- requestURL.setQuery({ });
- cachedRequestURL.setQuery({ });
- }
- if (!equalIgnoringFragmentIdentifier(requestURL, cachedRequestURL))
- return false;
-
- if (options.ignoreVary)
- return true;
-
- String varyValue = cachedResponse.httpHeaderField(WebCore::HTTPHeaderName::Vary);
- if (varyValue.isNull())
- return true;
-
- // FIXME: This is inefficient, we should be able to split and trim whitespaces at the same time.
- Vector<String> varyHeaderNames;
- varyValue.split(',', false, varyHeaderNames);
- for (auto& name : varyHeaderNames) {
- if (stripLeadingAndTrailingHTTPSpaces(name) == "*")
- return false;
- if (cachedRequest.httpHeaderField(name) != request.httpHeaderField(name))
- return false;
- }
- return true;
-}
-
-void CacheStorageConnection::open(const String& origin, const String& cacheName, OpenRemoveCallback&& callback)
-{
uint64_t requestIdentifier = ++m_lastRequestIdentifier;
m_openAndRemoveCachePendingRequests.add(requestIdentifier, WTFMove(callback));
@@ -86,7 +39,7 @@
doOpen(requestIdentifier, origin, cacheName);
}
-void CacheStorageConnection::remove(uint64_t cacheIdentifier, OpenRemoveCallback&& callback)
+void CacheStorageConnection::remove(uint64_t cacheIdentifier, CacheIdentifierCallback&& callback)
{
uint64_t requestIdentifier = ++m_lastRequestIdentifier;
m_openAndRemoveCachePendingRequests.add(requestIdentifier, WTFMove(callback));
@@ -94,7 +47,7 @@
doRemove(requestIdentifier, cacheIdentifier);
}
-void CacheStorageConnection::retrieveCaches(const String& origin, CachesCallback&& callback)
+void CacheStorageConnection::retrieveCaches(const String& origin, CacheInfosCallback&& callback)
{
uint64_t requestIdentifier = ++m_lastRequestIdentifier;
m_retrieveCachesPendingRequests.add(requestIdentifier, WTFMove(callback));
@@ -110,7 +63,7 @@
doRetrieveRecords(requestIdentifier, cacheIdentifier);
}
-void CacheStorageConnection::batchDeleteOperation(uint64_t cacheIdentifier, const WebCore::ResourceRequest& request, WebCore::CacheQueryOptions&& options, BatchOperationCallback&& callback)
+void CacheStorageConnection::batchDeleteOperation(uint64_t cacheIdentifier, const ResourceRequest& request, CacheQueryOptions&& options, RecordIdentifiersCallback&& callback)
{
uint64_t requestIdentifier = ++m_lastRequestIdentifier;
m_batchDeleteAndPutPendingRequests.add(requestIdentifier, WTFMove(callback));
@@ -118,7 +71,7 @@
doBatchDeleteOperation(requestIdentifier, cacheIdentifier, request, WTFMove(options));
}
-void CacheStorageConnection::batchPutOperation(uint64_t cacheIdentifier, Vector<WebCore::CacheStorageConnection::Record>&& records, BatchOperationCallback&& callback)
+void CacheStorageConnection::batchPutOperation(uint64_t cacheIdentifier, Vector<Record>&& records, RecordIdentifiersCallback&& callback)
{
uint64_t requestIdentifier = ++m_lastRequestIdentifier;
m_batchDeleteAndPutPendingRequests.add(requestIdentifier, WTFMove(callback));
@@ -126,61 +79,34 @@
doBatchPutOperation(requestIdentifier, cacheIdentifier, WTFMove(records));
}
-void CacheStorageConnection::openOrRemoveCompleted(uint64_t requestIdentifier, uint64_t cacheIdentifier, Error error)
+void CacheStorageConnection::openOrRemoveCompleted(uint64_t requestIdentifier, const CacheIdentifierOrError& result)
{
if (auto callback = m_openAndRemoveCachePendingRequests.take(requestIdentifier))
- callback(cacheIdentifier, error);
+ callback(result);
}
-void CacheStorageConnection::updateCaches(uint64_t requestIdentifier, Vector<CacheInfo>&& caches)
+void CacheStorageConnection::updateCaches(uint64_t requestIdentifier, CacheInfosOrError&& result)
{
if (auto callback = m_retrieveCachesPendingRequests.take(requestIdentifier))
- callback(WTFMove(caches));
+ callback(WTFMove(result));
}
-void CacheStorageConnection::updateRecords(uint64_t requestIdentifier, Vector<Record>&& records)
+void CacheStorageConnection::updateRecords(uint64_t requestIdentifier, RecordsOrError&& result)
{
if (auto callback = m_retrieveRecordsPendingRequests.take(requestIdentifier))
- callback(WTFMove(records));
+ callback(WTFMove(result));
}
-void CacheStorageConnection::deleteRecordsCompleted(uint64_t requestIdentifier, Vector<uint64_t>&& records, Error error)
+void CacheStorageConnection::deleteRecordsCompleted(uint64_t requestIdentifier, Expected<Vector<uint64_t>, Error>&& result)
{
if (auto callback = m_batchDeleteAndPutPendingRequests.take(requestIdentifier))
- callback(WTFMove(records), error);
+ callback(WTFMove(result));
}
-void CacheStorageConnection::putRecordsCompleted(uint64_t requestIdentifier, Vector<uint64_t>&& records, Error error)
+void CacheStorageConnection::putRecordsCompleted(uint64_t requestIdentifier, Expected<Vector<uint64_t>, Error>&& result)
{
if (auto callback = m_batchDeleteAndPutPendingRequests.take(requestIdentifier))
- callback(WTFMove(records), error);
+ callback(WTFMove(result));
}
-CacheStorageConnection::ResponseBody CacheStorageConnection::isolatedResponseBody(const ResponseBody& body)
-{
- return WTF::switchOn(body, [](const Ref<FormData>& formData) {
- return formData->isolatedCopy();
- }, [](const Ref<SharedBuffer>& buffer) {
- return buffer->copy();
- }, [](const std::nullptr_t&) {
- return CacheStorageConnection::ResponseBody { };
- });
-}
-
-static inline CacheStorageConnection::ResponseBody copyResponseBody(const CacheStorageConnection::ResponseBody& body)
-{
- return WTF::switchOn(body, [](const Ref<FormData>& formData) {
- return formData.copyRef();
- }, [](const Ref<SharedBuffer>& buffer) {
- return buffer.copyRef();
- }, [](const std::nullptr_t&) {
- return CacheStorageConnection::ResponseBody { };
- });
-}
-
-CacheStorageConnection::Record CacheStorageConnection::Record::copy() const
-{
- return Record { identifier, updateResponseCounter, requestHeadersGuard, request, options, referrer, responseHeadersGuard, response, copyResponseBody(responseBody) };
-}
-
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/cache/CacheStorageConnection.h (221111 => 221112)
--- trunk/Source/WebCore/Modules/cache/CacheStorageConnection.h 2017-08-23 22:24:30 UTC (rev 221111)
+++ trunk/Source/WebCore/Modules/cache/CacheStorageConnection.h 2017-08-23 22:33:15 UTC (rev 221112)
@@ -26,106 +26,52 @@
#pragma once
-#include "FetchHeaders.h"
-#include "FetchOptions.h"
-#include "ResourceRequest.h"
-#include "ResourceResponse.h"
-#include "SharedBuffer.h"
+#include "DOMCache.h"
#include <wtf/HashMap.h>
#include <wtf/ThreadSafeRefCounted.h>
namespace WebCore {
-struct CacheQueryOptions;
-
class CacheStorageConnection : public ThreadSafeRefCounted<CacheStorageConnection> {
public:
static Ref<CacheStorageConnection> create() { return adoptRef(*new CacheStorageConnection()); }
virtual ~CacheStorageConnection() = default;
- enum class Error {
- None,
- NotImplemented,
- Internal
- };
+ void open(const String& origin, const String& cacheName, DOMCache::CacheIdentifierCallback&&);
+ void remove(uint64_t cacheIdentifier, DOMCache::CacheIdentifierCallback&&);
+ void retrieveCaches(const String& origin, DOMCache::CacheInfosCallback&&);
- static ExceptionOr<void> errorToException(Error);
- template<typename T> static ExceptionOr<T> exceptionOrResult(T&& value, Error error)
- {
- auto result = errorToException(error);
- if (result.hasException())
- return result.releaseException();
- return std::forward<T>(value);
- }
+ void retrieveRecords(uint64_t cacheIdentifier, DOMCache::RecordsCallback&&);
+ void batchDeleteOperation(uint64_t cacheIdentifier, const ResourceRequest&, CacheQueryOptions&&, DOMCache::RecordIdentifiersCallback&&);
+ void batchPutOperation(uint64_t cacheIdentifier, Vector<DOMCache::Record>&&, DOMCache::RecordIdentifiersCallback&&);
- WEBCORE_EXPORT static bool queryCacheMatch(const ResourceRequest& request, const ResourceRequest& cachedRequest, const ResourceResponse&, const CacheQueryOptions&);
-
- using ResponseBody = Variant<std::nullptr_t, Ref<FormData>, Ref<SharedBuffer>>;
- static ResponseBody isolatedResponseBody(const ResponseBody&);
-
- struct Record {
- WEBCORE_EXPORT Record copy() const;
-
- uint64_t identifier;
- uint64_t updateResponseCounter;
-
- FetchHeaders::Guard requestHeadersGuard;
- ResourceRequest request;
- FetchOptions options;
- String referrer;
-
- FetchHeaders::Guard responseHeadersGuard;
- ResourceResponse response;
- ResponseBody responseBody;
- };
-
- struct CacheInfo {
- uint64_t identifier;
- String name;
- };
-
- using OpenRemoveCallback = WTF::Function<void(uint64_t, Error)>;
- using CachesCallback = WTF::Function<void(Vector<CacheInfo>&&)>;
- using RecordsCallback = WTF::Function<void(Vector<Record>&&)>;
- using BatchOperationCallback = WTF::Function<void(Vector<uint64_t>&&, Error)>;
-
- void open(const String& /* origin */, const String& /* cacheName */, OpenRemoveCallback&&);
- void remove(uint64_t /* cacheIdentifier */, OpenRemoveCallback&&);
- void retrieveCaches(const String& /* origin */, CachesCallback&&);
-
- void retrieveRecords(uint64_t /* cacheIdentifier */, RecordsCallback&&);
- void batchDeleteOperation(uint64_t /* cacheIdentifier */, const ResourceRequest&, CacheQueryOptions&&, BatchOperationCallback&&);
- void batchPutOperation(uint64_t /* cacheIdentifier */, Vector<Record>&&, BatchOperationCallback&&);
-
protected:
CacheStorageConnection() = default;
- void openCompleted(uint64_t identifier, uint64_t cacheIdentifier, Error error) { openOrRemoveCompleted(identifier, cacheIdentifier, error); }
- void removeCompleted(uint64_t identifier, uint64_t cacheIdentifier, Error error) { openOrRemoveCompleted(identifier, cacheIdentifier, error); }
- WEBCORE_EXPORT void updateCaches(uint64_t requestIdentifier, Vector<CacheInfo>&&);
+ void openCompleted(uint64_t identifier, const DOMCache::CacheIdentifierOrError& result) { openOrRemoveCompleted(identifier, result); }
+ void removeCompleted(uint64_t identifier, const DOMCache::CacheIdentifierOrError& result) { openOrRemoveCompleted(identifier, result); }
+ WEBCORE_EXPORT void updateCaches(uint64_t requestIdentifier, DOMCache::CacheInfosOrError&&);
- WEBCORE_EXPORT void updateRecords(uint64_t requestIdentifier, Vector<Record>&&);
- WEBCORE_EXPORT void deleteRecordsCompleted(uint64_t requestIdentifier, Vector<uint64_t>&&, Error);
- WEBCORE_EXPORT void putRecordsCompleted(uint64_t requestIdentifier, Vector<uint64_t>&&, Error);
+ WEBCORE_EXPORT void updateRecords(uint64_t requestIdentifier, DOMCache::RecordsOrError&&);
+ WEBCORE_EXPORT void deleteRecordsCompleted(uint64_t requestIdentifier, DOMCache::RecordIdentifiersOrError&&);
+ WEBCORE_EXPORT void putRecordsCompleted(uint64_t requestIdentifier, DOMCache::RecordIdentifiersOrError&&);
private:
- virtual void doOpen(uint64_t requestIdentifier, const String& /* origin */, const String& /* cacheName */) { openCompleted(requestIdentifier, 0, Error::NotImplemented); }
- virtual void doRemove(uint64_t requestIdentifier, uint64_t /* cacheIdentifier */) { removeCompleted(requestIdentifier, 0, Error::NotImplemented); }
+ virtual void doOpen(uint64_t requestIdentifier, const String& /* origin */, const String& /* cacheName */) { openCompleted(requestIdentifier, makeUnexpected(DOMCache::Error::NotImplemented)); }
+ virtual void doRemove(uint64_t requestIdentifier, uint64_t /* cacheIdentifier */) { removeCompleted(requestIdentifier, makeUnexpected(DOMCache::Error::NotImplemented)); }
virtual void doRetrieveCaches(uint64_t requestIdentifier, const String& /* origin */) { updateCaches(requestIdentifier, { }); }
virtual void doRetrieveRecords(uint64_t requestIdentifier, uint64_t /* cacheIdentifier */) { updateRecords(requestIdentifier, { }); }
- virtual void doBatchDeleteOperation(uint64_t requestIdentifier, uint64_t /* cacheIdentifier */, const ResourceRequest&, CacheQueryOptions&&) { deleteRecordsCompleted(requestIdentifier, { }, Error::NotImplemented); }
- virtual void doBatchPutOperation(uint64_t requestIdentifier, uint64_t /* cacheIdentifier */, Vector<Record>&&) { putRecordsCompleted(requestIdentifier, { }, Error::NotImplemented); }
+ virtual void doBatchDeleteOperation(uint64_t requestIdentifier, uint64_t /* cacheIdentifier */, const ResourceRequest&, CacheQueryOptions&&) { deleteRecordsCompleted(requestIdentifier, makeUnexpected(DOMCache::Error::NotImplemented)); }
+ virtual void doBatchPutOperation(uint64_t requestIdentifier, uint64_t /* cacheIdentifier */, Vector<DOMCache::Record>&&) { putRecordsCompleted(requestIdentifier, makeUnexpected(DOMCache::Error::NotImplemented)); }
- WEBCORE_EXPORT void openOrRemoveCompleted(uint64_t requestIdentifier, uint64_t cacheIdentifier, Error);
+ WEBCORE_EXPORT void openOrRemoveCompleted(uint64_t requestIdentifier, const DOMCache::CacheIdentifierOrError&);
- HashMap<uint64_t, OpenRemoveCallback> m_openAndRemoveCachePendingRequests;
- HashMap<uint64_t, CachesCallback> m_retrieveCachesPendingRequests;
- HashMap<uint64_t, RecordsCallback> m_retrieveRecordsPendingRequests;
- HashMap<uint64_t, BatchOperationCallback> m_batchDeleteAndPutPendingRequests;
+ HashMap<uint64_t, DOMCache::CacheIdentifierCallback> m_openAndRemoveCachePendingRequests;
+ HashMap<uint64_t, DOMCache::CacheInfosCallback> m_retrieveCachesPendingRequests;
+ HashMap<uint64_t, DOMCache::RecordsCallback> m_retrieveRecordsPendingRequests;
+ HashMap<uint64_t, DOMCache::RecordIdentifiersCallback> m_batchDeleteAndPutPendingRequests;
uint64_t m_lastRequestIdentifier { 0 };
};
-
} // namespace WebCore
-
Added: trunk/Source/WebCore/Modules/cache/DOMCache.cpp (0 => 221112)
--- trunk/Source/WebCore/Modules/cache/DOMCache.cpp (rev 0)
+++ trunk/Source/WebCore/Modules/cache/DOMCache.cpp 2017-08-23 22:33:15 UTC (rev 221112)
@@ -0,0 +1,111 @@
+
+/*
+ * 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 "DOMCache.h"
+
+#include "CacheQueryOptions.h"
+#include "Exception.h"
+#include "HTTPParsers.h"
+
+namespace WebCore {
+
+namespace DOMCache {
+
+Exception errorToException(Error error)
+{
+ switch (error) {
+ case Error::NotImplemented:
+ return Exception { NotSupportedError, ASCIILiteral("Not implemented") };
+ default:
+ return Exception { TypeError, ASCIILiteral("Internal error") };
+ }
+}
+
+bool queryCacheMatch(const ResourceRequest& request, const ResourceRequest& cachedRequest, const ResourceResponse& cachedResponse, const CacheQueryOptions& options)
+{
+ ASSERT(options.ignoreMethod || request.httpMethod() == "GET");
+
+ URL requestURL = request.url();
+ URL cachedRequestURL = cachedRequest.url();
+
+ if (options.ignoreSearch) {
+ requestURL.setQuery({ });
+ cachedRequestURL.setQuery({ });
+ }
+ if (!equalIgnoringFragmentIdentifier(requestURL, cachedRequestURL))
+ return false;
+
+ if (options.ignoreVary)
+ return true;
+
+ String varyValue = cachedResponse.httpHeaderField(WebCore::HTTPHeaderName::Vary);
+ if (varyValue.isNull())
+ return true;
+
+ // FIXME: This is inefficient, we should be able to split and trim whitespaces at the same time.
+ Vector<String> varyHeaderNames;
+ varyValue.split(',', false, varyHeaderNames);
+ for (auto& name : varyHeaderNames) {
+ if (stripLeadingAndTrailingHTTPSpaces(name) == "*")
+ return false;
+ if (cachedRequest.httpHeaderField(name) != request.httpHeaderField(name))
+ return false;
+ }
+ return true;
+}
+
+ResponseBody isolatedResponseBody(const ResponseBody& body)
+{
+ return WTF::switchOn(body, [](const Ref<FormData>& formData) {
+ return formData->isolatedCopy();
+ }, [](const Ref<SharedBuffer>& buffer) {
+ return buffer->copy();
+ }, [](const std::nullptr_t&) {
+ return DOMCache::ResponseBody { };
+ });
+}
+
+static inline ResponseBody copyResponseBody(const DOMCache::ResponseBody& body)
+{
+ return WTF::switchOn(body, [](const Ref<FormData>& formData) {
+ return formData.copyRef();
+ }, [](const Ref<SharedBuffer>& buffer) {
+ return buffer.copyRef();
+ }, [](const std::nullptr_t&) {
+ return DOMCache::ResponseBody { };
+ });
+}
+
+Record Record::copy() const
+{
+ return Record { identifier, updateResponseCounter, requestHeadersGuard, request, options, referrer, responseHeadersGuard, response, copyResponseBody(responseBody) };
+}
+
+} // namespace DOMCache
+
+} // namespace WebCore
+
Copied: trunk/Source/WebCore/Modules/cache/DOMCache.h (from rev 221111, trunk/Source/WebKit/NetworkProcess/cache/CacheStorage.h) (0 => 221112)
--- trunk/Source/WebCore/Modules/cache/DOMCache.h (rev 0)
+++ trunk/Source/WebCore/Modules/cache/DOMCache.h 2017-08-23 22:33:15 UTC (rev 221112)
@@ -0,0 +1,100 @@
+
+/*
+ * 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 "FetchHeaders.h"
+#include "FetchOptions.h"
+#include "ResourceRequest.h"
+#include "ResourceResponse.h"
+#include "SharedBuffer.h"
+
+namespace WebCore {
+
+struct CacheQueryOptions;
+
+namespace DOMCache {
+
+enum class Error {
+ NotImplemented,
+ Internal
+};
+
+Exception errorToException(Error);
+
+WEBCORE_EXPORT bool queryCacheMatch(const ResourceRequest& request, const ResourceRequest& cachedRequest, const ResourceResponse&, const CacheQueryOptions&);
+
+using ResponseBody = Variant<std::nullptr_t, Ref<FormData>, Ref<SharedBuffer>>;
+ResponseBody isolatedResponseBody(const ResponseBody&);
+
+struct Record {
+ WEBCORE_EXPORT Record copy() const;
+
+ uint64_t identifier;
+ uint64_t updateResponseCounter;
+
+ FetchHeaders::Guard requestHeadersGuard;
+ ResourceRequest request;
+ FetchOptions options;
+ String referrer;
+
+ FetchHeaders::Guard responseHeadersGuard;
+ ResourceResponse response;
+ ResponseBody responseBody;
+};
+
+struct CacheInfo {
+ uint64_t identifier;
+ String name;
+};
+
+using CacheIdentifierOrError = Expected<uint64_t, Error>;
+using CacheIdentifierCallback = WTF::Function<void(const CacheIdentifierOrError&)>;
+
+using RecordIdentifiersOrError = Expected<Vector<uint64_t>, Error>;
+using RecordIdentifiersCallback = WTF::Function<void(RecordIdentifiersOrError&&)>;
+
+using CacheInfosOrError = Expected<Vector<WebCore::DOMCache::CacheInfo>, Error>;
+using CacheInfosCallback = WTF::Function<void(CacheInfosOrError&&)>;
+
+using RecordsOrError = Expected<Vector<Record>, Error>;
+using RecordsCallback = WTF::Function<void(RecordsOrError&&)>;
+
+using CompletionCallback = Function<void(std::optional<Error>&&)>;
+
+} // namespace DOMCache
+
+} // namespace WebCore
+
+namespace WTF {
+template<> struct EnumTraits<WebCore::DOMCache::Error> {
+ using values = EnumValues<
+ WebCore::DOMCache::Error,
+ WebCore::DOMCache::Error::NotImplemented,
+ WebCore::DOMCache::Error::Internal
+ >;
+};
+}
Modified: trunk/Source/WebCore/Modules/cache/WorkerCacheStorageConnection.cpp (221111 => 221112)
--- trunk/Source/WebCore/Modules/cache/WorkerCacheStorageConnection.cpp 2017-08-23 22:24:30 UTC (rev 221111)
+++ trunk/Source/WebCore/Modules/cache/WorkerCacheStorageConnection.cpp 2017-08-23 22:33:15 UTC (rev 221112)
@@ -36,6 +36,8 @@
#include "WorkerRunLoop.h"
#include "WorkerThread.h"
+using namespace WebCore::DOMCache;
+
namespace WebCore {
struct CrossThreadRecordData {
@@ -50,10 +52,10 @@
FetchHeaders::Guard responseHeadersGuard;
ResourceResponse::CrossThreadData response;
- CacheStorageConnection::ResponseBody responseBody;
+ ResponseBody responseBody;
};
-static CrossThreadRecordData toCrossThreadRecordData(const CacheStorageConnection::Record& record)
+static CrossThreadRecordData toCrossThreadRecordData(const Record& record)
{
return CrossThreadRecordData {
record.identifier,
@@ -64,13 +66,13 @@
record.referrer.isolatedCopy(),
record.responseHeadersGuard,
record.response.crossThreadData(),
- CacheStorageConnection::isolatedResponseBody(record.responseBody)
+ isolatedResponseBody(record.responseBody)
};
}
-static CacheStorageConnection::Record fromCrossThreadRecordData(CrossThreadRecordData&& data)
+static Record fromCrossThreadRecordData(CrossThreadRecordData&& data)
{
- return CacheStorageConnection::Record {
+ return Record {
data.identifier,
data.updateResponseCounter,
data.requestHeadersGuard,
@@ -115,10 +117,10 @@
ASSERT(isMainThread());
ASSERT(m_mainThreadConnection);
- m_mainThreadConnection->open(origin, cacheName, [this, protectedThis = WTFMove(protectedThis), requestIdentifier](uint64_t cacheIdentifier, Error error) mutable {
- m_proxy.postTaskForModeToWorkerGlobalScope([this, error, cacheIdentifier, protectedThis = WTFMove(protectedThis), requestIdentifier](ScriptExecutionContext& context) mutable {
+ m_mainThreadConnection->open(origin, cacheName, [this, protectedThis = WTFMove(protectedThis), requestIdentifier](const CacheIdentifierOrError& result) mutable {
+ m_proxy.postTaskForModeToWorkerGlobalScope([this, protectedThis = WTFMove(protectedThis), requestIdentifier, result](ScriptExecutionContext& context) mutable {
ASSERT_UNUSED(context, context.isWorkerGlobalScope());
- openCompleted(requestIdentifier, cacheIdentifier, error);
+ openCompleted(requestIdentifier, result);
}, m_taskMode);
});
});
@@ -130,11 +132,11 @@
ASSERT(isMainThread());
ASSERT(m_mainThreadConnection);
- m_mainThreadConnection->remove(cacheIdentifier, [this, protectedThis = WTFMove(protectedThis), requestIdentifier, cacheIdentifier](uint64_t removedCacheIdentifier, Error error) mutable {
- ASSERT_UNUSED(removedCacheIdentifier, removedCacheIdentifier == cacheIdentifier);
- m_proxy.postTaskForModeToWorkerGlobalScope([this, protectedThis = WTFMove(protectedThis), requestIdentifier, cacheIdentifier, error](ScriptExecutionContext& context) mutable {
+ m_mainThreadConnection->remove(cacheIdentifier, [this, protectedThis = WTFMove(protectedThis), requestIdentifier, cacheIdentifier](const CacheIdentifierOrError& result) mutable {
+ ASSERT(!result.hasValue() || result.value() == cacheIdentifier);
+ m_proxy.postTaskForModeToWorkerGlobalScope([this, protectedThis = WTFMove(protectedThis), requestIdentifier, result](ScriptExecutionContext& context) mutable {
ASSERT_UNUSED(context, context.isWorkerGlobalScope());
- removeCompleted(requestIdentifier, cacheIdentifier, error);
+ removeCompleted(requestIdentifier, result);
}, m_taskMode);
});
});
@@ -146,21 +148,26 @@
ASSERT(isMainThread());
ASSERT(m_mainThreadConnection);
- m_mainThreadConnection->retrieveCaches(origin, [this, protectedThis = WTFMove(protectedThis), requestIdentifier](const Vector<CacheInfo>& caches) mutable {
- Vector<CacheInfo> isolatedCaches;
- isolatedCaches.reserveInitialCapacity(caches.size());
- for (const auto& cache : caches)
- isolatedCaches.uncheckedAppend(CacheInfo { cache.identifier, cache.name.isolatedCopy() });
-
- m_proxy.postTaskForModeToWorkerGlobalScope([this, protectedThis = WTFMove(protectedThis), caches = WTFMove(isolatedCaches), requestIdentifier](ScriptExecutionContext& context) mutable {
+ m_mainThreadConnection->retrieveCaches(origin, [this, protectedThis = WTFMove(protectedThis), requestIdentifier](CacheInfosOrError&& result) mutable {
+ CacheInfosOrError isolatedResult;
+ if (!result.hasValue())
+ isolatedResult = WTFMove(result);
+ else {
+ Vector<CacheInfo> isolatedCaches;
+ isolatedCaches.reserveInitialCapacity(result.value().size());
+ for (const auto& cache : result.value())
+ isolatedCaches.uncheckedAppend(CacheInfo { cache.identifier, cache.name.isolatedCopy() });
+ isolatedResult = WTFMove(isolatedCaches);
+ }
+ m_proxy.postTaskForModeToWorkerGlobalScope([this, protectedThis = WTFMove(protectedThis), requestIdentifier, result = WTFMove(isolatedResult)](ScriptExecutionContext& context) mutable {
ASSERT_UNUSED(context, context.isWorkerGlobalScope());
- updateCaches(requestIdentifier, WTFMove(caches));
+ updateCaches(requestIdentifier, WTFMove(result));
}, m_taskMode);
});
});
}
-static inline Vector<CrossThreadRecordData> recordsDataFromRecords(const Vector<CacheStorageConnection::Record>& records)
+static inline Vector<CrossThreadRecordData> recordsDataFromRecords(const Vector<Record>& records)
{
Vector<CrossThreadRecordData> recordsData;
recordsData.reserveInitialCapacity(records.size());
@@ -169,9 +176,17 @@
return recordsData;
}
-static inline Vector<CacheStorageConnection::Record> recordsFromRecordsData(Vector<CrossThreadRecordData>&& recordsData)
+static inline Expected<Vector<CrossThreadRecordData>, Error> recordsDataOrErrorFromRecords(const RecordsOrError& result)
{
- Vector<CacheStorageConnection::Record> records;
+ if (!result.hasValue())
+ return makeUnexpected(result.error());
+
+ return recordsDataFromRecords(result.value());
+}
+
+static inline Vector<Record> recordsFromRecordsData(Vector<CrossThreadRecordData>&& recordsData)
+{
+ Vector<Record> records;
records.reserveInitialCapacity(recordsData.size());
for (auto& recordData : recordsData)
records.uncheckedAppend(fromCrossThreadRecordData(WTFMove(recordData)));
@@ -178,6 +193,13 @@
return records;
}
+static inline RecordsOrError recordsOrErrorFromRecordsData(Expected<Vector<CrossThreadRecordData>, Error>&& recordsData)
+{
+ if (!recordsData.hasValue())
+ return makeUnexpected(recordsData.error());
+ return recordsFromRecordsData(WTFMove(recordsData.value()));
+}
+
void WorkerCacheStorageConnection::doRetrieveRecords(uint64_t requestIdentifier, uint64_t cacheIdentifier)
{
m_proxy.postTaskToLoader([this, protectedThis = makeRef(*this), requestIdentifier, cacheIdentifier](ScriptExecutionContext&) mutable {
@@ -184,10 +206,10 @@
ASSERT(isMainThread());
ASSERT(m_mainThreadConnection);
- m_mainThreadConnection->retrieveRecords(cacheIdentifier, [this, protectedThis = WTFMove(protectedThis), requestIdentifier](Vector<Record>&& records) mutable {
- m_proxy.postTaskForModeToWorkerGlobalScope([this, protectedThis = WTFMove(protectedThis), recordsData = recordsDataFromRecords(records), requestIdentifier](ScriptExecutionContext& context) mutable {
+ m_mainThreadConnection->retrieveRecords(cacheIdentifier, [this, protectedThis = WTFMove(protectedThis), requestIdentifier](RecordsOrError&& result) mutable {
+ m_proxy.postTaskForModeToWorkerGlobalScope([this, protectedThis = WTFMove(protectedThis), result = recordsDataOrErrorFromRecords(result), requestIdentifier](ScriptExecutionContext& context) mutable {
ASSERT_UNUSED(context, context.isWorkerGlobalScope());
- updateRecords(requestIdentifier, recordsFromRecordsData(WTFMove(recordsData)));
+ updateRecords(requestIdentifier, recordsOrErrorFromRecordsData(WTFMove(result)));
}, m_taskMode);
});
});
@@ -199,11 +221,11 @@
ASSERT(isMainThread());
ASSERT(m_mainThreadConnection);
- m_mainThreadConnection->batchDeleteOperation(cacheIdentifier, request, WTFMove(options), [this, protectedThis = WTFMove(protectedThis), requestIdentifier](Vector<uint64_t>&& records, Error error) mutable {
+ m_mainThreadConnection->batchDeleteOperation(cacheIdentifier, request, WTFMove(options), [this, protectedThis = WTFMove(protectedThis), requestIdentifier](RecordIdentifiersOrError&& result) mutable {
- m_proxy.postTaskForModeToWorkerGlobalScope([this, protectedThis = WTFMove(protectedThis), records = WTFMove(records), error, requestIdentifier](ScriptExecutionContext& context) mutable {
+ m_proxy.postTaskForModeToWorkerGlobalScope([this, protectedThis = WTFMove(protectedThis), requestIdentifier, result = WTFMove(result)](ScriptExecutionContext& context) mutable {
ASSERT_UNUSED(context, context.isWorkerGlobalScope());
- deleteRecordsCompleted(requestIdentifier, WTFMove(records), error);
+ deleteRecordsCompleted(requestIdentifier, WTFMove(result));
}, m_taskMode);
});
});
@@ -215,11 +237,11 @@
ASSERT(isMainThread());
ASSERT(m_mainThreadConnection);
- m_mainThreadConnection->batchPutOperation(cacheIdentifier, recordsFromRecordsData(WTFMove(recordsData)), [this, protectedThis = WTFMove(protectedThis), requestIdentifier](Vector<uint64_t>&& records, Error error) mutable {
+ m_mainThreadConnection->batchPutOperation(cacheIdentifier, recordsFromRecordsData(WTFMove(recordsData)), [this, protectedThis = WTFMove(protectedThis), requestIdentifier](RecordIdentifiersOrError&& result) mutable {
- m_proxy.postTaskForModeToWorkerGlobalScope([this, protectedThis = WTFMove(protectedThis), records = WTFMove(records), error, requestIdentifier](ScriptExecutionContext& context) mutable {
+ m_proxy.postTaskForModeToWorkerGlobalScope([this, protectedThis = WTFMove(protectedThis), requestIdentifier, result = WTFMove(result)](ScriptExecutionContext& context) mutable {
ASSERT_UNUSED(context, context.isWorkerGlobalScope());
- putRecordsCompleted(requestIdentifier, WTFMove(records), error);
+ putRecordsCompleted(requestIdentifier, WTFMove(result));
}, m_taskMode);
});
});
Modified: trunk/Source/WebCore/Modules/cache/WorkerCacheStorageConnection.h (221111 => 221112)
--- trunk/Source/WebCore/Modules/cache/WorkerCacheStorageConnection.h 2017-08-23 22:24:30 UTC (rev 221111)
+++ trunk/Source/WebCore/Modules/cache/WorkerCacheStorageConnection.h 2017-08-23 22:33:15 UTC (rev 221112)
@@ -42,13 +42,13 @@
explicit WorkerCacheStorageConnection(WorkerGlobalScope&);
// WebCore::CacheStorageConnection
- void doOpen(uint64_t requestIdentifier, const String& /* origin */, const String& /* cacheName */) final;
- void doRemove(uint64_t requestIdentifier, uint64_t /* cacheIdentifier */) final;
- void doRetrieveCaches(uint64_t requestIdentifier, const String& /* origin */) final;
+ void doOpen(uint64_t requestIdentifier, const String& origin, const String& cacheName) final;
+ void doRemove(uint64_t requestIdentifier, uint64_t cacheIdentifier) final;
+ void doRetrieveCaches(uint64_t requestIdentifier, const String& origin) final;
void doRetrieveRecords(uint64_t requestIdentifier, uint64_t cacheIdentifier) final;
void doBatchDeleteOperation(uint64_t requestIdentifier, uint64_t cacheIdentifier, const WebCore::ResourceRequest&, WebCore::CacheQueryOptions&&) final;
- void doBatchPutOperation(uint64_t requestIdentifier, uint64_t cacheIdentifier, Vector<Record>&&) final;
+ void doBatchPutOperation(uint64_t requestIdentifier, uint64_t cacheIdentifier, Vector<DOMCache::Record>&&) final;
WorkerGlobalScope& m_scope;
WorkerLoaderProxy& m_proxy;
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (221111 => 221112)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-08-23 22:24:30 UTC (rev 221111)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-08-23 22:33:15 UTC (rev 221112)
@@ -1792,6 +1792,8 @@
41F54F8E1C50C50C00338488 /* FetchRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41F54F871C50C4F600338488 /* FetchRequest.cpp */; };
41FA303E1316C29C00C0BFC5 /* RenderMediaControls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41FA303C1316C29C00C0BFC5 /* RenderMediaControls.cpp */; };
41FA303F1316C29C00C0BFC5 /* RenderMediaControls.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FA303D1316C29C00C0BFC5 /* RenderMediaControls.h */; };
+ 41FABD2D1F4DFE4A006A6C97 /* DOMCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FABD2B1F4DFE42006A6C97 /* DOMCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 41FABD2F1F4E02CB006A6C97 /* DOMCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41FABD2E1F4E0251006A6C97 /* DOMCache.cpp */; };
41FB279C1F34DB8A00795487 /* DOMWindowCaches.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41FB278E1F34C28200795487 /* DOMWindowCaches.cpp */; };
41FB279D1F34DB8E00795487 /* WorkerGlobalScopeCaches.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41FB278F1F34C28200795487 /* WorkerGlobalScopeCaches.cpp */; };
43107BE218CC19DE00CC18E8 /* SelectorPseudoTypeMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 43107BE118CC19DE00CC18E8 /* SelectorPseudoTypeMap.h */; };
@@ -9479,6 +9481,8 @@
41F54F891C50C4F600338488 /* FetchRequest.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FetchRequest.idl; sourceTree = "<group>"; };
41FA303C1316C29C00C0BFC5 /* RenderMediaControls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMediaControls.cpp; sourceTree = "<group>"; };
41FA303D1316C29C00C0BFC5 /* RenderMediaControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMediaControls.h; sourceTree = "<group>"; };
+ 41FABD2B1F4DFE42006A6C97 /* DOMCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMCache.h; sourceTree = "<group>"; };
+ 41FABD2E1F4E0251006A6C97 /* DOMCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMCache.cpp; sourceTree = "<group>"; };
41FB278C1F34C28200795487 /* DOMWindowCaches.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DOMWindowCaches.h; sourceTree = "<group>"; };
41FB278D1F34C28200795487 /* WorkerGlobalScopeCaches.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WorkerGlobalScopeCaches.h; sourceTree = "<group>"; };
41FB278E1F34C28200795487 /* DOMWindowCaches.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowCaches.cpp; sourceTree = "<group>"; };
@@ -17690,6 +17694,8 @@
41D129C91F3D0EE300D15E47 /* CacheStorageConnection.cpp */,
41D129CC1F3D0EE300D15E47 /* CacheStorageConnection.h */,
41D129CA1F3D0EE300D15E47 /* CacheStorageRecord.h */,
+ 41FABD2E1F4E0251006A6C97 /* DOMCache.cpp */,
+ 41FABD2B1F4DFE42006A6C97 /* DOMCache.h */,
41FB278E1F34C28200795487 /* DOMWindowCaches.cpp */,
41FB278C1F34C28200795487 /* DOMWindowCaches.h */,
41380C2B1F343E2F00155FDA /* DOMWindowCaches.idl */,
@@ -27231,6 +27237,7 @@
A8185F3909765766005826D9 /* DocumentType.h in Headers */,
973889A1116EA9DC00ADF313 /* DocumentWriter.h in Headers */,
1A8F6BC30DB55CDC001DB794 /* DOMApplicationCache.h in Headers */,
+ 41FABD2D1F4DFE4A006A6C97 /* DOMCache.h in Headers */,
FC9A0F75164094CF003D6B8D /* DOMCSSNamespace.h in Headers */,
9B3A8872145632F9003AE8F5 /* DOMDOMSettableTokenList.h in Headers */,
7AABA25A14BC613300AA9A11 /* DOMEditor.h in Headers */,
@@ -31263,6 +31270,7 @@
A8185F3A09765766005826D9 /* DocumentType.cpp in Sources */,
973889A0116EA9DC00ADF313 /* DocumentWriter.cpp in Sources */,
1A8F6BC20DB55CDC001DB794 /* DOMApplicationCache.cpp in Sources */,
+ 41FABD2F1F4E02CB006A6C97 /* DOMCache.cpp in Sources */,
FD677738195CAF3D0072E0D3 /* DOMCSSNamespace.cpp in Sources */,
7AABA25914BC613300AA9A11 /* DOMEditor.cpp in Sources */,
BC1BDF24156C1883001C1243 /* DOMError.cpp in Sources */,
Modified: trunk/Source/WebKit/ChangeLog (221111 => 221112)
--- trunk/Source/WebKit/ChangeLog 2017-08-23 22:24:30 UTC (rev 221111)
+++ trunk/Source/WebKit/ChangeLog 2017-08-23 22:33:15 UTC (rev 221112)
@@ -1,3 +1,42 @@
+2017-08-23 Youenn Fablet <[email protected]>
+
+ [Cache API] Unify WebCore and WebKit error handling
+ https://bugs.webkit.org/show_bug.cgi?id=175902
+
+ Reviewed by Alex Christensen.
+
+ Removing all callbacks and error definitions from WebKit
+ and reusing DOMCache ones instead.
+
+ * NetworkProcess/cache/CacheStorage.h: Removed.
+ * NetworkProcess/cache/CacheStorageEngine.cpp:
+ (WebKit::CacheStorage::Engine::caches const):
+ (WebKit::CacheStorage::Engine::queryCache):
+ * NetworkProcess/cache/CacheStorageEngine.h:
+ * NetworkProcess/cache/CacheStorageEngineCache.h:
+ * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
+ (WebKit::CacheStorageEngineConnection::open):
+ (WebKit::CacheStorageEngineConnection::remove):
+ (WebKit::CacheStorageEngineConnection::putRecords):
+ * NetworkProcess/cache/CacheStorageEngineConnection.h:
+ * NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
+ * Shared/WebCoreArgumentCoders.cpp:
+ (IPC::ArgumentCoder<DOMCache::CacheInfo>::encode):
+ (IPC::ArgumentCoder<DOMCache::CacheInfo>::decode):
+ (IPC::ArgumentCoder<DOMCache::Record>::encode):
+ (IPC::ArgumentCoder<DOMCache::Record>::decode):
+ * Shared/WebCoreArgumentCoders.h:
+ * WebProcess/Cache/WebCacheStorageConnection.cpp:
+ (WebKit::WebCacheStorageConnection::doBatchPutOperation):
+ (WebKit::WebCacheStorageConnection::openCompleted):
+ (WebKit::WebCacheStorageConnection::removeCompleted):
+ (WebKit::WebCacheStorageConnection::updateCaches):
+ (WebKit::WebCacheStorageConnection::updateRecords):
+ (WebKit::WebCacheStorageConnection::deleteRecordsCompleted):
+ (WebKit::WebCacheStorageConnection::putRecordsCompleted):
+ * WebProcess/Cache/WebCacheStorageConnection.h:
+ * WebProcess/Cache/WebCacheStorageConnection.messages.in:
+
2017-08-23 Alex Christensen <[email protected]>
Clean up UIClients
Deleted: trunk/Source/WebKit/NetworkProcess/cache/CacheStorage.h (221111 => 221112)
--- trunk/Source/WebKit/NetworkProcess/cache/CacheStorage.h 2017-08-23 22:24:30 UTC (rev 221111)
+++ trunk/Source/WebKit/NetworkProcess/cache/CacheStorage.h 2017-08-23 22:33:15 UTC (rev 221112)
@@ -1,67 +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 "WebCoreArgumentCoders.h"
-#include <WebCore/CacheStorageConnection.h>
-#include <wtf/EnumTraits.h>
-
-namespace WebKit {
-
-namespace CacheStorage {
-
-enum class Error {
- Internal
-};
-
-using Record = WebCore::CacheStorageConnection::Record;
-
-using CacheIdentifierOrError = Expected<uint64_t, Error>;
-using CacheIdentifierCallback = Function<void(CacheIdentifierOrError&&)>;
-
-using CacheInfosOrError = Expected<Vector<WebCore::CacheStorageConnection::CacheInfo>, Error>;
-using CacheInfosCallback = Function<void(CacheInfosOrError&&)>;
-
-using RecordsOrError = Expected<Vector<Record>, Error>;
-using RecordsCallback = Function<void(RecordsOrError&&)>;
-
-using RecordIdentifiersOrError = Expected<Vector<uint64_t>, Error>;
-using RecordIdentifiersCallback = Function<void(RecordIdentifiersOrError&&)>;
-
-using CompletionCallback = Function<void(std::optional<Error>&&)>;
-
-} // namespace CacheStorage
-
-} // namespace WebKit
-
-namespace WTF {
-template<> struct EnumTraits<WebKit::CacheStorage::Error> {
- using values = EnumValues<
- WebKit::CacheStorage::Error,
- WebKit::CacheStorage::Error::Internal
- >;
-};
-}
Modified: trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp (221111 => 221112)
--- trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp 2017-08-23 22:24:30 UTC (rev 221111)
+++ trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp 2017-08-23 22:33:15 UTC (rev 221112)
@@ -32,6 +32,8 @@
#include <wtf/NeverDestroyed.h>
#include <wtf/text/StringHash.h>
+using namespace WebCore::DOMCache;
+
namespace WebKit {
namespace CacheStorage {
@@ -126,10 +128,10 @@
auto& caches = cachesOrError.value().get();
- Vector<WebCore::CacheStorageConnection::CacheInfo> cachesInfo;
+ Vector<CacheInfo> cachesInfo;
cachesInfo.reserveInitialCapacity(caches.size());
for (auto& cache : caches)
- cachesInfo.uncheckedAppend(WebCore::CacheStorageConnection::CacheInfo { cache.identifier, cache.name});
+ cachesInfo.uncheckedAppend(CacheInfo { cache.identifier, cache.name});
callback(WTFMove(cachesInfo));
});
@@ -297,7 +299,7 @@
Vector<uint64_t> results;
for (const auto& record : records) {
- if (WebCore::CacheStorageConnection::queryCacheMatch(request, record.request, record.response, options))
+ if (WebCore::DOMCache::queryCacheMatch(request, record.request, record.response, options))
results.append(record.identifier);
}
return results;
Modified: trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.h (221111 => 221112)
--- trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.h 2017-08-23 22:24:30 UTC (rev 221111)
+++ trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.h 2017-08-23 22:33:15 UTC (rev 221112)
@@ -45,32 +45,32 @@
static Engine& from(PAL::SessionID);
static void destroyEngine(PAL::SessionID);
- void open(const String& origin, const String& cacheName, CacheIdentifierCallback&&);
- void remove(uint64_t cacheIdentifier, CacheIdentifierCallback&&);
- void retrieveCaches(const String& origin, CacheInfosCallback&&);
+ void open(const String& origin, const String& cacheName, WebCore::DOMCache::CacheIdentifierCallback&&);
+ void remove(uint64_t cacheIdentifier, WebCore::DOMCache::CacheIdentifierCallback&&);
+ void retrieveCaches(const String& origin, WebCore::DOMCache::CacheInfosCallback&&);
- void retrieveRecords(uint64_t cacheIdentifier, RecordsCallback&&);
- void putRecords(uint64_t cacheIdentifier, Vector<Record>&&, RecordIdentifiersCallback&&);
- void deleteMatchingRecords(uint64_t cacheIdentifier, WebCore::ResourceRequest&&, WebCore::CacheQueryOptions&&, RecordIdentifiersCallback&&);
+ void retrieveRecords(uint64_t cacheIdentifier, WebCore::DOMCache::RecordsCallback&&);
+ void putRecords(uint64_t cacheIdentifier, Vector<WebCore::DOMCache::Record>&&, WebCore::DOMCache::RecordIdentifiersCallback&&);
+ void deleteMatchingRecords(uint64_t cacheIdentifier, WebCore::ResourceRequest&&, WebCore::CacheQueryOptions&&, WebCore::DOMCache::RecordIdentifiersCallback&&);
private:
static Engine& defaultEngine();
- void writeCachesToDisk(CompletionCallback&&);
+ void writeCachesToDisk(WebCore::DOMCache::CompletionCallback&&);
- using CachesOrError = Expected<std::reference_wrapper<Vector<Cache>>, Error>;
- using CachesCallback = Function<void(CachesOrError&&)>;
- void readCachesFromDisk(const String& origin, Function<void(CachesOrError&&)>&&);
+ using CachesOrError = Expected<std::reference_wrapper<Vector<Cache>>, WebCore::DOMCache::Error>;
+ using CachesCallback = WTF::Function<void(CachesOrError&&)>;
+ void readCachesFromDisk(const String& origin, CachesCallback&&);
- using CacheOrError = Expected<std::reference_wrapper<Cache>, Error>;
- using CacheCallback = Function<void(CacheOrError&&)>;
-
+ using CacheOrError = Expected<std::reference_wrapper<Cache>, WebCore::DOMCache::Error>;
+ using CacheCallback = WTF::Function<void(CacheOrError&&)>;
void readCache(uint64_t cacheIdentifier, CacheCallback&&);
- void writeCacheRecords(uint64_t cacheIdentifier, Vector<uint64_t>&&, RecordIdentifiersCallback&&);
- void removeCacheRecords(uint64_t cacheIdentifier, Vector<uint64_t>&&, RecordIdentifiersCallback&&);
- Vector<uint64_t> queryCache(const Vector<Record>&, const WebCore::ResourceRequest&, const WebCore::CacheQueryOptions&);
+ void writeCacheRecords(uint64_t cacheIdentifier, Vector<uint64_t>&&, WebCore::DOMCache::RecordIdentifiersCallback&&);
+ void removeCacheRecords(uint64_t cacheIdentifier, Vector<uint64_t>&&, WebCore::DOMCache::RecordIdentifiersCallback&&);
+ Vector<uint64_t> queryCache(const Vector<WebCore::DOMCache::Record>&, const WebCore::ResourceRequest&, const WebCore::CacheQueryOptions&);
+
Cache* cache(uint64_t cacheIdentifier);
HashMap<String, Vector<Cache>> m_caches;
Modified: trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.h (221111 => 221112)
--- trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.h 2017-08-23 22:24:30 UTC (rev 221111)
+++ trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.h 2017-08-23 22:33:15 UTC (rev 221112)
@@ -25,7 +25,7 @@
#pragma once
-#include "CacheStorage.h"
+#include <WebCore/DOMCache.h>
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
@@ -36,7 +36,7 @@
struct Cache {
uint64_t identifier { 0 };
String name;
- Vector<Record> records;
+ Vector<WebCore::DOMCache::Record> records;
uint64_t nextRecordIdentifier { 0 };
};
Modified: trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineConnection.cpp (221111 => 221112)
--- trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineConnection.cpp 2017-08-23 22:24:30 UTC (rev 221111)
+++ trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineConnection.cpp 2017-08-23 22:33:15 UTC (rev 221112)
@@ -29,8 +29,10 @@
#include "NetworkConnectionToWebProcess.h"
#include "WebCacheStorageConnectionMessages.h"
+#include "WebCoreArgumentCoders.h"
#include <WebCore/CacheQueryOptions.h>
+using namespace WebCore::DOMCache;
using namespace WebKit::CacheStorage;
namespace WebKit {
@@ -42,7 +44,7 @@
void CacheStorageEngineConnection::open(PAL::SessionID sessionID, uint64_t requestIdentifier, const String& origin, const String& cacheName)
{
- Engine::from(sessionID).open(origin, cacheName, [protectedThis = makeRef(*this), this, sessionID, requestIdentifier](CacheIdentifierOrError&& result) {
+ Engine::from(sessionID).open(origin, cacheName, [protectedThis = makeRef(*this), this, sessionID, requestIdentifier](const CacheIdentifierOrError& result) {
m_connection.connection().send(Messages::WebCacheStorageConnection::OpenCompleted(requestIdentifier, result), sessionID.sessionID());
});
}
@@ -49,7 +51,7 @@
void CacheStorageEngineConnection::remove(PAL::SessionID sessionID, uint64_t requestIdentifier, uint64_t cacheIdentifier)
{
- Engine::from(sessionID).remove(cacheIdentifier, [protectedThis = makeRef(*this), this, sessionID, requestIdentifier](CacheIdentifierOrError&& result) {
+ Engine::from(sessionID).remove(cacheIdentifier, [protectedThis = makeRef(*this), this, sessionID, requestIdentifier](const CacheIdentifierOrError& result) {
m_connection.connection().send(Messages::WebCacheStorageConnection::RemoveCompleted(requestIdentifier, result), sessionID.sessionID());
});
}
@@ -75,7 +77,7 @@
});
}
-void CacheStorageEngineConnection::putRecords(PAL::SessionID sessionID, uint64_t requestIdentifier, uint64_t cacheIdentifier, Vector<WebCore::CacheStorageConnection::Record>&& records)
+void CacheStorageEngineConnection::putRecords(PAL::SessionID sessionID, uint64_t requestIdentifier, uint64_t cacheIdentifier, Vector<Record>&& records)
{
Engine::from(sessionID).putRecords(cacheIdentifier, WTFMove(records), [protectedThis = makeRef(*this), this, sessionID, requestIdentifier](RecordIdentifiersOrError&& result) {
m_connection.connection().send(Messages::WebCacheStorageConnection::PutRecordsCompleted(requestIdentifier, result), sessionID.sessionID());
Modified: trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineConnection.h (221111 => 221112)
--- trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineConnection.h 2017-08-23 22:24:30 UTC (rev 221111)
+++ trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineConnection.h 2017-08-23 22:33:15 UTC (rev 221112)
@@ -56,7 +56,7 @@
void records(PAL::SessionID, uint64_t requestIdentifier, uint64_t cacheIdentifier);
void deleteMatchingRecords(PAL::SessionID, uint64_t requestIdentifier, uint64_t cacheIdentifier, WebCore::ResourceRequest&&, WebCore::CacheQueryOptions&&);
- void putRecords(PAL::SessionID, uint64_t requestIdentifier, uint64_t cacheIdentifier, Vector<WebCore::CacheStorageConnection::Record>&&);
+ void putRecords(PAL::SessionID, uint64_t requestIdentifier, uint64_t cacheIdentifier, Vector<WebCore::DOMCache::Record>&&);
NetworkConnectionToWebProcess& m_connection;
};
Modified: trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineConnection.messages.in (221111 => 221112)
--- trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineConnection.messages.in 2017-08-23 22:24:30 UTC (rev 221111)
+++ trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineConnection.messages.in 2017-08-23 22:33:15 UTC (rev 221112)
@@ -27,5 +27,5 @@
Records(PAL::SessionID sessionID, uint64_t requestIdentifier, uint64_t cacheIdentifier);
DeleteMatchingRecords(PAL::SessionID sessionID, uint64_t requestIdentifier, uint64_t cacheIdentifier, WebCore::ResourceRequest request, struct WebCore::CacheQueryOptions options);
- PutRecords(PAL::SessionID sessionID, uint64_t requestIdentifier, uint64_t cacheIdentifier, Vector<WebCore::CacheStorageConnection::Record> record);
+ PutRecords(PAL::SessionID sessionID, uint64_t requestIdentifier, uint64_t cacheIdentifier, Vector<WebCore::DOMCache::Record> record);
}
Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp (221111 => 221112)
--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp 2017-08-23 22:24:30 UTC (rev 221111)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp 2017-08-23 22:33:15 UTC (rev 221112)
@@ -214,13 +214,13 @@
return true;
}
-void ArgumentCoder<CacheStorageConnection::CacheInfo>::encode(Encoder& encoder, const CacheStorageConnection::CacheInfo& info)
+void ArgumentCoder<DOMCache::CacheInfo>::encode(Encoder& encoder, const DOMCache::CacheInfo& info)
{
encoder << info.identifier;
encoder << info.name;
}
-bool ArgumentCoder<CacheStorageConnection::CacheInfo>::decode(Decoder& decoder, CacheStorageConnection::CacheInfo& record)
+bool ArgumentCoder<DOMCache::CacheInfo>::decode(Decoder& decoder, DOMCache::CacheInfo& record)
{
uint64_t identifier;
if (!decoder.decode(identifier))
@@ -236,7 +236,7 @@
return true;
}
-void ArgumentCoder<CacheStorageConnection::Record>::encode(Encoder& encoder, const CacheStorageConnection::Record& record)
+void ArgumentCoder<DOMCache::Record>::encode(Encoder& encoder, const DOMCache::Record& record)
{
encoder << record.identifier;
@@ -262,7 +262,7 @@
});
}
-bool ArgumentCoder<CacheStorageConnection::Record>::decode(Decoder& decoder, CacheStorageConnection::Record& record)
+bool ArgumentCoder<DOMCache::Record>::decode(Decoder& decoder, DOMCache::Record& record)
{
uint64_t identifier;
if (!decoder.decode(identifier))
@@ -296,7 +296,7 @@
if (!decoder.decode(updateResponseCounter))
return false;
- WebCore::CacheStorageConnection::ResponseBody responseBody;
+ WebCore::DOMCache::ResponseBody responseBody;
bool hasSharedBufferBody;
if (!decoder.decode(hasSharedBufferBody))
return false;
Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h (221111 => 221112)
--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h 2017-08-23 22:24:30 UTC (rev 221111)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h 2017-08-23 22:33:15 UTC (rev 221112)
@@ -200,14 +200,14 @@
static bool decode(Decoder&, WebCore::CacheQueryOptions&);
};
-template<> struct ArgumentCoder<WebCore::CacheStorageConnection::CacheInfo> {
- static void encode(Encoder&, const WebCore::CacheStorageConnection::CacheInfo&);
- static bool decode(Decoder&, WebCore::CacheStorageConnection::CacheInfo&);
+template<> struct ArgumentCoder<WebCore::DOMCache::CacheInfo> {
+ static void encode(Encoder&, const WebCore::DOMCache::CacheInfo&);
+ static bool decode(Decoder&, WebCore::DOMCache::CacheInfo&);
};
-template<> struct ArgumentCoder<WebCore::CacheStorageConnection::Record> {
- static void encode(Encoder&, const WebCore::CacheStorageConnection::Record&);
- static bool decode(Decoder&, WebCore::CacheStorageConnection::Record&);
+template<> struct ArgumentCoder<WebCore::DOMCache::Record> {
+ static void encode(Encoder&, const WebCore::DOMCache::Record&);
+ static bool decode(Decoder&, WebCore::DOMCache::Record&);
};
template<> struct ArgumentCoder<WebCore::EventTrackingRegions> {
@@ -786,12 +786,4 @@
>;
};
-template<> struct EnumTraits<WebCore::CacheStorageConnection::Error> {
- using values = EnumValues<
- WebCore::CacheStorageConnection::Error,
- WebCore::CacheStorageConnection::Error::None,
- WebCore::CacheStorageConnection::Error::NotImplemented
- >;
-};
-
} // namespace WTF
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (221111 => 221112)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2017-08-23 22:24:30 UTC (rev 221111)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2017-08-23 22:33:15 UTC (rev 221112)
@@ -906,7 +906,6 @@
41DC459E1E3DBDA100B11F51 /* WebRTCSocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41DC459D1E3DBCF000B11F51 /* WebRTCSocket.cpp */; };
41DC459F1E3DBDA500B11F51 /* WebRTCSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FAF5F31E3BFE7F001AE678 /* WebRTCSocket.h */; };
41DC45A11E3DC53F00B11F51 /* WebRTCResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41DC45A01E3DC53C00B11F51 /* WebRTCResolver.cpp */; };
- 41FABD291F4DE001006A6C97 /* CacheStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FABD271F4DDFDC006A6C97 /* CacheStorage.h */; };
41FABD2A1F4DE001006A6C97 /* CacheStorageEngineCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FABD281F4DDFDC006A6C97 /* CacheStorageEngineCache.h */; };
41FAF5F51E3C0649001AE678 /* WebRTCResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FAF5F41E3C0641001AE678 /* WebRTCResolver.h */; };
41FAF5F81E3C1021001AE678 /* LibWebRTCResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FAF5F61E3C0B47001AE678 /* LibWebRTCResolver.h */; };
@@ -3179,7 +3178,6 @@
41DC459A1E3DBB2400B11F51 /* LibWebRTCSocketClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LibWebRTCSocketClient.h; path = NetworkProcess/webrtc/LibWebRTCSocketClient.h; sourceTree = "<group>"; };
41DC459D1E3DBCF000B11F51 /* WebRTCSocket.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebRTCSocket.cpp; path = Network/webrtc/WebRTCSocket.cpp; sourceTree = "<group>"; };
41DC45A01E3DC53C00B11F51 /* WebRTCResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebRTCResolver.cpp; path = Network/webrtc/WebRTCResolver.cpp; sourceTree = "<group>"; };
- 41FABD271F4DDFDC006A6C97 /* CacheStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheStorage.h; sourceTree = "<group>"; };
41FABD281F4DDFDC006A6C97 /* CacheStorageEngineCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheStorageEngineCache.h; sourceTree = "<group>"; };
41FAF5F31E3BFE7F001AE678 /* WebRTCSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebRTCSocket.h; path = Network/webrtc/WebRTCSocket.h; sourceTree = "<group>"; };
41FAF5F41E3C0641001AE678 /* WebRTCResolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebRTCResolver.h; path = Network/webrtc/WebRTCResolver.h; sourceTree = "<group>"; };
@@ -8194,7 +8192,6 @@
E489D2821A0A2BE80078C06A /* cache */ = {
isa = PBXGroup;
children = (
- 41FABD271F4DDFDC006A6C97 /* CacheStorage.h */,
41897ED61F415D860016FA42 /* CacheStorageEngine.cpp */,
41897ED21F415D850016FA42 /* CacheStorageEngine.h */,
41FABD281F4DDFDC006A6C97 /* CacheStorageEngineCache.h */,
@@ -8430,7 +8427,6 @@
4F601432155C5AA2001FBDE0 /* BlockingResponseMap.h in Headers */,
1A5705111BE410E600874AF1 /* BlockSPI.h in Headers */,
BC3065FA1259344E00E71278 /* CacheModel.h in Headers */,
- 41FABD291F4DE001006A6C97 /* CacheStorage.h in Headers */,
41897ED81F415D8A0016FA42 /* CacheStorageEngine.h in Headers */,
41FABD2A1F4DE001006A6C97 /* CacheStorageEngineCache.h in Headers */,
41897EDA1F415D8A0016FA42 /* CacheStorageEngineConnection.h in Headers */,
Modified: trunk/Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.cpp (221111 => 221112)
--- trunk/Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.cpp 2017-08-23 22:24:30 UTC (rev 221111)
+++ trunk/Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.cpp 2017-08-23 22:33:15 UTC (rev 221112)
@@ -26,6 +26,7 @@
#include "config.h"
#include "WebCacheStorageConnection.h"
+#include "CacheStorageEngine.h"
#include "CacheStorageEngineConnectionMessages.h"
#include "NetworkConnectionToWebProcessMessages.h"
#include "NetworkProcessConnection.h"
@@ -34,6 +35,7 @@
#include "WebProcess.h"
#include <wtf/MainThread.h>
+using namespace WebCore::DOMCache;
using namespace WebKit::CacheStorage;
namespace WebKit {
@@ -79,39 +81,39 @@
connection().send(Messages::CacheStorageEngineConnection::DeleteMatchingRecords(m_sessionID, requestIdentifier, cacheIdentifier, request, options), 0);
}
-void WebCacheStorageConnection::doBatchPutOperation(uint64_t requestIdentifier, uint64_t cacheIdentifier, Vector<WebCore::CacheStorageConnection::Record>&& records)
+void WebCacheStorageConnection::doBatchPutOperation(uint64_t requestIdentifier, uint64_t cacheIdentifier, Vector<Record>&& records)
{
connection().send(Messages::CacheStorageEngineConnection::PutRecords(m_sessionID, requestIdentifier, cacheIdentifier, records), 0);
}
-void WebCacheStorageConnection::openCompleted(uint64_t requestIdentifier, CacheIdentifierOrError&& result)
+void WebCacheStorageConnection::openCompleted(uint64_t requestIdentifier, const CacheIdentifierOrError& result)
{
- CacheStorageConnection::openCompleted(requestIdentifier, result.hasValue() ? result.value() : 0, !result.hasValue() ? Error::Internal : Error::None);
+ CacheStorageConnection::openCompleted(requestIdentifier, result);
}
-void WebCacheStorageConnection::removeCompleted(uint64_t requestIdentifier, CacheIdentifierOrError&& result)
+void WebCacheStorageConnection::removeCompleted(uint64_t requestIdentifier, const CacheIdentifierOrError& result)
{
- CacheStorageConnection::removeCompleted(requestIdentifier, result.hasValue() ? result.value() : 0, !result.hasValue() ? Error::Internal : Error::None);
+ CacheStorageConnection::removeCompleted(requestIdentifier, result);
}
void WebCacheStorageConnection::updateCaches(uint64_t requestIdentifier, CacheInfosOrError&& result)
{
- CacheStorageConnection::updateCaches(requestIdentifier, result.hasValue() ? result.value() : Vector<CacheInfo>());
+ CacheStorageConnection::updateCaches(requestIdentifier, WTFMove(result));
}
void WebCacheStorageConnection::updateRecords(uint64_t requestIdentifier, RecordsOrError&& result)
{
- CacheStorageConnection::updateRecords(requestIdentifier, result.hasValue() ? WTFMove(result.value()) : Vector<Record>());
+ CacheStorageConnection::updateRecords(requestIdentifier, WTFMove(result));
}
void WebCacheStorageConnection::deleteRecordsCompleted(uint64_t requestIdentifier, RecordIdentifiersOrError&& result)
{
- CacheStorageConnection::deleteRecordsCompleted(requestIdentifier, result.hasValue() ? result.value() : Vector<uint64_t>(), !result.hasValue() ? Error::Internal : Error::None);
+ CacheStorageConnection::deleteRecordsCompleted(requestIdentifier, WTFMove(result));
}
void WebCacheStorageConnection::putRecordsCompleted(uint64_t requestIdentifier, RecordIdentifiersOrError&& result)
{
- CacheStorageConnection::putRecordsCompleted(requestIdentifier, result.hasValue() ? result.value() : Vector<uint64_t>(), !result.hasValue() ? Error::Internal : Error::None);
+ CacheStorageConnection::putRecordsCompleted(requestIdentifier, WTFMove(result));
}
}
Modified: trunk/Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.h (221111 => 221112)
--- trunk/Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.h 2017-08-23 22:24:30 UTC (rev 221111)
+++ trunk/Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.h 2017-08-23 22:33:15 UTC (rev 221112)
@@ -25,7 +25,6 @@
#pragma once
-#include "CacheStorage.h"
#include <WebCore/CacheStorageConnection.h>
#include <wtf/HashMap.h>
@@ -59,15 +58,15 @@
void doRetrieveRecords(uint64_t requestIdentifier, uint64_t cacheIdentifier) final;
void doBatchDeleteOperation(uint64_t requestIdentifier, uint64_t cacheIdentifier, const WebCore::ResourceRequest&, WebCore::CacheQueryOptions&&) final;
- void doBatchPutOperation(uint64_t requestIdentifier, uint64_t cacheIdentifier, Vector<Record>&&) final;
+ void doBatchPutOperation(uint64_t requestIdentifier, uint64_t cacheIdentifier, Vector<WebCore::DOMCache::Record>&&) final;
- void openCompleted(uint64_t requestIdentifier, CacheStorage::CacheIdentifierOrError&&);
- void removeCompleted(uint64_t requestIdentifier, CacheStorage::CacheIdentifierOrError&&);
- void updateCaches(uint64_t requestIdentifier, CacheStorage::CacheInfosOrError&&);
+ void openCompleted(uint64_t requestIdentifier, const WebCore::DOMCache::CacheIdentifierOrError&);
+ void removeCompleted(uint64_t requestIdentifier, const WebCore::DOMCache::CacheIdentifierOrError&);
+ void updateCaches(uint64_t requestIdentifier, WebCore::DOMCache::CacheInfosOrError&&);
- void updateRecords(uint64_t requestIdentifier, CacheStorage::RecordsOrError&&);
- void deleteRecordsCompleted(uint64_t requestIdentifier, CacheStorage::RecordIdentifiersOrError&&);
- void putRecordsCompleted(uint64_t requestIdentifier, CacheStorage::RecordIdentifiersOrError&&);
+ void updateRecords(uint64_t requestIdentifier, WebCore::DOMCache::RecordsOrError&&);
+ void deleteRecordsCompleted(uint64_t requestIdentifier, WebCore::DOMCache::RecordIdentifiersOrError&&);
+ void putRecordsCompleted(uint64_t requestIdentifier, WebCore::DOMCache::RecordIdentifiersOrError&&);
WebCacheStorageProvider& m_provider;
PAL::SessionID m_sessionID;
Modified: trunk/Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.messages.in (221111 => 221112)
--- trunk/Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.messages.in 2017-08-23 22:24:30 UTC (rev 221111)
+++ trunk/Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.messages.in 2017-08-23 22:33:15 UTC (rev 221112)
@@ -21,11 +21,11 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
messages -> WebCacheStorageConnection {
- OpenCompleted(uint64_t requestIdentifier, WebKit::CacheStorage::CacheIdentifierOrError result);
- RemoveCompleted(uint64_t requestIdentifier, WebKit::CacheStorage::CacheIdentifierOrError result);
- UpdateCaches(uint64_t requestIdentifier, WebKit::CacheStorage::CacheInfosOrError result);
+ OpenCompleted(uint64_t requestIdentifier, WebCore::DOMCache::CacheIdentifierOrError result);
+ RemoveCompleted(uint64_t requestIdentifier, WebCore::DOMCache::CacheIdentifierOrError result);
+ UpdateCaches(uint64_t requestIdentifier, WebCore::DOMCache::CacheInfosOrError result);
- UpdateRecords(uint64_t requestIdentifier, WebKit::CacheStorage::RecordsOrError result);
- DeleteRecordsCompleted(uint64_t requestIdentifier, WebKit::CacheStorage::RecordIdentifiersOrError result);
- PutRecordsCompleted(uint64_t requestIdentifier, WebKit::CacheStorage::RecordIdentifiersOrError result);
+ UpdateRecords(uint64_t requestIdentifier, WebCore::DOMCache::RecordsOrError result);
+ DeleteRecordsCompleted(uint64_t requestIdentifier, WebCore::DOMCache::RecordIdentifiersOrError result);
+ PutRecordsCompleted(uint64_t requestIdentifier, WebCore::DOMCache::RecordIdentifiersOrError result);
}