Modified: trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp (163621 => 163622)
--- trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp 2014-02-07 11:44:31 UTC (rev 163621)
+++ trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp 2014-02-07 12:02:15 UTC (rev 163622)
@@ -56,14 +56,14 @@
namespace WebCore {
-void DocumentThreadableLoader::loadResourceSynchronously(Document* document, const ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoaderOptions& options)
+void DocumentThreadableLoader::loadResourceSynchronously(Document& document, const ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoaderOptions& options)
{
// The loader will be deleted as soon as this function exits.
- RefPtr<DocumentThreadableLoader> loader = adoptRef(new DocumentThreadableLoader(document, &client, LoadSynchronously, request, options));
+ RefPtr<DocumentThreadableLoader> loader = adoptRef(new DocumentThreadableLoader(document, client, LoadSynchronously, request, options));
ASSERT(loader->hasOneRef());
}
-PassRefPtr<DocumentThreadableLoader> DocumentThreadableLoader::create(Document* document, ThreadableLoaderClient* client, const ResourceRequest& request, const ThreadableLoaderOptions& options)
+PassRefPtr<DocumentThreadableLoader> DocumentThreadableLoader::create(Document& document, ThreadableLoaderClient& client, const ResourceRequest& request, const ThreadableLoaderOptions& options)
{
RefPtr<DocumentThreadableLoader> loader = adoptRef(new DocumentThreadableLoader(document, client, LoadAsynchronously, request, options));
if (!loader->m_resource)
@@ -71,16 +71,14 @@
return loader.release();
}
-DocumentThreadableLoader::DocumentThreadableLoader(Document* document, ThreadableLoaderClient* client, BlockingBehavior blockingBehavior, const ResourceRequest& request, const ThreadableLoaderOptions& options)
- : m_client(client)
+DocumentThreadableLoader::DocumentThreadableLoader(Document& document, ThreadableLoaderClient& client, BlockingBehavior blockingBehavior, const ResourceRequest& request, const ThreadableLoaderOptions& options)
+ : m_client(&client)
, m_document(document)
, m_options(options)
, m_sameOriginRequest(securityOrigin()->canRequest(request.url()))
, m_simpleRequest(true)
, m_async(blockingBehavior == LoadAsynchronously)
{
- ASSERT(document);
- ASSERT(client);
// Setting an outgoing referer is only supported in the async code path.
ASSERT(m_async || request.httpReferrer().isEmpty());
@@ -248,8 +246,8 @@
String accessControlErrorDescription;
if (m_actualRequest) {
#if ENABLE(INSPECTOR)
- DocumentLoader* loader = m_document->frame()->loader().documentLoader();
- InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiveResourceResponse(m_document->frame(), identifier, response);
+ DocumentLoader* loader = m_document.frame()->loader().documentLoader();
+ InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiveResourceResponse(m_document.frame(), identifier, response);
InspectorInstrumentation::didReceiveResourceResponse(cookie, identifier, loader, response, 0);
#endif
@@ -293,7 +291,7 @@
// Preflight data should be invisible to clients.
if (m_actualRequest) {
#if ENABLE(INSPECTOR)
- InspectorInstrumentation::didReceiveData(m_document->frame(), identifier, 0, 0, dataLength);
+ InspectorInstrumentation::didReceiveData(m_document.frame(), identifier, 0, 0, dataLength);
#else
UNUSED_PARAM(identifier);
#endif
@@ -318,7 +316,7 @@
{
if (m_actualRequest) {
#if ENABLE(INSPECTOR)
- InspectorInstrumentation::didFinishLoading(m_document->frame(), m_document->frame()->loader().documentLoader(), identifier, finishTime);
+ InspectorInstrumentation::didFinishLoading(m_document.frame(), m_document.frame()->loader().documentLoader(), identifier, finishTime);
#endif
ASSERT(!m_sameOriginRequest);
ASSERT(m_options.crossOriginRequestPolicy == UseAccessControl);
@@ -331,7 +329,7 @@
{
#if ENABLE(INSPECTOR)
if (m_actualRequest)
- InspectorInstrumentation::didFailLoading(m_document->frame(), m_document->frame()->loader().documentLoader(), identifier, error);
+ InspectorInstrumentation::didFailLoading(m_document.frame(), m_document.frame()->loader().documentLoader(), identifier, error);
#else
UNUSED_PARAM(identifier);
#endif
@@ -357,7 +355,7 @@
ResourceError error(errorDomainWebKitInternal, 0, url, errorDescription);
#if ENABLE(INSPECTOR)
if (m_actualRequest)
- InspectorInstrumentation::didFailLoading(m_document->frame(), m_document->frame()->loader().documentLoader(), identifier, error);
+ InspectorInstrumentation::didFailLoading(m_document.frame(), m_document.frame()->loader().documentLoader(), identifier, error);
#else
UNUSED_PARAM(identifier);
#endif
@@ -389,12 +387,12 @@
newRequest.setInitiator(m_options.initiator);
#endif
ASSERT(!m_resource);
- m_resource = m_document->cachedResourceLoader()->requestRawResource(newRequest);
+ m_resource = m_document.cachedResourceLoader()->requestRawResource(newRequest);
if (m_resource) {
#if ENABLE(INSPECTOR)
if (m_resource->loader()) {
unsigned long identifier = m_resource->loader()->identifier();
- InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient(m_document, identifier, m_client);
+ InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient(&m_document, identifier, m_client);
}
#endif
m_resource->addClient(this);
@@ -407,10 +405,10 @@
ResourceError error;
ResourceResponse response;
unsigned long identifier = std::numeric_limits<unsigned long>::max();
- if (m_document->frame())
- identifier = m_document->frame()->loader().loadResourceSynchronously(request, m_options.allowCredentials, m_options.clientCredentialPolicy, error, response, data);
+ if (m_document.frame())
+ identifier = m_document.frame()->loader().loadResourceSynchronously(request, m_options.allowCredentials, m_options.clientCredentialPolicy, error, response, data);
- InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient(m_document, identifier, m_client);
+ InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient(&m_document, identifier, m_client);
// No exception for file:/// resources, see <rdar://problem/4962298>.
// Also, if we have an HTTP response, then it wasn't a network error in fact.
@@ -446,7 +444,7 @@
SecurityOrigin* DocumentThreadableLoader::securityOrigin() const
{
- return m_options.securityOrigin ? m_options.securityOrigin.get() : m_document->securityOrigin();
+ return m_options.securityOrigin ? m_options.securityOrigin.get() : m_document.securityOrigin();
}
} // namespace WebCore
Modified: trunk/Source/WebCore/loader/DocumentThreadableLoader.h (163621 => 163622)
--- trunk/Source/WebCore/loader/DocumentThreadableLoader.h 2014-02-07 11:44:31 UTC (rev 163621)
+++ trunk/Source/WebCore/loader/DocumentThreadableLoader.h 2014-02-07 12:02:15 UTC (rev 163622)
@@ -53,8 +53,8 @@
class DocumentThreadableLoader : public RefCounted<DocumentThreadableLoader>, public ThreadableLoader, private CachedRawResourceClient {
WTF_MAKE_FAST_ALLOCATED;
public:
- static void loadResourceSynchronously(Document*, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&);
- static PassRefPtr<DocumentThreadableLoader> create(Document*, ThreadableLoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&);
+ static void loadResourceSynchronously(Document&, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&);
+ static PassRefPtr<DocumentThreadableLoader> create(Document&, ThreadableLoaderClient&, const ResourceRequest&, const ThreadableLoaderOptions&);
virtual ~DocumentThreadableLoader();
virtual void cancel();
@@ -73,7 +73,7 @@
LoadAsynchronously
};
- DocumentThreadableLoader(Document*, ThreadableLoaderClient*, BlockingBehavior, const ResourceRequest&, const ThreadableLoaderOptions&);
+ DocumentThreadableLoader(Document&, ThreadableLoaderClient&, BlockingBehavior, const ResourceRequest&, const ThreadableLoaderOptions&);
void clearResource();
@@ -101,7 +101,7 @@
CachedResourceHandle<CachedRawResource> m_resource;
ThreadableLoaderClient* m_client;
- Document* m_document;
+ Document& m_document;
ThreadableLoaderOptions m_options;
bool m_sameOriginRequest;
bool m_simpleRequest;
Modified: trunk/Source/WebCore/loader/ThreadableLoader.cpp (163621 => 163622)
--- trunk/Source/WebCore/loader/ThreadableLoader.cpp 2014-02-07 11:44:31 UTC (rev 163621)
+++ trunk/Source/WebCore/loader/ThreadableLoader.cpp 2014-02-07 12:02:15 UTC (rev 163622)
@@ -59,7 +59,7 @@
if (context->isWorkerGlobalScope())
return WorkerThreadableLoader::create(static_cast<WorkerGlobalScope*>(context), client, WorkerRunLoop::defaultMode(), request, options);
- return DocumentThreadableLoader::create(toDocument(context), client, request, options);
+ return DocumentThreadableLoader::create(toDocument(*context), *client, request, options);
}
void ThreadableLoader::loadResourceSynchronously(ScriptExecutionContext* context, const ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoaderOptions& options)
@@ -71,7 +71,7 @@
return;
}
- DocumentThreadableLoader::loadResourceSynchronously(toDocument(context), request, client, options);
+ DocumentThreadableLoader::loadResourceSynchronously(*toDocument(context), request, client, options);
}
} // namespace WebCore