Diff
Modified: trunk/Source/WebCore/ChangeLog (228908 => 228909)
--- trunk/Source/WebCore/ChangeLog 2018-02-22 00:20:40 UTC (rev 228908)
+++ trunk/Source/WebCore/ChangeLog 2018-02-22 00:28:20 UTC (rev 228909)
@@ -1,3 +1,27 @@
+2018-02-21 Youenn Fablet <[email protected]>
+
+ Make SubstituteResource take a ResourceResponse r-value
+ https://bugs.webkit.org/show_bug.cgi?id=183020
+
+ Reviewed by Alex Christensen.
+
+ No change of behavior.
+ Make SubstituteResource take a ResourceResponse r-value.
+ Update ArchiveResource accordingly.
+ Take benefit of that in ApplicationCacheResource to set the response source to ApplicationCache
+ before passing it to SubstituteResource constructor.
+
+ * loader/SubstituteResource.h:
+ (WebCore::SubstituteResource::SubstituteResource):
+ (WebCore::SubstituteResource::resourceResponse): Deleted.
+ * loader/appcache/ApplicationCacheResource.cpp:
+ (WebCore::ApplicationCacheResource::create):
+ (WebCore::ApplicationCacheResource::ApplicationCacheResource):
+ * loader/appcache/ApplicationCacheResource.h:
+ (WebCore::ApplicationCacheResource::create): Deleted.
+ * loader/archive/ArchiveResource.cpp:
+ (WebCore::ArchiveResource::ArchiveResource):
+
2018-02-21 Zalan Bujtas <[email protected]>
[RenderTreeBuilder] ::willBeRemoved() does not need RenderTreeBuilder anymore.
Modified: trunk/Source/WebCore/loader/SubstituteResource.h (228908 => 228909)
--- trunk/Source/WebCore/loader/SubstituteResource.h 2018-02-22 00:20:40 UTC (rev 228908)
+++ trunk/Source/WebCore/loader/SubstituteResource.h 2018-02-22 00:28:20 UTC (rev 228909)
@@ -42,15 +42,13 @@
virtual void deliver(ResourceLoader& loader) { loader.deliverResponseAndData(m_response, m_data->copy()); }
protected:
- SubstituteResource(const URL& url, const ResourceResponse& response, Ref<SharedBuffer>&& data)
- : m_url(url)
- , m_response(response)
+ SubstituteResource(URL&& url, ResourceResponse&& response, Ref<SharedBuffer>&& data)
+ : m_url(WTFMove(url))
+ , m_response(WTFMove(response))
, m_data(WTFMove(data))
{
}
- ResourceResponse& resourceResponse() { return m_response; }
-
private:
URL m_url;
ResourceResponse m_response;
Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheResource.cpp (228908 => 228909)
--- trunk/Source/WebCore/loader/appcache/ApplicationCacheResource.cpp 2018-02-22 00:20:40 UTC (rev 228908)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheResource.cpp 2018-02-22 00:28:20 UTC (rev 228909)
@@ -29,14 +29,24 @@
namespace WebCore {
-ApplicationCacheResource::ApplicationCacheResource(const URL& url, const ResourceResponse& response, unsigned type, Ref<SharedBuffer>&& data, const String& path)
- : SubstituteResource(url, response, WTFMove(data))
+Ref<ApplicationCacheResource> ApplicationCacheResource::create(const URL& url, const ResourceResponse& response, unsigned type, RefPtr<SharedBuffer>&& buffer, const String& path)
+{
+ ASSERT(!url.hasFragmentIdentifier());
+ if (!buffer)
+ buffer = SharedBuffer::create();
+ auto resourceResponse = response;
+ resourceResponse.setSource(ResourceResponse::Source::ApplicationCache);
+
+ return adoptRef(*new ApplicationCacheResource(URL { url }, WTFMove(resourceResponse), type, buffer.releaseNonNull(), path));
+}
+
+ApplicationCacheResource::ApplicationCacheResource(URL&& url, ResourceResponse&& response, unsigned type, Ref<SharedBuffer>&& data, const String& path)
+ : SubstituteResource(WTFMove(url), WTFMove(response), WTFMove(data))
, m_type(type)
, m_storageID(0)
, m_estimatedSizeInStorage(0)
, m_path(path)
{
- resourceResponse().setSource(ResourceResponse::Source::ApplicationCache);
}
void ApplicationCacheResource::deliver(ResourceLoader& loader)
Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheResource.h (228908 => 228909)
--- trunk/Source/WebCore/loader/appcache/ApplicationCacheResource.h 2018-02-22 00:20:40 UTC (rev 228908)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheResource.h 2018-02-22 00:28:20 UTC (rev 228909)
@@ -38,15 +38,9 @@
Foreign = 1 << 3,
Fallback = 1 << 4
};
-
- static Ref<ApplicationCacheResource> create(const URL& url, const ResourceResponse& response, unsigned type, RefPtr<SharedBuffer> buffer = SharedBuffer::create(), const String& path = String())
- {
- ASSERT(!url.hasFragmentIdentifier());
- if (!buffer)
- buffer = SharedBuffer::create();
- return adoptRef(*new ApplicationCacheResource(url, response, type, buffer.releaseNonNull(), path));
- }
+ static Ref<ApplicationCacheResource> create(const URL&, const ResourceResponse&, unsigned type, RefPtr<SharedBuffer>&& = SharedBuffer::create(), const String& path = String());
+
unsigned type() const { return m_type; }
void addType(unsigned type);
@@ -63,7 +57,7 @@
#endif
private:
- ApplicationCacheResource(const URL&, const ResourceResponse&, unsigned type, Ref<SharedBuffer>&&, const String& path);
+ ApplicationCacheResource(URL&&, ResourceResponse&&, unsigned type, Ref<SharedBuffer>&&, const String& path);
void deliver(ResourceLoader&) override;
Modified: trunk/Source/WebCore/loader/archive/ArchiveResource.cpp (228908 => 228909)
--- trunk/Source/WebCore/loader/archive/ArchiveResource.cpp 2018-02-22 00:20:40 UTC (rev 228908)
+++ trunk/Source/WebCore/loader/archive/ArchiveResource.cpp 2018-02-22 00:28:20 UTC (rev 228909)
@@ -34,7 +34,7 @@
namespace WebCore {
inline ArchiveResource::ArchiveResource(Ref<SharedBuffer>&& data, const URL& url, const String& mimeType, const String& textEncoding, const String& frameName, const ResourceResponse& response)
- : SubstituteResource(url, response, WTFMove(data))
+ : SubstituteResource(URL { url }, ResourceResponse { response }, WTFMove(data))
, m_mimeType(mimeType)
, m_textEncoding(textEncoding)
, m_frameName(frameName)