summaryrefslogtreecommitdiffstats
path: root/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2010-11-10 15:31:59 -0800
committerTeng-Hui Zhu <ztenghui@google.com>2010-11-17 13:35:59 -0800
commit28040489d744e0c5d475a88663056c9040ed5320 (patch)
treec463676791e4a63e452a95f0a12b2a8519730693 /WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp
parenteff9be92c41913c92fb1d3b7983c071f3e718678 (diff)
downloadexternal_webkit-28040489d744e0c5d475a88663056c9040ed5320.zip
external_webkit-28040489d744e0c5d475a88663056c9040ed5320.tar.gz
external_webkit-28040489d744e0c5d475a88663056c9040ed5320.tar.bz2
Merge WebKit at r71558: Initial merge by git.
Change-Id: Ib345578fa29df7e4bc72b4f00e4a6fddcb754c4c
Diffstat (limited to 'WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp')
-rw-r--r--WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp44
1 files changed, 24 insertions, 20 deletions
diff --git a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp b/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp
index 825366a..09b07d6 100644
--- a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp
+++ b/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp
@@ -35,7 +35,6 @@
#include <comutil.h>
#include <sstream>
#include <tchar.h>
-#include <wtf/HashMap.h>
#include <wtf/Vector.h>
using namespace std;
@@ -60,26 +59,17 @@ static inline BSTR BSTRFromString(const string& str)
return result;
}
-typedef HashMap<unsigned long, wstring> IdentifierMap;
-
-IdentifierMap& urlMap()
-{
- static IdentifierMap urlMap;
-
- return urlMap;
-}
-
-static wstring descriptionSuitableForTestResult(unsigned long identifier)
+wstring ResourceLoadDelegate::descriptionSuitableForTestResult(unsigned long identifier) const
{
- IdentifierMap::iterator it = urlMap().find(identifier);
+ IdentifierMap::const_iterator it = m_urlMap.find(identifier);
- if (it == urlMap().end())
+ if (it == m_urlMap.end())
return L"<unknown>";
return urlSuitableForTestResult(it->second);
}
-static wstring descriptionSuitableForTestResult(IWebURLRequest* request)
+wstring ResourceLoadDelegate::descriptionSuitableForTestResult(IWebURLRequest* request)
{
if (!request)
return L"(null)";
@@ -108,7 +98,7 @@ static wstring descriptionSuitableForTestResult(IWebURLRequest* request)
return L"<NSURLRequest URL " + url + L", main document URL " + mainDocumentURL + L", http method " + httpMethod + L">";
}
-static wstring descriptionSuitableForTestResult(IWebURLResponse* response)
+wstring ResourceLoadDelegate::descriptionSuitableForTestResult(IWebURLResponse* response)
{
if (!response)
return L"(null)";
@@ -128,7 +118,7 @@ static wstring descriptionSuitableForTestResult(IWebURLResponse* response)
return L"<NSURLResponse " + url + L", http status code " + wstringFromInt(statusCode) + L">";
}
-static wstring descriptionSuitableForTestResult(IWebError* error, unsigned long identifier)
+wstring ResourceLoadDelegate::descriptionSuitableForTestResult(IWebError* error, unsigned long identifier) const
{
wstring result = L"<NSError ";
@@ -197,6 +187,8 @@ HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::QueryInterface(REFIID riid, void
*ppvObject = static_cast<IWebResourceLoadDelegate*>(this);
else if (IsEqualGUID(riid, IID_IWebResourceLoadDelegate))
*ppvObject = static_cast<IWebResourceLoadDelegate*>(this);
+ else if (IsEqualGUID(riid, IID_IWebResourceLoadDelegatePrivate2))
+ *ppvObject = static_cast<IWebResourceLoadDelegatePrivate2*>(this);
else
return E_NOINTERFACE;
@@ -229,12 +221,22 @@ HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::identifierForInitialRequest(
if (FAILED(request->URL(&urlStr)))
return E_FAIL;
+ ASSERT(!urlMap().contains(identifier));
urlMap().set(identifier, wstringFromBSTR(urlStr));
}
return S_OK;
}
+HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::removeIdentifierForRequest(
+ /* [in] */ IWebView* webView,
+ /* [in] */ unsigned long identifier)
+{
+ urlMap().remove(identifier);
+
+ return S_OK;
+}
+
HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::willSendRequest(
/* [in] */ IWebView* webView,
/* [in] */ unsigned long identifier,
@@ -351,11 +353,12 @@ HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::didFinishLoadingFromDataSource(
{
if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) {
printf("%S - didFinishLoading\n",
- descriptionSuitableForTestResult(identifier).c_str()),
- urlMap().remove(identifier);
+ descriptionSuitableForTestResult(identifier).c_str());
}
- return S_OK;
+ removeIdentifierForRequest(webView, identifier);
+
+ return S_OK;
}
HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::didFailLoadingWithError(
@@ -368,8 +371,9 @@ HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::didFailLoadingWithError(
printf("%S - didFailLoadingWithError: %S\n",
descriptionSuitableForTestResult(identifier).c_str(),
descriptionSuitableForTestResult(error, identifier).c_str());
- urlMap().remove(identifier);
}
+ removeIdentifierForRequest(webView, identifier);
+
return S_OK;
}