Changeset 221112 in webkit
- Timestamp:
- Aug 23, 2017 3:33:15 PM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 added
- 23 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r220977 r221112 898 898 Modules/cache/CacheStorage.cpp 899 899 Modules/cache/CacheStorageConnection.cpp 900 Modules/cache/DOMCache.cpp 900 901 Modules/cache/DOMWindowCaches.cpp 901 902 Modules/cache/WorkerCacheStorageConnection.cpp -
trunk/Source/WebCore/ChangeLog
r221110 r221112 1 2017-08-23 Youenn Fablet <youenn@apple.com> 2 3 [Cache API] Unify WebCore and WebKit error handling 4 https://bugs.webkit.org/show_bug.cgi?id=175902 5 6 Reviewed by Alex Christensen. 7 8 No change of behavior. 9 10 Introducing a DOMCache namespace enclosing structures, callbacks and function definitions 11 previously found in either WebCore::CacheStorageConnection or WebKit::CacheStorage. 12 13 Some previously used callbacks had no way to pass errors in WebCore while they had in WebKit. 14 Updated Cache, CacheStorage, CacheStorageConnection and WorkerCacheStorageConnection to deal with these potential errors. 15 16 * CMakeLists.txt: 17 * Modules/cache/Cache.cpp: 18 (WebCore::FetchTasksHandler::FetchTasksHandler): 19 (WebCore::FetchTasksHandler::records const): 20 (WebCore::FetchTasksHandler::addRecord): 21 (WebCore::Cache::addAll): 22 (WebCore::Cache::put): 23 (WebCore::Cache::retrieveRecords): 24 (WebCore::queryCacheMatch): 25 (WebCore::Cache::batchDeleteOperation): 26 (WebCore::toConnectionRecord): 27 (WebCore::Cache::batchPutOperation): 28 (WebCore::Cache::updateRecords): 29 * Modules/cache/Cache.h: 30 * Modules/cache/CacheStorage.cpp: 31 (WebCore::CacheStorage::retrieveCaches): 32 (WebCore::CacheStorage::open): 33 (WebCore::CacheStorage::remove): 34 * Modules/cache/CacheStorage.h: 35 * Modules/cache/CacheStorageConnection.cpp: 36 (WebCore::CacheStorageConnection::open): 37 (WebCore::CacheStorageConnection::remove): 38 (WebCore::CacheStorageConnection::retrieveCaches): 39 (WebCore::CacheStorageConnection::batchDeleteOperation): 40 (WebCore::CacheStorageConnection::batchPutOperation): 41 (WebCore::CacheStorageConnection::openOrRemoveCompleted): 42 (WebCore::CacheStorageConnection::updateCaches): 43 (WebCore::CacheStorageConnection::updateRecords): 44 (WebCore::CacheStorageConnection::deleteRecordsCompleted): 45 (WebCore::CacheStorageConnection::putRecordsCompleted): 46 * Modules/cache/CacheStorageConnection.h: 47 (WebCore::CacheStorageConnection::openCompleted): 48 (WebCore::CacheStorageConnection::removeCompleted): 49 (WebCore::CacheStorageConnection::doOpen): 50 (WebCore::CacheStorageConnection::doRemove): 51 (WebCore::CacheStorageConnection::doBatchDeleteOperation): 52 (WebCore::CacheStorageConnection::doBatchPutOperation): 53 * Modules/cache/WorkerCacheStorageConnection.cpp: 54 (WebCore::toCrossThreadRecordData): 55 (WebCore::fromCrossThreadRecordData): 56 (WebCore::WorkerCacheStorageConnection::doOpen): 57 (WebCore::WorkerCacheStorageConnection::doRemove): 58 (WebCore::WorkerCacheStorageConnection::doRetrieveCaches): 59 (WebCore::recordsDataFromRecords): 60 (WebCore::recordsDataOrErrorFromRecords): 61 (WebCore::recordsFromRecordsData): 62 (WebCore::recordsOrErrorFromRecordsData): 63 (WebCore::WorkerCacheStorageConnection::doRetrieveRecords): 64 (WebCore::WorkerCacheStorageConnection::doBatchDeleteOperation): 65 (WebCore::WorkerCacheStorageConnection::doBatchPutOperation): 66 * Modules/cache/DOMCache.cpp: Added. 67 * Modules/cache/DOMCache.h: Added. 68 * Modules/cache/WorkerCacheStorageConnection.h: 69 * WebCore.xcodeproj/project.pbxproj: 70 1 71 2017-08-23 Yusuke Suzuki <utatane.tea@gmail.com> 2 72 -
trunk/Source/WebCore/Modules/cache/Cache.cpp
r221031 r221112 35 35 #include "URL.h" 36 36 37 using namespace WebCore::DOMCache; 38 37 39 namespace WebCore { 38 40 39 static CacheStorageConnection::Record toConnectionRecord(const FetchRequest&, FetchResponse&, CacheStorageConnection::ResponseBody&&);41 static Record toConnectionRecord(const FetchRequest&, FetchResponse&, ResponseBody&&); 40 42 41 43 Cache::Cache(ScriptExecutionContext& context, String&& name, uint64_t identifier, Ref<CacheStorageConnection>&& connection) … … 136 138 class FetchTasksHandler : public RefCounted<FetchTasksHandler> { 137 139 public: 138 explicit FetchTasksHandler(Function<void(ExceptionOr<Vector< CacheStorageConnection::Record>>&&)>&& callback)140 explicit FetchTasksHandler(Function<void(ExceptionOr<Vector<Record>>&&)>&& callback) 139 141 : m_callback(WTFMove(callback)) 140 142 { … … 147 149 } 148 150 149 const Vector< CacheStorageConnection::Record>& records() const { return m_records; }150 151 size_t addRecord( CacheStorageConnection::Record&& record)151 const Vector<Record>& records() const { return m_records; } 152 153 size_t addRecord(Record&& record) 152 154 { 153 155 ASSERT(!isDone()); … … 171 173 172 174 private: 173 Vector< CacheStorageConnection::Record> m_records;174 Function<void(ExceptionOr<Vector< CacheStorageConnection::Record>>&&)> m_callback;175 Vector<Record> m_records; 176 Function<void(ExceptionOr<Vector<Record>>&&)> m_callback; 175 177 }; 176 178 … … 208 210 } 209 211 210 auto taskHandler = adoptRef(*new FetchTasksHandler([protectedThis = makeRef(*this), this, promise = WTFMove(promise)](ExceptionOr<Vector< CacheStorageConnection::Record>>&& result) mutable {212 auto taskHandler = adoptRef(*new FetchTasksHandler([protectedThis = makeRef(*this), this, promise = WTFMove(promise)](ExceptionOr<Vector<Record>>&& result) mutable { 211 213 if (result.hasException()) { 212 214 promise.reject(result.releaseException()); … … 249 251 CacheQueryOptions options; 250 252 for (const auto& record : taskHandler->records()) { 251 if ( CacheStorageConnection::queryCacheMatch(request->resourceRequest(), record.request, record.response, options)) {253 if (DOMCache::queryCacheMatch(request->resourceRequest(), record.request, record.response, options)) { 252 254 taskHandler->error(Exception { InvalidStateError, ASCIILiteral("addAll cannot store several matching requests")}); 253 255 return; … … 311 313 promise.reject(result.releaseException()); 312 314 else { 313 CacheStorageConnection::ResponseBody body;315 DOMCache::ResponseBody body; 314 316 if (auto buffer = result.releaseReturnValue()) 315 317 body = buffer.releaseNonNull(); … … 382 384 { 383 385 setPendingActivity(this); 384 m_connection->retrieveRecords(m_identifier, [this, callback = WTFMove(callback)]( Vector<CacheStorageConnection::Record>&& records) {386 m_connection->retrieveRecords(m_identifier, [this, callback = WTFMove(callback)](RecordsOrError&& result) { 385 387 if (!m_isStopped) { 386 updateRecords(WTFMove(records)); 388 // FIXME: We should probably propagate that error up to the promise based operation. 389 ASSERT(result.hasValue()); 390 if (result.hasValue()) 391 updateRecords(WTFMove(result.value())); 387 392 callback(); 388 393 } … … 401 406 { 402 407 // We need to pass the resource request with all correct headers hence why we call resourceRequest(). 403 return CacheStorageConnection::queryCacheMatch(request.resourceRequest(), cachedRequest.resourceRequest(), cachedResponse, options);408 return DOMCache::queryCacheMatch(request.resourceRequest(), cachedRequest.resourceRequest(), cachedResponse, options); 404 409 } 405 410 … … 420 425 { 421 426 setPendingActivity(this); 422 m_connection->batchDeleteOperation(m_identifier, request.internalRequest(), WTFMove(options), [this, callback = WTFMove(callback)](Vector<uint64_t>&& records, CacheStorageConnection::Error error) { 423 if (!m_isStopped) 424 callback(CacheStorageConnection::exceptionOrResult(!records.isEmpty(), error)); 425 427 m_connection->batchDeleteOperation(m_identifier, request.internalRequest(), WTFMove(options), [this, callback = WTFMove(callback)](RecordIdentifiersOrError&& result) { 428 if (!m_isStopped) { 429 if (!result.hasValue()) 430 callback(DOMCache::errorToException(result.error())); 431 else 432 callback(!result.value().isEmpty()); 433 } 426 434 unsetPendingActivity(this); 427 435 }); 428 436 } 429 437 430 CacheStorageConnection::Record toConnectionRecord(const FetchRequest& request, FetchResponse& response, CacheStorageConnection::ResponseBody&& responseBody)438 Record toConnectionRecord(const FetchRequest& request, FetchResponse& response, DOMCache::ResponseBody&& responseBody) 431 439 { 432 440 // FIXME: Add a setHTTPHeaderFields on ResourceResponseBase. … … 447 455 } 448 456 449 void Cache::batchPutOperation(const FetchRequest& request, FetchResponse& response, CacheStorageConnection::ResponseBody&& responseBody, WTF::Function<void(ExceptionOr<void>&&)>&& callback)450 { 451 Vector< CacheStorageConnection::Record> records;457 void Cache::batchPutOperation(const FetchRequest& request, FetchResponse& response, DOMCache::ResponseBody&& responseBody, WTF::Function<void(ExceptionOr<void>&&)>&& callback) 458 { 459 Vector<Record> records; 452 460 records.append(toConnectionRecord(request, response, WTFMove(responseBody))); 453 461 … … 455 463 } 456 464 457 void Cache::batchPutOperation(Vector< CacheStorageConnection::Record>&& records, WTF::Function<void(ExceptionOr<void>&&)>&& callback)465 void Cache::batchPutOperation(Vector<Record>&& records, WTF::Function<void(ExceptionOr<void>&&)>&& callback) 458 466 { 459 467 setPendingActivity(this); 460 m_connection->batchPutOperation(m_identifier, WTFMove(records), [this, callback = WTFMove(callback)](Vector<uint64_t>&&, CacheStorageConnection::Error error) { 461 if (!m_isStopped) 462 callback(CacheStorageConnection::errorToException(error)); 463 468 m_connection->batchPutOperation(m_identifier, WTFMove(records), [this, callback = WTFMove(callback)](RecordIdentifiersOrError&& result) { 469 if (!m_isStopped) { 470 if (!result.hasValue()) 471 callback(DOMCache::errorToException(result.error())); 472 else 473 callback({ }); 474 } 464 475 unsetPendingActivity(this); 465 476 }); 466 477 } 467 478 468 void Cache::updateRecords(Vector< CacheStorageConnection::Record>&& records)479 void Cache::updateRecords(Vector<Record>&& records) 469 480 { 470 481 ASSERT(scriptExecutionContext()); -
trunk/Source/WebCore/Modules/cache/Cache.h
r220998 r221112 74 74 void queryCache(Ref<FetchRequest>&&, CacheQueryOptions&&, WTF::Function<void(const Vector<CacheStorageRecord>&)>&&); 75 75 void batchDeleteOperation(const FetchRequest&, CacheQueryOptions&&, WTF::Function<void(ExceptionOr<bool>&&)>&&); 76 void batchPutOperation(const FetchRequest&, FetchResponse&, CacheStorageConnection::ResponseBody&&, WTF::Function<void(ExceptionOr<void>&&)>&&);77 void batchPutOperation(Vector< CacheStorageConnection::Record>&&, WTF::Function<void(ExceptionOr<void>&&)>&&);76 void batchPutOperation(const FetchRequest&, FetchResponse&, DOMCache::ResponseBody&&, WTF::Function<void(ExceptionOr<void>&&)>&&); 77 void batchPutOperation(Vector<DOMCache::Record>&&, WTF::Function<void(ExceptionOr<void>&&)>&&); 78 78 79 void updateRecords(Vector< CacheStorageConnection::Record>&&);79 void updateRecords(Vector<DOMCache::Record>&&); 80 80 81 81 String m_name; -
trunk/Source/WebCore/Modules/cache/CacheStorage.cpp
r220984 r221112 32 32 #include "ScriptExecutionContext.h" 33 33 34 using namespace WebCore::DOMCache; 35 34 36 namespace WebCore { 35 37 … … 118 120 119 121 setPendingActivity(this); 120 m_connection->retrieveCaches(origin, [this, callback = WTFMove(callback)]( Vector<CacheStorageConnection::CacheInfo>&& cachesInfo) {122 m_connection->retrieveCaches(origin, [this, callback = WTFMove(callback)](CacheInfosOrError&& result) { 121 123 if (!m_isStopped) { 124 // FIXME: We should probably propagate that error up to the promise based operation. 125 ASSERT(result.hasValue()); 126 if (!result.hasValue()) { 127 callback(); 128 return; 129 } 130 auto& cachesInfo = result.value(); 131 122 132 ASSERT(scriptExecutionContext()); 123 133 m_caches.removeAllMatching([&](auto& cache) { … … 153 163 154 164 setPendingActivity(this); 155 m_connection->open(origin, name, [this, name, promise = WTFMove(promise)]( uint64_t cacheIdentifier, CacheStorageConnection::Error error) mutable {165 m_connection->open(origin, name, [this, name, promise = WTFMove(promise)](const CacheIdentifierOrError& result) mutable { 156 166 if (!m_isStopped) { 157 auto result = CacheStorageConnection::errorToException(error); 158 if ( result.hasException())159 promise.reject( result.releaseException());167 168 if (!result.hasValue()) 169 promise.reject(DOMCache::errorToException(result.error())); 160 170 else { 161 auto cache = Cache::create(*scriptExecutionContext(), String { name }, cacheIdentifier, m_connection.copyRef());171 auto cache = Cache::create(*scriptExecutionContext(), String { name }, result.value(), m_connection.copyRef()); 162 172 promise.resolve(cache); 163 173 m_caches.append(WTFMove(cache)); … … 182 192 183 193 setPendingActivity(this); 184 m_connection->remove(m_caches[position]->identifier(), [this, name, promise = WTFMove(promise)](uint64_t cacheIdentifier, CacheStorageConnection::Error error) mutable { 185 UNUSED_PARAM(cacheIdentifier); 186 if (!m_isStopped) 187 promise.settle(CacheStorageConnection::exceptionOrResult(true, error)); 188 194 m_connection->remove(m_caches[position]->identifier(), [this, name, promise = WTFMove(promise)](const CacheIdentifierOrError& result) mutable { 195 if (!m_isStopped) { 196 if (!result.hasValue()) 197 promise.reject(DOMCache::errorToException(result.error())); 198 else 199 promise.resolve(true); 200 } 189 201 unsetPendingActivity(this); 190 202 }); -
trunk/Source/WebCore/Modules/cache/CacheStorageConnection.cpp
r221024 r221112 28 28 #include "CacheStorageConnection.h" 29 29 30 #include "CacheQueryOptions.h" 31 #include "Exception.h" 32 #include "HTTPParsers.h" 30 using namespace WebCore::DOMCache; 33 31 34 32 namespace WebCore { 35 33 36 ExceptionOr<void> CacheStorageConnection::errorToException(Error error) 37 { 38 switch (error) { 39 case Error::None: 40 return { }; 41 case Error::NotImplemented: 42 return Exception { NotSupportedError, ASCIILiteral("Not implemented") }; 43 default: 44 return Exception { NotSupportedError, ASCIILiteral("Internal error") }; 45 } 46 } 47 48 bool CacheStorageConnection::queryCacheMatch(const ResourceRequest& request, const ResourceRequest& cachedRequest, const ResourceResponse& cachedResponse, const CacheQueryOptions& options) 49 { 50 ASSERT(options.ignoreMethod || request.httpMethod() == "GET"); 51 52 URL requestURL = request.url(); 53 URL cachedRequestURL = cachedRequest.url(); 54 55 if (options.ignoreSearch) { 56 requestURL.setQuery({ }); 57 cachedRequestURL.setQuery({ }); 58 } 59 if (!equalIgnoringFragmentIdentifier(requestURL, cachedRequestURL)) 60 return false; 61 62 if (options.ignoreVary) 63 return true; 64 65 String varyValue = cachedResponse.httpHeaderField(WebCore::HTTPHeaderName::Vary); 66 if (varyValue.isNull()) 67 return true; 68 69 // FIXME: This is inefficient, we should be able to split and trim whitespaces at the same time. 70 Vector<String> varyHeaderNames; 71 varyValue.split(',', false, varyHeaderNames); 72 for (auto& name : varyHeaderNames) { 73 if (stripLeadingAndTrailingHTTPSpaces(name) == "*") 74 return false; 75 if (cachedRequest.httpHeaderField(name) != request.httpHeaderField(name)) 76 return false; 77 } 78 return true; 79 } 80 81 void CacheStorageConnection::open(const String& origin, const String& cacheName, OpenRemoveCallback&& callback) 34 void CacheStorageConnection::open(const String& origin, const String& cacheName, CacheIdentifierCallback&& callback) 82 35 { 83 36 uint64_t requestIdentifier = ++m_lastRequestIdentifier; … … 87 40 } 88 41 89 void CacheStorageConnection::remove(uint64_t cacheIdentifier, OpenRemoveCallback&& callback)42 void CacheStorageConnection::remove(uint64_t cacheIdentifier, CacheIdentifierCallback&& callback) 90 43 { 91 44 uint64_t requestIdentifier = ++m_lastRequestIdentifier; … … 95 48 } 96 49 97 void CacheStorageConnection::retrieveCaches(const String& origin, Cache sCallback&& callback)50 void CacheStorageConnection::retrieveCaches(const String& origin, CacheInfosCallback&& callback) 98 51 { 99 52 uint64_t requestIdentifier = ++m_lastRequestIdentifier; … … 111 64 } 112 65 113 void CacheStorageConnection::batchDeleteOperation(uint64_t cacheIdentifier, const WebCore::ResourceRequest& request, WebCore::CacheQueryOptions&& options, BatchOperationCallback&& callback)66 void CacheStorageConnection::batchDeleteOperation(uint64_t cacheIdentifier, const ResourceRequest& request, CacheQueryOptions&& options, RecordIdentifiersCallback&& callback) 114 67 { 115 68 uint64_t requestIdentifier = ++m_lastRequestIdentifier; … … 119 72 } 120 73 121 void CacheStorageConnection::batchPutOperation(uint64_t cacheIdentifier, Vector< WebCore::CacheStorageConnection::Record>&& records, BatchOperationCallback&& callback)74 void CacheStorageConnection::batchPutOperation(uint64_t cacheIdentifier, Vector<Record>&& records, RecordIdentifiersCallback&& callback) 122 75 { 123 76 uint64_t requestIdentifier = ++m_lastRequestIdentifier; … … 127 80 } 128 81 129 void CacheStorageConnection::openOrRemoveCompleted(uint64_t requestIdentifier, uint64_t cacheIdentifier, Error error)82 void CacheStorageConnection::openOrRemoveCompleted(uint64_t requestIdentifier, const CacheIdentifierOrError& result) 130 83 { 131 84 if (auto callback = m_openAndRemoveCachePendingRequests.take(requestIdentifier)) 132 callback( cacheIdentifier, error);85 callback(result); 133 86 } 134 87 135 void CacheStorageConnection::updateCaches(uint64_t requestIdentifier, Vector<CacheInfo>&& caches)88 void CacheStorageConnection::updateCaches(uint64_t requestIdentifier, CacheInfosOrError&& result) 136 89 { 137 90 if (auto callback = m_retrieveCachesPendingRequests.take(requestIdentifier)) 138 callback(WTFMove( caches));91 callback(WTFMove(result)); 139 92 } 140 93 141 void CacheStorageConnection::updateRecords(uint64_t requestIdentifier, Vector<Record>&& records)94 void CacheStorageConnection::updateRecords(uint64_t requestIdentifier, RecordsOrError&& result) 142 95 { 143 96 if (auto callback = m_retrieveRecordsPendingRequests.take(requestIdentifier)) 144 callback(WTFMove(re cords));97 callback(WTFMove(result)); 145 98 } 146 99 147 void CacheStorageConnection::deleteRecordsCompleted(uint64_t requestIdentifier, Vector<uint64_t>&& records, Error error)100 void CacheStorageConnection::deleteRecordsCompleted(uint64_t requestIdentifier, Expected<Vector<uint64_t>, Error>&& result) 148 101 { 149 102 if (auto callback = m_batchDeleteAndPutPendingRequests.take(requestIdentifier)) 150 callback(WTFMove(re cords), error);103 callback(WTFMove(result)); 151 104 } 152 105 153 void CacheStorageConnection::putRecordsCompleted(uint64_t requestIdentifier, Vector<uint64_t>&& records, Error error)106 void CacheStorageConnection::putRecordsCompleted(uint64_t requestIdentifier, Expected<Vector<uint64_t>, Error>&& result) 154 107 { 155 108 if (auto callback = m_batchDeleteAndPutPendingRequests.take(requestIdentifier)) 156 callback(WTFMove(records), error); 157 } 158 159 CacheStorageConnection::ResponseBody CacheStorageConnection::isolatedResponseBody(const ResponseBody& body) 160 { 161 return WTF::switchOn(body, [](const Ref<FormData>& formData) { 162 return formData->isolatedCopy(); 163 }, [](const Ref<SharedBuffer>& buffer) { 164 return buffer->copy(); 165 }, [](const std::nullptr_t&) { 166 return CacheStorageConnection::ResponseBody { }; 167 }); 168 } 169 170 static inline CacheStorageConnection::ResponseBody copyResponseBody(const CacheStorageConnection::ResponseBody& body) 171 { 172 return WTF::switchOn(body, [](const Ref<FormData>& formData) { 173 return formData.copyRef(); 174 }, [](const Ref<SharedBuffer>& buffer) { 175 return buffer.copyRef(); 176 }, [](const std::nullptr_t&) { 177 return CacheStorageConnection::ResponseBody { }; 178 }); 179 } 180 181 CacheStorageConnection::Record CacheStorageConnection::Record::copy() const 182 { 183 return Record { identifier, updateResponseCounter, requestHeadersGuard, request, options, referrer, responseHeadersGuard, response, copyResponseBody(responseBody) }; 109 callback(WTFMove(result)); 184 110 } 185 111 -
trunk/Source/WebCore/Modules/cache/CacheStorageConnection.h
r221024 r221112 27 27 #pragma once 28 28 29 #include "FetchHeaders.h" 30 #include "FetchOptions.h" 31 #include "ResourceRequest.h" 32 #include "ResourceResponse.h" 33 #include "SharedBuffer.h" 29 #include "DOMCache.h" 34 30 #include <wtf/HashMap.h> 35 31 #include <wtf/ThreadSafeRefCounted.h> 36 32 37 33 namespace WebCore { 38 39 struct CacheQueryOptions;40 34 41 35 class CacheStorageConnection : public ThreadSafeRefCounted<CacheStorageConnection> { … … 44 38 virtual ~CacheStorageConnection() = default; 45 39 46 enum class Error { 47 None, 48 NotImplemented, 49 Internal 50 }; 40 void open(const String& origin, const String& cacheName, DOMCache::CacheIdentifierCallback&&); 41 void remove(uint64_t cacheIdentifier, DOMCache::CacheIdentifierCallback&&); 42 void retrieveCaches(const String& origin, DOMCache::CacheInfosCallback&&); 51 43 52 static ExceptionOr<void> errorToException(Error); 53 template<typename T> static ExceptionOr<T> exceptionOrResult(T&& value, Error error) 54 { 55 auto result = errorToException(error); 56 if (result.hasException()) 57 return result.releaseException(); 58 return std::forward<T>(value); 59 } 60 61 WEBCORE_EXPORT static bool queryCacheMatch(const ResourceRequest& request, const ResourceRequest& cachedRequest, const ResourceResponse&, const CacheQueryOptions&); 62 63 using ResponseBody = Variant<std::nullptr_t, Ref<FormData>, Ref<SharedBuffer>>; 64 static ResponseBody isolatedResponseBody(const ResponseBody&); 65 66 struct Record { 67 WEBCORE_EXPORT Record copy() const; 68 69 uint64_t identifier; 70 uint64_t updateResponseCounter; 71 72 FetchHeaders::Guard requestHeadersGuard; 73 ResourceRequest request; 74 FetchOptions options; 75 String referrer; 76 77 FetchHeaders::Guard responseHeadersGuard; 78 ResourceResponse response; 79 ResponseBody responseBody; 80 }; 81 82 struct CacheInfo { 83 uint64_t identifier; 84 String name; 85 }; 86 87 using OpenRemoveCallback = WTF::Function<void(uint64_t, Error)>; 88 using CachesCallback = WTF::Function<void(Vector<CacheInfo>&&)>; 89 using RecordsCallback = WTF::Function<void(Vector<Record>&&)>; 90 using BatchOperationCallback = WTF::Function<void(Vector<uint64_t>&&, Error)>; 91 92 void open(const String& /* origin */, const String& /* cacheName */, OpenRemoveCallback&&); 93 void remove(uint64_t /* cacheIdentifier */, OpenRemoveCallback&&); 94 void retrieveCaches(const String& /* origin */, CachesCallback&&); 95 96 void retrieveRecords(uint64_t /* cacheIdentifier */, RecordsCallback&&); 97 void batchDeleteOperation(uint64_t /* cacheIdentifier */, const ResourceRequest&, CacheQueryOptions&&, BatchOperationCallback&&); 98 void batchPutOperation(uint64_t /* cacheIdentifier */, Vector<Record>&&, BatchOperationCallback&&); 44 void retrieveRecords(uint64_t cacheIdentifier, DOMCache::RecordsCallback&&); 45 void batchDeleteOperation(uint64_t cacheIdentifier, const ResourceRequest&, CacheQueryOptions&&, DOMCache::RecordIdentifiersCallback&&); 46 void batchPutOperation(uint64_t cacheIdentifier, Vector<DOMCache::Record>&&, DOMCache::RecordIdentifiersCallback&&); 99 47 100 48 protected: 101 49 CacheStorageConnection() = default; 102 50 103 void openCompleted(uint64_t identifier, uint64_t cacheIdentifier, Error error) { openOrRemoveCompleted(identifier, cacheIdentifier, error); }104 void removeCompleted(uint64_t identifier, uint64_t cacheIdentifier, Error error) { openOrRemoveCompleted(identifier, cacheIdentifier, error); }105 WEBCORE_EXPORT void updateCaches(uint64_t requestIdentifier, Vector<CacheInfo>&&);51 void openCompleted(uint64_t identifier, const DOMCache::CacheIdentifierOrError& result) { openOrRemoveCompleted(identifier, result); } 52 void removeCompleted(uint64_t identifier, const DOMCache::CacheIdentifierOrError& result) { openOrRemoveCompleted(identifier, result); } 53 WEBCORE_EXPORT void updateCaches(uint64_t requestIdentifier, DOMCache::CacheInfosOrError&&); 106 54 107 WEBCORE_EXPORT void updateRecords(uint64_t requestIdentifier, Vector<Record>&&);108 WEBCORE_EXPORT void deleteRecordsCompleted(uint64_t requestIdentifier, Vector<uint64_t>&&, Error);109 WEBCORE_EXPORT void putRecordsCompleted(uint64_t requestIdentifier, Vector<uint64_t>&&, Error);55 WEBCORE_EXPORT void updateRecords(uint64_t requestIdentifier, DOMCache::RecordsOrError&&); 56 WEBCORE_EXPORT void deleteRecordsCompleted(uint64_t requestIdentifier, DOMCache::RecordIdentifiersOrError&&); 57 WEBCORE_EXPORT void putRecordsCompleted(uint64_t requestIdentifier, DOMCache::RecordIdentifiersOrError&&); 110 58 111 59 private: 112 virtual void doOpen(uint64_t requestIdentifier, const String& /* origin */, const String& /* cacheName */) { openCompleted(requestIdentifier, 0, Error::NotImplemented); }113 virtual void doRemove(uint64_t requestIdentifier, uint64_t /* cacheIdentifier */) { removeCompleted(requestIdentifier, 0, Error::NotImplemented); }60 virtual void doOpen(uint64_t requestIdentifier, const String& /* origin */, const String& /* cacheName */) { openCompleted(requestIdentifier, makeUnexpected(DOMCache::Error::NotImplemented)); } 61 virtual void doRemove(uint64_t requestIdentifier, uint64_t /* cacheIdentifier */) { removeCompleted(requestIdentifier, makeUnexpected(DOMCache::Error::NotImplemented)); } 114 62 virtual void doRetrieveCaches(uint64_t requestIdentifier, const String& /* origin */) { updateCaches(requestIdentifier, { }); } 115 63 116 64 virtual void doRetrieveRecords(uint64_t requestIdentifier, uint64_t /* cacheIdentifier */) { updateRecords(requestIdentifier, { }); } 117 virtual void doBatchDeleteOperation(uint64_t requestIdentifier, uint64_t /* cacheIdentifier */, const ResourceRequest&, CacheQueryOptions&&) { deleteRecordsCompleted(requestIdentifier, { }, Error::NotImplemented); }118 virtual void doBatchPutOperation(uint64_t requestIdentifier, uint64_t /* cacheIdentifier */, Vector< Record>&&) { putRecordsCompleted(requestIdentifier, { }, Error::NotImplemented); }65 virtual void doBatchDeleteOperation(uint64_t requestIdentifier, uint64_t /* cacheIdentifier */, const ResourceRequest&, CacheQueryOptions&&) { deleteRecordsCompleted(requestIdentifier, makeUnexpected(DOMCache::Error::NotImplemented)); } 66 virtual void doBatchPutOperation(uint64_t requestIdentifier, uint64_t /* cacheIdentifier */, Vector<DOMCache::Record>&&) { putRecordsCompleted(requestIdentifier, makeUnexpected(DOMCache::Error::NotImplemented)); } 119 67 120 WEBCORE_EXPORT void openOrRemoveCompleted(uint64_t requestIdentifier, uint64_t cacheIdentifier, Error);68 WEBCORE_EXPORT void openOrRemoveCompleted(uint64_t requestIdentifier, const DOMCache::CacheIdentifierOrError&); 121 69 122 HashMap<uint64_t, OpenRemoveCallback> m_openAndRemoveCachePendingRequests;123 HashMap<uint64_t, CachesCallback> m_retrieveCachesPendingRequests;124 HashMap<uint64_t, RecordsCallback> m_retrieveRecordsPendingRequests;125 HashMap<uint64_t, BatchOperationCallback> m_batchDeleteAndPutPendingRequests;70 HashMap<uint64_t, DOMCache::CacheIdentifierCallback> m_openAndRemoveCachePendingRequests; 71 HashMap<uint64_t, DOMCache::CacheInfosCallback> m_retrieveCachesPendingRequests; 72 HashMap<uint64_t, DOMCache::RecordsCallback> m_retrieveRecordsPendingRequests; 73 HashMap<uint64_t, DOMCache::RecordIdentifiersCallback> m_batchDeleteAndPutPendingRequests; 126 74 127 75 uint64_t m_lastRequestIdentifier { 0 }; 128 76 }; 129 130 77 } // namespace WebCore 131 -
trunk/Source/WebCore/Modules/cache/DOMCache.h
r221111 r221112 1 1 2 /* 2 3 * Copyright (C) 2017 Apple Inc. All rights reserved. … … 26 27 #pragma once 27 28 28 #include "WebCoreArgumentCoders.h" 29 #include <WebCore/CacheStorageConnection.h> 30 #include <wtf/EnumTraits.h> 29 #include "FetchHeaders.h" 30 #include "FetchOptions.h" 31 #include "ResourceRequest.h" 32 #include "ResourceResponse.h" 33 #include "SharedBuffer.h" 31 34 32 namespace Web Kit{35 namespace WebCore { 33 36 34 namespace CacheStorage { 37 struct CacheQueryOptions; 38 39 namespace DOMCache { 35 40 36 41 enum class Error { 42 NotImplemented, 37 43 Internal 38 44 }; 39 45 40 using Record = WebCore::CacheStorageConnection::Record; 46 Exception errorToException(Error); 47 48 WEBCORE_EXPORT bool queryCacheMatch(const ResourceRequest& request, const ResourceRequest& cachedRequest, const ResourceResponse&, const CacheQueryOptions&); 49 50 using ResponseBody = Variant<std::nullptr_t, Ref<FormData>, Ref<SharedBuffer>>; 51 ResponseBody isolatedResponseBody(const ResponseBody&); 52 53 struct Record { 54 WEBCORE_EXPORT Record copy() const; 55 56 uint64_t identifier; 57 uint64_t updateResponseCounter; 58 59 FetchHeaders::Guard requestHeadersGuard; 60 ResourceRequest request; 61 FetchOptions options; 62 String referrer; 63 64 FetchHeaders::Guard responseHeadersGuard; 65 ResourceResponse response; 66 ResponseBody responseBody; 67 }; 68 69 struct CacheInfo { 70 uint64_t identifier; 71 String name; 72 }; 41 73 42 74 using CacheIdentifierOrError = Expected<uint64_t, Error>; 43 using CacheIdentifierCallback = Function<void(CacheIdentifierOrError&&)>;75 using CacheIdentifierCallback = WTF::Function<void(const CacheIdentifierOrError&)>; 44 76 45 using CacheInfosOrError = Expected<Vector<WebCore::CacheStorageConnection::CacheInfo>, Error>; 46 using CacheInfosCallback = Function<void(CacheInfosOrError&&)>; 77 using RecordIdentifiersOrError = Expected<Vector<uint64_t>, Error>; 78 using RecordIdentifiersCallback = WTF::Function<void(RecordIdentifiersOrError&&)>; 79 80 using CacheInfosOrError = Expected<Vector<WebCore::DOMCache::CacheInfo>, Error>; 81 using CacheInfosCallback = WTF::Function<void(CacheInfosOrError&&)>; 47 82 48 83 using RecordsOrError = Expected<Vector<Record>, Error>; 49 using RecordsCallback = Function<void(RecordsOrError&&)>; 50 51 using RecordIdentifiersOrError = Expected<Vector<uint64_t>, Error>; 52 using RecordIdentifiersCallback = Function<void(RecordIdentifiersOrError&&)>; 84 using RecordsCallback = WTF::Function<void(RecordsOrError&&)>; 53 85 54 86 using CompletionCallback = Function<void(std::optional<Error>&&)>; 55 87 56 } // namespace CacheStorage88 } // namespace DOMCache 57 89 58 } // namespace Web Kit90 } // namespace WebCore 59 91 60 92 namespace WTF { 61 template<> struct EnumTraits<Web Kit::CacheStorage::Error> {93 template<> struct EnumTraits<WebCore::DOMCache::Error> { 62 94 using values = EnumValues< 63 WebKit::CacheStorage::Error, 64 WebKit::CacheStorage::Error::Internal 95 WebCore::DOMCache::Error, 96 WebCore::DOMCache::Error::NotImplemented, 97 WebCore::DOMCache::Error::Internal 65 98 >; 66 99 }; -
trunk/Source/WebCore/Modules/cache/WorkerCacheStorageConnection.cpp
r221024 r221112 37 37 #include "WorkerThread.h" 38 38 39 using namespace WebCore::DOMCache; 40 39 41 namespace WebCore { 40 42 … … 51 53 FetchHeaders::Guard responseHeadersGuard; 52 54 ResourceResponse::CrossThreadData response; 53 CacheStorageConnection::ResponseBody responseBody;55 ResponseBody responseBody; 54 56 }; 55 57 56 static CrossThreadRecordData toCrossThreadRecordData(const CacheStorageConnection::Record& record)58 static CrossThreadRecordData toCrossThreadRecordData(const Record& record) 57 59 { 58 60 return CrossThreadRecordData { … … 65 67 record.responseHeadersGuard, 66 68 record.response.crossThreadData(), 67 CacheStorageConnection::isolatedResponseBody(record.responseBody)69 isolatedResponseBody(record.responseBody) 68 70 }; 69 71 } 70 72 71 static CacheStorageConnection::Record fromCrossThreadRecordData(CrossThreadRecordData&& data)72 { 73 return CacheStorageConnection::Record {73 static Record fromCrossThreadRecordData(CrossThreadRecordData&& data) 74 { 75 return Record { 74 76 data.identifier, 75 77 data.updateResponseCounter, … … 116 118 ASSERT(m_mainThreadConnection); 117 119 118 m_mainThreadConnection->open(origin, cacheName, [this, protectedThis = WTFMove(protectedThis), requestIdentifier]( uint64_t cacheIdentifier, Error error) mutable {119 m_proxy.postTaskForModeToWorkerGlobalScope([this, error, cacheIdentifier, protectedThis = WTFMove(protectedThis), requestIdentifier](ScriptExecutionContext& context) mutable {120 ASSERT_UNUSED(context, context.isWorkerGlobalScope()); 121 openCompleted(requestIdentifier, cacheIdentifier, error);120 m_mainThreadConnection->open(origin, cacheName, [this, protectedThis = WTFMove(protectedThis), requestIdentifier](const CacheIdentifierOrError& result) mutable { 121 m_proxy.postTaskForModeToWorkerGlobalScope([this, protectedThis = WTFMove(protectedThis), requestIdentifier, result](ScriptExecutionContext& context) mutable { 122 ASSERT_UNUSED(context, context.isWorkerGlobalScope()); 123 openCompleted(requestIdentifier, result); 122 124 }, m_taskMode); 123 125 }); … … 131 133 ASSERT(m_mainThreadConnection); 132 134 133 m_mainThreadConnection->remove(cacheIdentifier, [this, protectedThis = WTFMove(protectedThis), requestIdentifier, cacheIdentifier]( uint64_t removedCacheIdentifier, Error error) mutable {134 ASSERT _UNUSED(removedCacheIdentifier, removedCacheIdentifier== cacheIdentifier);135 m_proxy.postTaskForModeToWorkerGlobalScope([this, protectedThis = WTFMove(protectedThis), requestIdentifier, cacheIdentifier, error](ScriptExecutionContext& context) mutable {136 ASSERT_UNUSED(context, context.isWorkerGlobalScope()); 137 removeCompleted(requestIdentifier, cacheIdentifier, error);135 m_mainThreadConnection->remove(cacheIdentifier, [this, protectedThis = WTFMove(protectedThis), requestIdentifier, cacheIdentifier](const CacheIdentifierOrError& result) mutable { 136 ASSERT(!result.hasValue() || result.value() == cacheIdentifier); 137 m_proxy.postTaskForModeToWorkerGlobalScope([this, protectedThis = WTFMove(protectedThis), requestIdentifier, result](ScriptExecutionContext& context) mutable { 138 ASSERT_UNUSED(context, context.isWorkerGlobalScope()); 139 removeCompleted(requestIdentifier, result); 138 140 }, m_taskMode); 139 141 }); … … 147 149 ASSERT(m_mainThreadConnection); 148 150 149 m_mainThreadConnection->retrieveCaches(origin, [this, protectedThis = WTFMove(protectedThis), requestIdentifier](const Vector<CacheInfo>& caches) mutable { 150 Vector<CacheInfo> isolatedCaches; 151 isolatedCaches.reserveInitialCapacity(caches.size()); 152 for (const auto& cache : caches) 153 isolatedCaches.uncheckedAppend(CacheInfo { cache.identifier, cache.name.isolatedCopy() }); 154 155 m_proxy.postTaskForModeToWorkerGlobalScope([this, protectedThis = WTFMove(protectedThis), caches = WTFMove(isolatedCaches), requestIdentifier](ScriptExecutionContext& context) mutable { 156 ASSERT_UNUSED(context, context.isWorkerGlobalScope()); 157 updateCaches(requestIdentifier, WTFMove(caches)); 158 }, m_taskMode); 159 }); 160 }); 161 } 162 163 static inline Vector<CrossThreadRecordData> recordsDataFromRecords(const Vector<CacheStorageConnection::Record>& records) 151 m_mainThreadConnection->retrieveCaches(origin, [this, protectedThis = WTFMove(protectedThis), requestIdentifier](CacheInfosOrError&& result) mutable { 152 CacheInfosOrError isolatedResult; 153 if (!result.hasValue()) 154 isolatedResult = WTFMove(result); 155 else { 156 Vector<CacheInfo> isolatedCaches; 157 isolatedCaches.reserveInitialCapacity(result.value().size()); 158 for (const auto& cache : result.value()) 159 isolatedCaches.uncheckedAppend(CacheInfo { cache.identifier, cache.name.isolatedCopy() }); 160 isolatedResult = WTFMove(isolatedCaches); 161 } 162 m_proxy.postTaskForModeToWorkerGlobalScope([this, protectedThis = WTFMove(protectedThis), requestIdentifier, result = WTFMove(isolatedResult)](ScriptExecutionContext& context) mutable { 163 ASSERT_UNUSED(context, context.isWorkerGlobalScope()); 164 updateCaches(requestIdentifier, WTFMove(result)); 165 }, m_taskMode); 166 }); 167 }); 168 } 169 170 static inline Vector<CrossThreadRecordData> recordsDataFromRecords(const Vector<Record>& records) 164 171 { 165 172 Vector<CrossThreadRecordData> recordsData; … … 170 177 } 171 178 172 static inline Vector<CacheStorageConnection::Record> recordsFromRecordsData(Vector<CrossThreadRecordData>&& recordsData) 173 { 174 Vector<CacheStorageConnection::Record> records; 179 static inline Expected<Vector<CrossThreadRecordData>, Error> recordsDataOrErrorFromRecords(const RecordsOrError& result) 180 { 181 if (!result.hasValue()) 182 return makeUnexpected(result.error()); 183 184 return recordsDataFromRecords(result.value()); 185 } 186 187 static inline Vector<Record> recordsFromRecordsData(Vector<CrossThreadRecordData>&& recordsData) 188 { 189 Vector<Record> records; 175 190 records.reserveInitialCapacity(recordsData.size()); 176 191 for (auto& recordData : recordsData) … … 179 194 } 180 195 196 static inline RecordsOrError recordsOrErrorFromRecordsData(Expected<Vector<CrossThreadRecordData>, Error>&& recordsData) 197 { 198 if (!recordsData.hasValue()) 199 return makeUnexpected(recordsData.error()); 200 return recordsFromRecordsData(WTFMove(recordsData.value())); 201 } 202 181 203 void WorkerCacheStorageConnection::doRetrieveRecords(uint64_t requestIdentifier, uint64_t cacheIdentifier) 182 204 { … … 185 207 ASSERT(m_mainThreadConnection); 186 208 187 m_mainThreadConnection->retrieveRecords(cacheIdentifier, [this, protectedThis = WTFMove(protectedThis), requestIdentifier]( Vector<Record>&& records) mutable {188 m_proxy.postTaskForModeToWorkerGlobalScope([this, protectedThis = WTFMove(protectedThis), re cordsData = recordsDataFromRecords(records), requestIdentifier](ScriptExecutionContext& context) mutable {189 ASSERT_UNUSED(context, context.isWorkerGlobalScope()); 190 updateRecords(requestIdentifier, records FromRecordsData(WTFMove(recordsData)));209 m_mainThreadConnection->retrieveRecords(cacheIdentifier, [this, protectedThis = WTFMove(protectedThis), requestIdentifier](RecordsOrError&& result) mutable { 210 m_proxy.postTaskForModeToWorkerGlobalScope([this, protectedThis = WTFMove(protectedThis), result = recordsDataOrErrorFromRecords(result), requestIdentifier](ScriptExecutionContext& context) mutable { 211 ASSERT_UNUSED(context, context.isWorkerGlobalScope()); 212 updateRecords(requestIdentifier, recordsOrErrorFromRecordsData(WTFMove(result))); 191 213 }, m_taskMode); 192 214 }); … … 200 222 ASSERT(m_mainThreadConnection); 201 223 202 m_mainThreadConnection->batchDeleteOperation(cacheIdentifier, request, WTFMove(options), [this, protectedThis = WTFMove(protectedThis), requestIdentifier]( Vector<uint64_t>&& records, Error error) mutable {203 204 m_proxy.postTaskForModeToWorkerGlobalScope([this, protectedThis = WTFMove(protectedThis), re cords = WTFMove(records), error, requestIdentifier](ScriptExecutionContext& context) mutable {205 ASSERT_UNUSED(context, context.isWorkerGlobalScope()); 206 deleteRecordsCompleted(requestIdentifier, WTFMove(re cords), error);224 m_mainThreadConnection->batchDeleteOperation(cacheIdentifier, request, WTFMove(options), [this, protectedThis = WTFMove(protectedThis), requestIdentifier](RecordIdentifiersOrError&& result) mutable { 225 226 m_proxy.postTaskForModeToWorkerGlobalScope([this, protectedThis = WTFMove(protectedThis), requestIdentifier, result = WTFMove(result)](ScriptExecutionContext& context) mutable { 227 ASSERT_UNUSED(context, context.isWorkerGlobalScope()); 228 deleteRecordsCompleted(requestIdentifier, WTFMove(result)); 207 229 }, m_taskMode); 208 230 }); … … 216 238 ASSERT(m_mainThreadConnection); 217 239 218 m_mainThreadConnection->batchPutOperation(cacheIdentifier, recordsFromRecordsData(WTFMove(recordsData)), [this, protectedThis = WTFMove(protectedThis), requestIdentifier]( Vector<uint64_t>&& records, Error error) mutable {219 220 m_proxy.postTaskForModeToWorkerGlobalScope([this, protectedThis = WTFMove(protectedThis), re cords = WTFMove(records), error, requestIdentifier](ScriptExecutionContext& context) mutable {221 ASSERT_UNUSED(context, context.isWorkerGlobalScope()); 222 putRecordsCompleted(requestIdentifier, WTFMove(re cords), error);240 m_mainThreadConnection->batchPutOperation(cacheIdentifier, recordsFromRecordsData(WTFMove(recordsData)), [this, protectedThis = WTFMove(protectedThis), requestIdentifier](RecordIdentifiersOrError&& result) mutable { 241 242 m_proxy.postTaskForModeToWorkerGlobalScope([this, protectedThis = WTFMove(protectedThis), requestIdentifier, result = WTFMove(result)](ScriptExecutionContext& context) mutable { 243 ASSERT_UNUSED(context, context.isWorkerGlobalScope()); 244 putRecordsCompleted(requestIdentifier, WTFMove(result)); 223 245 }, m_taskMode); 224 246 }); -
trunk/Source/WebCore/Modules/cache/WorkerCacheStorageConnection.h
r220810 r221112 43 43 44 44 // WebCore::CacheStorageConnection 45 void doOpen(uint64_t requestIdentifier, const String& /* origin */, const String& /* cacheName */) final;46 void doRemove(uint64_t requestIdentifier, uint64_t /* cacheIdentifier */) final;47 void doRetrieveCaches(uint64_t requestIdentifier, const String& /* origin */) final;45 void doOpen(uint64_t requestIdentifier, const String& origin, const String& cacheName) final; 46 void doRemove(uint64_t requestIdentifier, uint64_t cacheIdentifier) final; 47 void doRetrieveCaches(uint64_t requestIdentifier, const String& origin) final; 48 48 49 49 void doRetrieveRecords(uint64_t requestIdentifier, uint64_t cacheIdentifier) final; 50 50 void doBatchDeleteOperation(uint64_t requestIdentifier, uint64_t cacheIdentifier, const WebCore::ResourceRequest&, WebCore::CacheQueryOptions&&) final; 51 void doBatchPutOperation(uint64_t requestIdentifier, uint64_t cacheIdentifier, Vector< Record>&&) final;51 void doBatchPutOperation(uint64_t requestIdentifier, uint64_t cacheIdentifier, Vector<DOMCache::Record>&&) final; 52 52 53 53 WorkerGlobalScope& m_scope; -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r220979 r221112 1793 1793 41FA303E1316C29C00C0BFC5 /* RenderMediaControls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41FA303C1316C29C00C0BFC5 /* RenderMediaControls.cpp */; }; 1794 1794 41FA303F1316C29C00C0BFC5 /* RenderMediaControls.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FA303D1316C29C00C0BFC5 /* RenderMediaControls.h */; }; 1795 41FABD2D1F4DFE4A006A6C97 /* DOMCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FABD2B1F4DFE42006A6C97 /* DOMCache.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1796 41FABD2F1F4E02CB006A6C97 /* DOMCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41FABD2E1F4E0251006A6C97 /* DOMCache.cpp */; }; 1795 1797 41FB279C1F34DB8A00795487 /* DOMWindowCaches.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41FB278E1F34C28200795487 /* DOMWindowCaches.cpp */; }; 1796 1798 41FB279D1F34DB8E00795487 /* WorkerGlobalScopeCaches.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41FB278F1F34C28200795487 /* WorkerGlobalScopeCaches.cpp */; }; … … 9480 9482 41FA303C1316C29C00C0BFC5 /* RenderMediaControls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMediaControls.cpp; sourceTree = "<group>"; }; 9481 9483 41FA303D1316C29C00C0BFC5 /* RenderMediaControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMediaControls.h; sourceTree = "<group>"; }; 9484 41FABD2B1F4DFE42006A6C97 /* DOMCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMCache.h; sourceTree = "<group>"; }; 9485 41FABD2E1F4E0251006A6C97 /* DOMCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMCache.cpp; sourceTree = "<group>"; }; 9482 9486 41FB278C1F34C28200795487 /* DOMWindowCaches.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DOMWindowCaches.h; sourceTree = "<group>"; }; 9483 9487 41FB278D1F34C28200795487 /* WorkerGlobalScopeCaches.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WorkerGlobalScopeCaches.h; sourceTree = "<group>"; }; … … 17691 17695 41D129CC1F3D0EE300D15E47 /* CacheStorageConnection.h */, 17692 17696 41D129CA1F3D0EE300D15E47 /* CacheStorageRecord.h */, 17697 41FABD2E1F4E0251006A6C97 /* DOMCache.cpp */, 17698 41FABD2B1F4DFE42006A6C97 /* DOMCache.h */, 17693 17699 41FB278E1F34C28200795487 /* DOMWindowCaches.cpp */, 17694 17700 41FB278C1F34C28200795487 /* DOMWindowCaches.h */, … … 27232 27238 973889A1116EA9DC00ADF313 /* DocumentWriter.h in Headers */, 27233 27239 1A8F6BC30DB55CDC001DB794 /* DOMApplicationCache.h in Headers */, 27240 41FABD2D1F4DFE4A006A6C97 /* DOMCache.h in Headers */, 27234 27241 FC9A0F75164094CF003D6B8D /* DOMCSSNamespace.h in Headers */, 27235 27242 9B3A8872145632F9003AE8F5 /* DOMDOMSettableTokenList.h in Headers */, … … 31264 31271 973889A0116EA9DC00ADF313 /* DocumentWriter.cpp in Sources */, 31265 31272 1A8F6BC20DB55CDC001DB794 /* DOMApplicationCache.cpp in Sources */, 31273 41FABD2F1F4E02CB006A6C97 /* DOMCache.cpp in Sources */, 31266 31274 FD677738195CAF3D0072E0D3 /* DOMCSSNamespace.cpp in Sources */, 31267 31275 7AABA25914BC613300AA9A11 /* DOMEditor.cpp in Sources */, -
trunk/Source/WebKit/ChangeLog
r221102 r221112 1 2017-08-23 Youenn Fablet <youenn@apple.com> 2 3 [Cache API] Unify WebCore and WebKit error handling 4 https://bugs.webkit.org/show_bug.cgi?id=175902 5 6 Reviewed by Alex Christensen. 7 8 Removing all callbacks and error definitions from WebKit 9 and reusing DOMCache ones instead. 10 11 * NetworkProcess/cache/CacheStorage.h: Removed. 12 * NetworkProcess/cache/CacheStorageEngine.cpp: 13 (WebKit::CacheStorage::Engine::caches const): 14 (WebKit::CacheStorage::Engine::queryCache): 15 * NetworkProcess/cache/CacheStorageEngine.h: 16 * NetworkProcess/cache/CacheStorageEngineCache.h: 17 * NetworkProcess/cache/CacheStorageEngineConnection.cpp: 18 (WebKit::CacheStorageEngineConnection::open): 19 (WebKit::CacheStorageEngineConnection::remove): 20 (WebKit::CacheStorageEngineConnection::putRecords): 21 * NetworkProcess/cache/CacheStorageEngineConnection.h: 22 * NetworkProcess/cache/CacheStorageEngineConnection.messages.in: 23 * Shared/WebCoreArgumentCoders.cpp: 24 (IPC::ArgumentCoder<DOMCache::CacheInfo>::encode): 25 (IPC::ArgumentCoder<DOMCache::CacheInfo>::decode): 26 (IPC::ArgumentCoder<DOMCache::Record>::encode): 27 (IPC::ArgumentCoder<DOMCache::Record>::decode): 28 * Shared/WebCoreArgumentCoders.h: 29 * WebProcess/Cache/WebCacheStorageConnection.cpp: 30 (WebKit::WebCacheStorageConnection::doBatchPutOperation): 31 (WebKit::WebCacheStorageConnection::openCompleted): 32 (WebKit::WebCacheStorageConnection::removeCompleted): 33 (WebKit::WebCacheStorageConnection::updateCaches): 34 (WebKit::WebCacheStorageConnection::updateRecords): 35 (WebKit::WebCacheStorageConnection::deleteRecordsCompleted): 36 (WebKit::WebCacheStorageConnection::putRecordsCompleted): 37 * WebProcess/Cache/WebCacheStorageConnection.h: 38 * WebProcess/Cache/WebCacheStorageConnection.messages.in: 39 1 40 2017-08-23 Alex Christensen <achristensen@webkit.org> 2 41 -
trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp
r221093 r221112 33 33 #include <wtf/text/StringHash.h> 34 34 35 using namespace WebCore::DOMCache; 36 35 37 namespace WebKit { 36 38 … … 127 129 auto& caches = cachesOrError.value().get(); 128 130 129 Vector< WebCore::CacheStorageConnection::CacheInfo> cachesInfo;131 Vector<CacheInfo> cachesInfo; 130 132 cachesInfo.reserveInitialCapacity(caches.size()); 131 133 for (auto& cache : caches) 132 cachesInfo.uncheckedAppend( WebCore::CacheStorageConnection::CacheInfo { cache.identifier, cache.name});134 cachesInfo.uncheckedAppend(CacheInfo { cache.identifier, cache.name}); 133 135 134 136 callback(WTFMove(cachesInfo)); … … 298 300 Vector<uint64_t> results; 299 301 for (const auto& record : records) { 300 if (WebCore:: CacheStorageConnection::queryCacheMatch(request, record.request, record.response, options))302 if (WebCore::DOMCache::queryCacheMatch(request, record.request, record.response, options)) 301 303 results.append(record.identifier); 302 304 } -
trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.h
r221093 r221112 46 46 static void destroyEngine(PAL::SessionID); 47 47 48 void open(const String& origin, const String& cacheName, CacheIdentifierCallback&&);49 void remove(uint64_t cacheIdentifier, CacheIdentifierCallback&&);50 void retrieveCaches(const String& origin, CacheInfosCallback&&);48 void open(const String& origin, const String& cacheName, WebCore::DOMCache::CacheIdentifierCallback&&); 49 void remove(uint64_t cacheIdentifier, WebCore::DOMCache::CacheIdentifierCallback&&); 50 void retrieveCaches(const String& origin, WebCore::DOMCache::CacheInfosCallback&&); 51 51 52 void retrieveRecords(uint64_t cacheIdentifier, RecordsCallback&&);53 void putRecords(uint64_t cacheIdentifier, Vector< Record>&&,RecordIdentifiersCallback&&);54 void deleteMatchingRecords(uint64_t cacheIdentifier, WebCore::ResourceRequest&&, WebCore::CacheQueryOptions&&, RecordIdentifiersCallback&&);52 void retrieveRecords(uint64_t cacheIdentifier, WebCore::DOMCache::RecordsCallback&&); 53 void putRecords(uint64_t cacheIdentifier, Vector<WebCore::DOMCache::Record>&&, WebCore::DOMCache::RecordIdentifiersCallback&&); 54 void deleteMatchingRecords(uint64_t cacheIdentifier, WebCore::ResourceRequest&&, WebCore::CacheQueryOptions&&, WebCore::DOMCache::RecordIdentifiersCallback&&); 55 55 56 56 private: 57 57 static Engine& defaultEngine(); 58 58 59 void writeCachesToDisk( CompletionCallback&&);59 void writeCachesToDisk(WebCore::DOMCache::CompletionCallback&&); 60 60 61 using CachesOrError = Expected<std::reference_wrapper<Vector<Cache>>, Error>;62 using CachesCallback = Function<void(CachesOrError&&)>;63 void readCachesFromDisk(const String& origin, Function<void(CachesOrError&&)>&&);61 using CachesOrError = Expected<std::reference_wrapper<Vector<Cache>>, WebCore::DOMCache::Error>; 62 using CachesCallback = WTF::Function<void(CachesOrError&&)>; 63 void readCachesFromDisk(const String& origin, CachesCallback&&); 64 64 65 using CacheOrError = Expected<std::reference_wrapper<Cache>, Error>; 66 using CacheCallback = Function<void(CacheOrError&&)>; 65 using CacheOrError = Expected<std::reference_wrapper<Cache>, WebCore::DOMCache::Error>; 66 using CacheCallback = WTF::Function<void(CacheOrError&&)>; 67 void readCache(uint64_t cacheIdentifier, CacheCallback&&); 67 68 68 void readCache(uint64_t cacheIdentifier, CacheCallback&&); 69 void writeCacheRecords(uint64_t cacheIdentifier, Vector<uint64_t>&&, RecordIdentifiersCallback&&); 70 void removeCacheRecords(uint64_t cacheIdentifier, Vector<uint64_t>&&, RecordIdentifiersCallback&&); 69 void writeCacheRecords(uint64_t cacheIdentifier, Vector<uint64_t>&&, WebCore::DOMCache::RecordIdentifiersCallback&&); 70 void removeCacheRecords(uint64_t cacheIdentifier, Vector<uint64_t>&&, WebCore::DOMCache::RecordIdentifiersCallback&&); 71 71 72 Vector<uint64_t> queryCache(const Vector< Record>&, const WebCore::ResourceRequest&, const WebCore::CacheQueryOptions&);72 Vector<uint64_t> queryCache(const Vector<WebCore::DOMCache::Record>&, const WebCore::ResourceRequest&, const WebCore::CacheQueryOptions&); 73 73 74 74 Cache* cache(uint64_t cacheIdentifier); -
trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.h
r221093 r221112 26 26 #pragma once 27 27 28 #include "CacheStorage.h"28 #include <WebCore/DOMCache.h> 29 29 #include <wtf/Vector.h> 30 30 #include <wtf/text/WTFString.h> … … 37 37 uint64_t identifier { 0 }; 38 38 String name; 39 Vector< Record> records;39 Vector<WebCore::DOMCache::Record> records; 40 40 uint64_t nextRecordIdentifier { 0 }; 41 41 }; -
trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineConnection.cpp
r221093 r221112 30 30 #include "NetworkConnectionToWebProcess.h" 31 31 #include "WebCacheStorageConnectionMessages.h" 32 #include "WebCoreArgumentCoders.h" 32 33 #include <WebCore/CacheQueryOptions.h> 33 34 35 using namespace WebCore::DOMCache; 34 36 using namespace WebKit::CacheStorage; 35 37 … … 43 45 void CacheStorageEngineConnection::open(PAL::SessionID sessionID, uint64_t requestIdentifier, const String& origin, const String& cacheName) 44 46 { 45 Engine::from(sessionID).open(origin, cacheName, [protectedThis = makeRef(*this), this, sessionID, requestIdentifier]( CacheIdentifierOrError&& result) {47 Engine::from(sessionID).open(origin, cacheName, [protectedThis = makeRef(*this), this, sessionID, requestIdentifier](const CacheIdentifierOrError& result) { 46 48 m_connection.connection().send(Messages::WebCacheStorageConnection::OpenCompleted(requestIdentifier, result), sessionID.sessionID()); 47 49 }); … … 50 52 void CacheStorageEngineConnection::remove(PAL::SessionID sessionID, uint64_t requestIdentifier, uint64_t cacheIdentifier) 51 53 { 52 Engine::from(sessionID).remove(cacheIdentifier, [protectedThis = makeRef(*this), this, sessionID, requestIdentifier]( CacheIdentifierOrError&& result) {54 Engine::from(sessionID).remove(cacheIdentifier, [protectedThis = makeRef(*this), this, sessionID, requestIdentifier](const CacheIdentifierOrError& result) { 53 55 m_connection.connection().send(Messages::WebCacheStorageConnection::RemoveCompleted(requestIdentifier, result), sessionID.sessionID()); 54 56 }); … … 76 78 } 77 79 78 void CacheStorageEngineConnection::putRecords(PAL::SessionID sessionID, uint64_t requestIdentifier, uint64_t cacheIdentifier, Vector< WebCore::CacheStorageConnection::Record>&& records)80 void CacheStorageEngineConnection::putRecords(PAL::SessionID sessionID, uint64_t requestIdentifier, uint64_t cacheIdentifier, Vector<Record>&& records) 79 81 { 80 82 Engine::from(sessionID).putRecords(cacheIdentifier, WTFMove(records), [protectedThis = makeRef(*this), this, sessionID, requestIdentifier](RecordIdentifiersOrError&& result) { -
trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineConnection.h
r220917 r221112 57 57 void records(PAL::SessionID, uint64_t requestIdentifier, uint64_t cacheIdentifier); 58 58 void deleteMatchingRecords(PAL::SessionID, uint64_t requestIdentifier, uint64_t cacheIdentifier, WebCore::ResourceRequest&&, WebCore::CacheQueryOptions&&); 59 void putRecords(PAL::SessionID, uint64_t requestIdentifier, uint64_t cacheIdentifier, Vector<WebCore:: CacheStorageConnection::Record>&&);59 void putRecords(PAL::SessionID, uint64_t requestIdentifier, uint64_t cacheIdentifier, Vector<WebCore::DOMCache::Record>&&); 60 60 61 61 NetworkConnectionToWebProcess& m_connection; -
trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineConnection.messages.in
r220917 r221112 28 28 Records(PAL::SessionID sessionID, uint64_t requestIdentifier, uint64_t cacheIdentifier); 29 29 DeleteMatchingRecords(PAL::SessionID sessionID, uint64_t requestIdentifier, uint64_t cacheIdentifier, WebCore::ResourceRequest request, struct WebCore::CacheQueryOptions options); 30 PutRecords(PAL::SessionID sessionID, uint64_t requestIdentifier, uint64_t cacheIdentifier, Vector<WebCore:: CacheStorageConnection::Record> record);30 PutRecords(PAL::SessionID sessionID, uint64_t requestIdentifier, uint64_t cacheIdentifier, Vector<WebCore::DOMCache::Record> record); 31 31 } -
trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp
r221086 r221112 215 215 } 216 216 217 void ArgumentCoder< CacheStorageConnection::CacheInfo>::encode(Encoder& encoder, const CacheStorageConnection::CacheInfo& info)217 void ArgumentCoder<DOMCache::CacheInfo>::encode(Encoder& encoder, const DOMCache::CacheInfo& info) 218 218 { 219 219 encoder << info.identifier; … … 221 221 } 222 222 223 bool ArgumentCoder< CacheStorageConnection::CacheInfo>::decode(Decoder& decoder, CacheStorageConnection::CacheInfo& record)223 bool ArgumentCoder<DOMCache::CacheInfo>::decode(Decoder& decoder, DOMCache::CacheInfo& record) 224 224 { 225 225 uint64_t identifier; … … 237 237 } 238 238 239 void ArgumentCoder< CacheStorageConnection::Record>::encode(Encoder& encoder, const CacheStorageConnection::Record& record)239 void ArgumentCoder<DOMCache::Record>::encode(Encoder& encoder, const DOMCache::Record& record) 240 240 { 241 241 encoder << record.identifier; … … 263 263 } 264 264 265 bool ArgumentCoder< CacheStorageConnection::Record>::decode(Decoder& decoder, CacheStorageConnection::Record& record)265 bool ArgumentCoder<DOMCache::Record>::decode(Decoder& decoder, DOMCache::Record& record) 266 266 { 267 267 uint64_t identifier; … … 297 297 return false; 298 298 299 WebCore:: CacheStorageConnection::ResponseBody responseBody;299 WebCore::DOMCache::ResponseBody responseBody; 300 300 bool hasSharedBufferBody; 301 301 if (!decoder.decode(hasSharedBufferBody)) -
trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h
r221086 r221112 201 201 }; 202 202 203 template<> struct ArgumentCoder<WebCore:: CacheStorageConnection::CacheInfo> {204 static void encode(Encoder&, const WebCore:: CacheStorageConnection::CacheInfo&);205 static bool decode(Decoder&, WebCore:: CacheStorageConnection::CacheInfo&);206 }; 207 208 template<> struct ArgumentCoder<WebCore:: CacheStorageConnection::Record> {209 static void encode(Encoder&, const WebCore:: CacheStorageConnection::Record&);210 static bool decode(Decoder&, WebCore:: CacheStorageConnection::Record&);203 template<> struct ArgumentCoder<WebCore::DOMCache::CacheInfo> { 204 static void encode(Encoder&, const WebCore::DOMCache::CacheInfo&); 205 static bool decode(Decoder&, WebCore::DOMCache::CacheInfo&); 206 }; 207 208 template<> struct ArgumentCoder<WebCore::DOMCache::Record> { 209 static void encode(Encoder&, const WebCore::DOMCache::Record&); 210 static bool decode(Decoder&, WebCore::DOMCache::Record&); 211 211 }; 212 212 … … 787 787 }; 788 788 789 template<> struct EnumTraits<WebCore::CacheStorageConnection::Error> {790 using values = EnumValues<791 WebCore::CacheStorageConnection::Error,792 WebCore::CacheStorageConnection::Error::None,793 WebCore::CacheStorageConnection::Error::NotImplemented794 >;795 };796 797 789 } // namespace WTF -
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
r221093 r221112 907 907 41DC459F1E3DBDA500B11F51 /* WebRTCSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FAF5F31E3BFE7F001AE678 /* WebRTCSocket.h */; }; 908 908 41DC45A11E3DC53F00B11F51 /* WebRTCResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41DC45A01E3DC53C00B11F51 /* WebRTCResolver.cpp */; }; 909 41FABD291F4DE001006A6C97 /* CacheStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FABD271F4DDFDC006A6C97 /* CacheStorage.h */; };910 909 41FABD2A1F4DE001006A6C97 /* CacheStorageEngineCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FABD281F4DDFDC006A6C97 /* CacheStorageEngineCache.h */; }; 911 910 41FAF5F51E3C0649001AE678 /* WebRTCResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FAF5F41E3C0641001AE678 /* WebRTCResolver.h */; }; … … 3180 3179 41DC459D1E3DBCF000B11F51 /* WebRTCSocket.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebRTCSocket.cpp; path = Network/webrtc/WebRTCSocket.cpp; sourceTree = "<group>"; }; 3181 3180 41DC45A01E3DC53C00B11F51 /* WebRTCResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebRTCResolver.cpp; path = Network/webrtc/WebRTCResolver.cpp; sourceTree = "<group>"; }; 3182 41FABD271F4DDFDC006A6C97 /* CacheStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheStorage.h; sourceTree = "<group>"; };3183 3181 41FABD281F4DDFDC006A6C97 /* CacheStorageEngineCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheStorageEngineCache.h; sourceTree = "<group>"; }; 3184 3182 41FAF5F31E3BFE7F001AE678 /* WebRTCSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebRTCSocket.h; path = Network/webrtc/WebRTCSocket.h; sourceTree = "<group>"; }; … … 8195 8193 isa = PBXGroup; 8196 8194 children = ( 8197 41FABD271F4DDFDC006A6C97 /* CacheStorage.h */,8198 8195 41897ED61F415D860016FA42 /* CacheStorageEngine.cpp */, 8199 8196 41897ED21F415D850016FA42 /* CacheStorageEngine.h */, … … 8431 8428 1A5705111BE410E600874AF1 /* BlockSPI.h in Headers */, 8432 8429 BC3065FA1259344E00E71278 /* CacheModel.h in Headers */, 8433 41FABD291F4DE001006A6C97 /* CacheStorage.h in Headers */,8434 8430 41897ED81F415D8A0016FA42 /* CacheStorageEngine.h in Headers */, 8435 8431 41FABD2A1F4DE001006A6C97 /* CacheStorageEngineCache.h in Headers */, -
trunk/Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.cpp
r221093 r221112 27 27 #include "WebCacheStorageConnection.h" 28 28 29 #include "CacheStorageEngine.h" 29 30 #include "CacheStorageEngineConnectionMessages.h" 30 31 #include "NetworkConnectionToWebProcessMessages.h" … … 35 36 #include <wtf/MainThread.h> 36 37 38 using namespace WebCore::DOMCache; 37 39 using namespace WebKit::CacheStorage; 38 40 … … 80 82 } 81 83 82 void WebCacheStorageConnection::doBatchPutOperation(uint64_t requestIdentifier, uint64_t cacheIdentifier, Vector< WebCore::CacheStorageConnection::Record>&& records)84 void WebCacheStorageConnection::doBatchPutOperation(uint64_t requestIdentifier, uint64_t cacheIdentifier, Vector<Record>&& records) 83 85 { 84 86 connection().send(Messages::CacheStorageEngineConnection::PutRecords(m_sessionID, requestIdentifier, cacheIdentifier, records), 0); 85 87 } 86 88 87 void WebCacheStorageConnection::openCompleted(uint64_t requestIdentifier, CacheIdentifierOrError&& result)89 void WebCacheStorageConnection::openCompleted(uint64_t requestIdentifier, const CacheIdentifierOrError& result) 88 90 { 89 CacheStorageConnection::openCompleted(requestIdentifier, result .hasValue() ? result.value() : 0, !result.hasValue() ? Error::Internal : Error::None);91 CacheStorageConnection::openCompleted(requestIdentifier, result); 90 92 } 91 93 92 void WebCacheStorageConnection::removeCompleted(uint64_t requestIdentifier, CacheIdentifierOrError&& result)94 void WebCacheStorageConnection::removeCompleted(uint64_t requestIdentifier, const CacheIdentifierOrError& result) 93 95 { 94 CacheStorageConnection::removeCompleted(requestIdentifier, result .hasValue() ? result.value() : 0, !result.hasValue() ? Error::Internal : Error::None);96 CacheStorageConnection::removeCompleted(requestIdentifier, result); 95 97 } 96 98 97 99 void WebCacheStorageConnection::updateCaches(uint64_t requestIdentifier, CacheInfosOrError&& result) 98 100 { 99 CacheStorageConnection::updateCaches(requestIdentifier, result.hasValue() ? result.value() : Vector<CacheInfo>());101 CacheStorageConnection::updateCaches(requestIdentifier, WTFMove(result)); 100 102 } 101 103 102 104 void WebCacheStorageConnection::updateRecords(uint64_t requestIdentifier, RecordsOrError&& result) 103 105 { 104 CacheStorageConnection::updateRecords(requestIdentifier, result.hasValue() ? WTFMove(result.value()) : Vector<Record>());106 CacheStorageConnection::updateRecords(requestIdentifier, WTFMove(result)); 105 107 } 106 108 107 109 void WebCacheStorageConnection::deleteRecordsCompleted(uint64_t requestIdentifier, RecordIdentifiersOrError&& result) 108 110 { 109 CacheStorageConnection::deleteRecordsCompleted(requestIdentifier, result.hasValue() ? result.value() : Vector<uint64_t>(), !result.hasValue() ? Error::Internal : Error::None);111 CacheStorageConnection::deleteRecordsCompleted(requestIdentifier, WTFMove(result)); 110 112 } 111 113 112 114 void WebCacheStorageConnection::putRecordsCompleted(uint64_t requestIdentifier, RecordIdentifiersOrError&& result) 113 115 { 114 CacheStorageConnection::putRecordsCompleted(requestIdentifier, result.hasValue() ? result.value() : Vector<uint64_t>(), !result.hasValue() ? Error::Internal : Error::None);116 CacheStorageConnection::putRecordsCompleted(requestIdentifier, WTFMove(result)); 115 117 } 116 118 -
trunk/Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.h
r221093 r221112 26 26 #pragma once 27 27 28 #include "CacheStorage.h"29 28 #include <WebCore/CacheStorageConnection.h> 30 29 #include <wtf/HashMap.h> … … 60 59 void doRetrieveRecords(uint64_t requestIdentifier, uint64_t cacheIdentifier) final; 61 60 void doBatchDeleteOperation(uint64_t requestIdentifier, uint64_t cacheIdentifier, const WebCore::ResourceRequest&, WebCore::CacheQueryOptions&&) final; 62 void doBatchPutOperation(uint64_t requestIdentifier, uint64_t cacheIdentifier, Vector< Record>&&) final;61 void doBatchPutOperation(uint64_t requestIdentifier, uint64_t cacheIdentifier, Vector<WebCore::DOMCache::Record>&&) final; 63 62 64 void openCompleted(uint64_t requestIdentifier, CacheStorage::CacheIdentifierOrError&&);65 void removeCompleted(uint64_t requestIdentifier, CacheStorage::CacheIdentifierOrError&&);66 void updateCaches(uint64_t requestIdentifier, CacheStorage::CacheInfosOrError&&);63 void openCompleted(uint64_t requestIdentifier, const WebCore::DOMCache::CacheIdentifierOrError&); 64 void removeCompleted(uint64_t requestIdentifier, const WebCore::DOMCache::CacheIdentifierOrError&); 65 void updateCaches(uint64_t requestIdentifier, WebCore::DOMCache::CacheInfosOrError&&); 67 66 68 void updateRecords(uint64_t requestIdentifier, CacheStorage::RecordsOrError&&);69 void deleteRecordsCompleted(uint64_t requestIdentifier, CacheStorage::RecordIdentifiersOrError&&);70 void putRecordsCompleted(uint64_t requestIdentifier, CacheStorage::RecordIdentifiersOrError&&);67 void updateRecords(uint64_t requestIdentifier, WebCore::DOMCache::RecordsOrError&&); 68 void deleteRecordsCompleted(uint64_t requestIdentifier, WebCore::DOMCache::RecordIdentifiersOrError&&); 69 void putRecordsCompleted(uint64_t requestIdentifier, WebCore::DOMCache::RecordIdentifiersOrError&&); 71 70 72 71 WebCacheStorageProvider& m_provider; -
trunk/Source/WebKit/WebProcess/Cache/WebCacheStorageConnection.messages.in
r221093 r221112 22 22 23 23 messages -> WebCacheStorageConnection { 24 OpenCompleted(uint64_t requestIdentifier, Web Kit::CacheStorage::CacheIdentifierOrError result);25 RemoveCompleted(uint64_t requestIdentifier, Web Kit::CacheStorage::CacheIdentifierOrError result);26 UpdateCaches(uint64_t requestIdentifier, Web Kit::CacheStorage::CacheInfosOrError result);24 OpenCompleted(uint64_t requestIdentifier, WebCore::DOMCache::CacheIdentifierOrError result); 25 RemoveCompleted(uint64_t requestIdentifier, WebCore::DOMCache::CacheIdentifierOrError result); 26 UpdateCaches(uint64_t requestIdentifier, WebCore::DOMCache::CacheInfosOrError result); 27 27 28 UpdateRecords(uint64_t requestIdentifier, Web Kit::CacheStorage::RecordsOrError result);29 DeleteRecordsCompleted(uint64_t requestIdentifier, Web Kit::CacheStorage::RecordIdentifiersOrError result);30 PutRecordsCompleted(uint64_t requestIdentifier, Web Kit::CacheStorage::RecordIdentifiersOrError result);28 UpdateRecords(uint64_t requestIdentifier, WebCore::DOMCache::RecordsOrError result); 29 DeleteRecordsCompleted(uint64_t requestIdentifier, WebCore::DOMCache::RecordIdentifiersOrError result); 30 PutRecordsCompleted(uint64_t requestIdentifier, WebCore::DOMCache::RecordIdentifiersOrError result); 31 31 }
Note: See TracChangeset
for help on using the changeset viewer.