Commit 31d4115a authored by andersca@apple.com's avatar andersca@apple.com

2008-04-15 Anders Carlsson <andersca@apple.com>

        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):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@31916 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d877372b
2008-04-15 Anders Carlsson <andersca@apple.com>
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 <hyatt@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=18467
......@@ -28,9 +28,32 @@
#include <wtf/RefCounted.h>
#include "KURL.h"
#include "ResourceResponse.h"
#include "SharedBuffer.h"
#include <wtf/RefPtr.h>
namespace WebCore {
class SubstituteResource : public RefCounted<SubstituteResource> {
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<SharedBuffer> data)
: m_url(url)
, m_response(response)
, m_data(data)
{
}
private:
KURL m_url;
ResourceResponse m_response;
RefPtr<SharedBuffer> m_data;
};
}
......
......@@ -49,33 +49,27 @@ PassRefPtr<ArchiveResource> ArchiveResource::create(PassRefPtr<SharedBuffer> dat
}
ArchiveResource::ArchiveResource(PassRefPtr<SharedBuffer> 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<SharedBuffer> 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<SharedBuffer> 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)
{
}
......
......@@ -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<ArchiveResource> create(PassRefPtr<SharedBuffer>, const KURL&, const String& mimeType, const String& textEncoding, const String& frameName);
static PassRefPtr<ArchiveResource> create(PassRefPtr<SharedBuffer>, 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<SharedBuffer>, const KURL&, const String& mimeType, const String& textEncoding, const String& frameName);
ArchiveResource(PassRefPtr<SharedBuffer>, const KURL&, const String& mimeType, const String& textEncoding, const String& frameName, const ResourceResponse&);
RefPtr<SharedBuffer> m_data;
KURL m_url;
String m_mimeType;
String m_textEncoding;
String m_frameName;
ResourceResponse m_response;
bool m_shouldIgnoreWhenUnarchiving;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment