Commit d778ab0b authored by commit-queue@webkit.org's avatar commit-queue@webkit.org
Browse files

2010-08-24 Patrick Gansterer <paroga@paroga.com>

        Reviewed by Adam Roben.

        Add SynchronousLoader for ResourceHandleWin
        https://bugs.webkit.org/show_bug.cgi?id=44452

        * platform/network/win/ResourceHandleWin.cpp:
        (WebCore::WebCoreSynchronousLoader::WebCoreSynchronousLoader):
        (WebCore::WebCoreSynchronousLoader::didReceiveResponse):
        (WebCore::WebCoreSynchronousLoader::didReceiveData):
        (WebCore::WebCoreSynchronousLoader::didFinishLoading):
        (WebCore::WebCoreSynchronousLoader::didFail):
        (WebCore::ResourceHandle::loadResourceSynchronously):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65957 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 20859a46
2010-08-24 Patrick Gansterer <paroga@paroga.com>
Reviewed by Adam Roben.
Add SynchronousLoader for ResourceHandleWin
https://bugs.webkit.org/show_bug.cgi?id=44452
* platform/network/win/ResourceHandleWin.cpp:
(WebCore::WebCoreSynchronousLoader::WebCoreSynchronousLoader):
(WebCore::WebCoreSynchronousLoader::didReceiveResponse):
(WebCore::WebCoreSynchronousLoader::didReceiveData):
(WebCore::WebCoreSynchronousLoader::didFinishLoading):
(WebCore::WebCoreSynchronousLoader::didFail):
(WebCore::ResourceHandle::loadResourceSynchronously):
2010-08-24 Ryosuke Niwa <rniwa@webkit.org>
 
Unreviewed.
......@@ -137,6 +137,49 @@ static void initializeOffScreenResourceHandleWindow()
HWND_MESSAGE, 0, WebCore::instanceHandle(), 0);
}
class WebCoreSynchronousLoader : public ResourceHandleClient, public Noncopyable {
public:
WebCoreSynchronousLoader(ResourceError&, ResourceResponse&, Vector<char>&, const String& userAgent);
virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&);
virtual void didReceiveData(ResourceHandle*, const char*, int, int lengthReceived);
virtual void didFinishLoading(ResourceHandle*);
virtual void didFail(ResourceHandle*, const ResourceError&);
private:
ResourceError& m_error;
ResourceResponse& m_response;
Vector<char>& m_data;
};
WebCoreSynchronousLoader::WebCoreSynchronousLoader(ResourceError& error, ResourceResponse& response, Vector<char>& data, const String& userAgent)
: m_error(error)
, m_response(response)
, m_data(data)
{
}
void WebCoreSynchronousLoader::didReceiveResponse(ResourceHandle*, const ResourceResponse& response)
{
m_response = response;
}
void WebCoreSynchronousLoader::didReceiveData(ResourceHandle*, const char* data, int length, int)
{
m_data.append(data, length);
}
void WebCoreSynchronousLoader::didFinishLoading(ResourceHandle*)
{
}
void WebCoreSynchronousLoader::didFail(ResourceHandle*, const ResourceError& error)
{
m_error = error;
}
ResourceHandleInternal::~ResourceHandleInternal()
{
if (m_fileHandle != INVALID_HANDLE_VALUE)
......@@ -486,6 +529,16 @@ void ResourceHandle::cancel()
client()->didFail(this, ResourceError());
}
void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& data, Frame* frame)
{
UNUSED_PARAM(storedCredentials);
WebCoreSynchronousLoader syncLoader(error, response, data, request.httpUserAgent());
ResourceHandle handle(request, &syncLoader, true, false);
handle.start(frame);
}
void ResourceHandle::setHasReceivedResponse(bool b)
{
d->m_hasReceivedResponse = b;
......
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