RESOLVED FIXED 175505
Update CachedResourceLoader::requestResource() to return a WTF::Expected
https://bugs.webkit.org/show_bug.cgi?id=175505
Summary Update CachedResourceLoader::requestResource() to return a WTF::Expected
Chris Dumez
Reported 2017-08-11 16:55:22 PDT
Update CachedResourceLoader::requestResource() & co. to return a WTF::Expected instead of using an out parameter for the ResourceError.
Attachments
Patch (49.54 KB, patch)
2017-08-12 23:26 PDT, Chris Dumez
no flags
Patch (51.55 KB, patch)
2017-08-13 09:18 PDT, Chris Dumez
no flags
Patch (53.77 KB, patch)
2017-08-14 09:54 PDT, Chris Dumez
no flags
Patch (54.16 KB, patch)
2017-08-15 12:40 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2017-08-12 23:26:41 PDT
Chris Dumez
Comment 2 2017-08-12 23:27:12 PDT
@Sam: Here is what it looks like.
Chris Dumez
Comment 3 2017-08-13 09:18:32 PDT
youenn fablet
Comment 4 2017-08-13 20:30:43 PDT
Comment on attachment 318010 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=318010&action=review > Source/WebCore/loader/cache/CachedResourceLoader.cpp:93 > + return CachedResourceHandle<T> { static_cast<T*>(cachedResource.value().get()) }; In changed code, a downcast was used. Why using a static_cast here? > Source/WebCore/loader/cache/CachedResourceLoader.cpp:729 > + CachedResourceHandle<CachedResource> resource = createResource(type, WTFMove(request), sessionID()); Can we make createResource return a CachedResourceHandle<CachedResource> instead? > Source/WebCore/loader/cache/CachedResourceLoader.cpp:800 > + if (!shouldContinueAfterNotifyingLoadedFromMemoryCache(request, resource.get(), error)) Would returning an optional make it better? > Source/WebCore/loader/cache/CachedResourceLoader.cpp:839 > + return makeUnexpected(ResourceError { String(), 0, url, String(), ResourceError::Type::AccessControl }); AccessControl is usually the reason of immediate failures. Would be cool to have not null resource errors in the future. > Source/WebCore/loader/cache/CachedResourceLoader.cpp:1258 > + auto resourceValue = resource.value(); auto& maybe? > Source/WebCore/loader/cache/CachedResourceLoader.h:178 > + bool shouldContinueAfterNotifyingLoadedFromMemoryCache(const CachedResourceRequest&, CachedResource*, ResourceError&); Pre-existing code issue but it would seem that we should pass a const CachedResource* and probably even better a const CachedResource&.
Chris Dumez
Comment 5 2017-08-14 09:54:05 PDT
Chris Dumez
Comment 6 2017-08-15 12:40:16 PDT
Chris Dumez
Comment 7 2017-08-15 14:15:13 PDT
Comment on attachment 318149 [details] Patch Clearing flags on attachment: 318149 Committed r220760: <http://trac.webkit.org/changeset/220760>
Chris Dumez
Comment 8 2017-08-15 14:15:15 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 9 2017-08-15 14:16:06 PDT
Note You need to log in before you can comment on or make changes to this bug.