diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index 5154b87bb1eab31cf94d2212087193c755c677e8..1664e766cb6498247f481a3ba0ac9b0f85d4a34e 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,19 @@ +2008-04-15 Anders Carlsson + + Reviewed by Adam. + + Move the URL, response and data to SubstituteResource. + + * loader/SubstituteResource.h: + (WebCore::SubstituteResource::url): + (WebCore::SubstituteResource::response): + (WebCore::SubstituteResource::data): + (WebCore::SubstituteResource::SubstituteResource): + * loader/archive/ArchiveResource.cpp: + (WebCore::ArchiveResource::ArchiveResource): + * loader/archive/ArchiveResource.h: + (WebCore::ArchiveResource::frameName): + 2008-04-15 David Hyatt https://bugs.webkit.org/show_bug.cgi?id=18467 diff --git a/WebCore/loader/SubstituteResource.h b/WebCore/loader/SubstituteResource.h index b51923cf002e7f7ed01fd39a30326ba853242dfd..003c3349ecadbc95b172fc49e009060cdb973b21 100644 --- a/WebCore/loader/SubstituteResource.h +++ b/WebCore/loader/SubstituteResource.h @@ -28,9 +28,32 @@ #include +#include "KURL.h" +#include "ResourceResponse.h" +#include "SharedBuffer.h" + +#include + namespace WebCore { class SubstituteResource : public RefCounted { +public: + const KURL& url() const { return m_url; } + const ResourceResponse& response() const { return m_response; } + SharedBuffer* data() const { return m_data.get(); } + +protected: + SubstituteResource(const KURL& url, const ResourceResponse& response, PassRefPtr data) + : m_url(url) + , m_response(response) + , m_data(data) + { + } + +private: + KURL m_url; + ResourceResponse m_response; + RefPtr m_data; }; } diff --git a/WebCore/loader/archive/ArchiveResource.cpp b/WebCore/loader/archive/ArchiveResource.cpp index 592e5607ed21c7defe6800b7e57fd8661a9e1678..43e852f3fa352d020a7e3438bab84757a94a5242 100644 --- a/WebCore/loader/archive/ArchiveResource.cpp +++ b/WebCore/loader/archive/ArchiveResource.cpp @@ -49,33 +49,27 @@ PassRefPtr ArchiveResource::create(PassRefPtr dat } ArchiveResource::ArchiveResource(PassRefPtr data, const KURL& url, const ResourceResponse& response) - : m_data(data) - , m_url(url) + : SubstituteResource(url, response, data) , m_mimeType(response.mimeType()) , m_textEncoding(response.textEncodingName()) - , m_response(response) , m_shouldIgnoreWhenUnarchiving(false) { } ArchiveResource::ArchiveResource(PassRefPtr data, const KURL& url, const String& mimeType, const String& textEncoding, const String& frameName) - : m_data(data) - , m_url(url) + : SubstituteResource(url, ResourceResponse(url, mimeType, data ? data->size() : 0, textEncoding, String()), data) , m_mimeType(mimeType) , m_textEncoding(textEncoding) , m_frameName(frameName) - , m_response(ResourceResponse(m_url, m_mimeType, m_data ? m_data->size() : 0, m_textEncoding, String())) , m_shouldIgnoreWhenUnarchiving(false) { } ArchiveResource::ArchiveResource(PassRefPtr data, const KURL& url, const String& mimeType, const String& textEncoding, const String& frameName, const ResourceResponse& response) - : m_data(data) - , m_url(url) + : SubstituteResource(url, response.isNull() ? ResourceResponse(url, mimeType, data ? data->size() : 0, textEncoding, String()) : response, data) , m_mimeType(mimeType) , m_textEncoding(textEncoding) , m_frameName(frameName) - , m_response(response.isNull() ? ResourceResponse(m_url, m_mimeType, m_data ? m_data->size() : 0, m_textEncoding, String()) : response) , m_shouldIgnoreWhenUnarchiving(false) { } diff --git a/WebCore/loader/archive/ArchiveResource.h b/WebCore/loader/archive/ArchiveResource.h index 76dae177312eff31352704af3d8daf47d87d2878..d975e045006d0112df1973416ef7900e6bb88b47 100644 --- a/WebCore/loader/archive/ArchiveResource.h +++ b/WebCore/loader/archive/ArchiveResource.h @@ -31,10 +31,7 @@ #include "SubstituteResource.h" -#include "KURL.h" #include "PlatformString.h" -#include "ResourceResponse.h" -#include "SharedBuffer.h" namespace WebCore { @@ -44,13 +41,9 @@ public: static PassRefPtr create(PassRefPtr, const KURL&, const String& mimeType, const String& textEncoding, const String& frameName); static PassRefPtr create(PassRefPtr, const KURL&, const String& mimeType, const String& textEncoding, const String& frameName, const ResourceResponse&); - SharedBuffer* data() { return m_data.get(); } - - const KURL& url() const { return m_url; } const String& mimeType() const { return m_mimeType; } const String& textEncoding() const { return m_textEncoding; } const String& frameName() const { return m_frameName; } - const ResourceResponse& response() const { return m_response; } void ignoreWhenUnarchiving() { m_shouldIgnoreWhenUnarchiving = true; } bool shouldIgnoreWhenUnarchiving() const { return m_shouldIgnoreWhenUnarchiving; } @@ -60,14 +53,10 @@ private: ArchiveResource(PassRefPtr, const KURL&, const String& mimeType, const String& textEncoding, const String& frameName); ArchiveResource(PassRefPtr, const KURL&, const String& mimeType, const String& textEncoding, const String& frameName, const ResourceResponse&); - RefPtr m_data; - KURL m_url; String m_mimeType; String m_textEncoding; String m_frameName; - ResourceResponse m_response; - bool m_shouldIgnoreWhenUnarchiving; };