Diff
Modified: trunk/Source/WebCore/ChangeLog (93810 => 93811)
--- trunk/Source/WebCore/ChangeLog 2011-08-25 19:53:32 UTC (rev 93810)
+++ trunk/Source/WebCore/ChangeLog 2011-08-25 19:55:06 UTC (rev 93811)
@@ -1,3 +1,32 @@
+2011-08-25 Nate Chapin <[email protected]>
+
+ Split some of the variables out of ThreadableLoaderOptions
+ into a superclass, ResourceLoaderOptions. Use ResourceLoaderOptions
+ all the way down to ResourceLoader.
+ https://bugs.webkit.org/show_bug.cgi?id=63301
+
+ Reviewed by David Levin.
+
+ No new tests, refractor only.
+
+ * GNUmakefile.list.am:
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * loader/DocumentThreadableLoader.cpp:
+ * loader/MainResourceLoader.cpp:
+ * loader/NetscapePlugInStreamLoader.cpp:
+ * loader/ResourceLoadScheduler.cpp:
+ * loader/ResourceLoadScheduler.h:
+ * loader/ResourceLoader.cpp:
+ * loader/ResourceLoader.h:
+ * loader/ResourceLoaderOptions.h: Added.
+ * loader/SubresourceLoader.cpp:
+ * loader/SubresourceLoader.h:
+ * loader/ThreadableLoader.h:
+ * loader/cache/CachedResourceRequest.cpp:
+ * loader/mac/ResourceLoaderMac.mm:
+
2011-08-25 Adam Klein <[email protected]>
use strict in CodeGeneratorJS and CodeGeneratorV8
Modified: trunk/Source/WebCore/GNUmakefile.list.am (93810 => 93811)
--- trunk/Source/WebCore/GNUmakefile.list.am 2011-08-25 19:53:32 UTC (rev 93810)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2011-08-25 19:55:06 UTC (rev 93811)
@@ -2165,6 +2165,7 @@
Source/WebCore/loader/NavigationScheduler.h \
Source/WebCore/loader/ResourceLoader.cpp \
Source/WebCore/loader/ResourceLoader.h \
+ Source/WebCore/loader/ResourceLoaderOptions.h \
Source/WebCore/loader/ResourceLoadNotifier.cpp \
Source/WebCore/loader/ResourceLoadNotifier.h \
Source/WebCore/loader/ResourceLoadScheduler.cpp \
Modified: trunk/Source/WebCore/WebCore.gypi (93810 => 93811)
--- trunk/Source/WebCore/WebCore.gypi 2011-08-25 19:53:32 UTC (rev 93810)
+++ trunk/Source/WebCore/WebCore.gypi 2011-08-25 19:55:06 UTC (rev 93811)
@@ -573,6 +573,7 @@
'loader/ResourceLoadNotifier.h',
'loader/ResourceLoadScheduler.h',
'loader/ResourceLoader.h',
+ 'loader/ResourceLoaderOptions.h',
'loader/SubframeLoader.h',
'loader/SubresourceLoader.h',
'loader/SubresourceLoaderClient.h',
@@ -2768,6 +2769,7 @@
'loader/ResourceLoadNotifier.cpp',
'loader/ResourceLoadScheduler.cpp',
'loader/ResourceLoader.cpp',
+ 'loader/ResourceLoaderOptions.h',
'loader/SinkDocument.cpp',
'loader/SinkDocument.h',
'loader/SubframeLoader.cpp',
Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (93810 => 93811)
--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2011-08-25 19:53:32 UTC (rev 93810)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2011-08-25 19:55:06 UTC (rev 93811)
@@ -26246,6 +26246,10 @@
</FileConfiguration>
</File>
<File
+ RelativePath="..\loader\ResourceLoaderOptions.h"
+ >
+ </File>
+ <File
RelativePath="..\loader\ResourceLoadNotifier.cpp"
>
</File>
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (93810 => 93811)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2011-08-25 19:53:32 UTC (rev 93810)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2011-08-25 19:55:06 UTC (rev 93811)
@@ -5450,6 +5450,7 @@
D07DEABA0A36554A00CA30F8 /* InsertListCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = D07DEAB80A36554A00CA30F8 /* InsertListCommand.h */; };
D086FE9809D53AAB005BC74D /* UnlinkCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = D086FE9609D53AAB005BC74D /* UnlinkCommand.h */; };
D086FE9909D53AAB005BC74D /* UnlinkCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D086FE9709D53AAB005BC74D /* UnlinkCommand.cpp */; };
+ D0A3A7311405A39800FB8ED3 /* ResourceLoaderOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = D0A3A7301405A39800FB8ED3 /* ResourceLoaderOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
D0B0556809C6700100307E43 /* CreateLinkCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = D0B0556609C6700100307E43 /* CreateLinkCommand.h */; };
D0B0556909C6700100307E43 /* CreateLinkCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0B0556709C6700100307E43 /* CreateLinkCommand.cpp */; };
D0CE58F8125E4CC200F3F199 /* ResourceLoadScheduler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0CE58F6125E4CC200F3F199 /* ResourceLoadScheduler.cpp */; };
@@ -12189,6 +12190,7 @@
D07DEAB80A36554A00CA30F8 /* InsertListCommand.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = InsertListCommand.h; sourceTree = "<group>"; };
D086FE9609D53AAB005BC74D /* UnlinkCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnlinkCommand.h; sourceTree = "<group>"; };
D086FE9709D53AAB005BC74D /* UnlinkCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnlinkCommand.cpp; sourceTree = "<group>"; };
+ D0A3A7301405A39800FB8ED3 /* ResourceLoaderOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoaderOptions.h; sourceTree = "<group>"; };
D0B0556609C6700100307E43 /* CreateLinkCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CreateLinkCommand.h; sourceTree = "<group>"; };
D0B0556709C6700100307E43 /* CreateLinkCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CreateLinkCommand.cpp; sourceTree = "<group>"; };
D0CE58F6125E4CC200F3F199 /* ResourceLoadScheduler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoadScheduler.cpp; sourceTree = "<group>"; };
@@ -18966,6 +18968,7 @@
1A2A68220B5BEDE70002A480 /* ProgressTracker.h */,
93E227DE0AF589AD00D48324 /* ResourceLoader.cpp */,
656D37270ADBA5DE00A4554D /* ResourceLoader.h */,
+ D0A3A7301405A39800FB8ED3 /* ResourceLoaderOptions.h */,
973E325410883B7C005BC493 /* ResourceLoadNotifier.cpp */,
973E325510883B7C005BC493 /* ResourceLoadNotifier.h */,
D0CE58F6125E4CC200F3F199 /* ResourceLoadScheduler.cpp */,
@@ -23405,6 +23408,7 @@
FD23A12613F5FA5900F67001 /* JSMediaElementAudioSourceNode.h in Headers */,
DF9AFD7213FC31D80015FEB7 /* MediaPlayerPrivateAVFoundationObjC.h in Headers */,
93500F3213FDE3BE0099EC24 /* NSScrollerImpDetails.h in Headers */,
+ D0A3A7311405A39800FB8ED3 /* ResourceLoaderOptions.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp (93810 => 93811)
--- trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp 2011-08-25 19:53:32 UTC (rev 93810)
+++ trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp 2011-08-25 19:55:06 UTC (rev 93811)
@@ -342,11 +342,14 @@
ASSERT(m_sameOriginRequest || requestURL.pass().isEmpty());
if (m_async) {
- // Don't sniff content or send load callbacks for the preflight request.
- bool sendLoadCallbacks = m_options.sendLoadCallbacks && !m_actualRequest;
- bool sniffContent = m_options.sniffContent && !m_actualRequest;
- // Keep buffering the data for the preflight request.
- bool shouldBufferData = m_options.shouldBufferData || m_actualRequest;
+ ThreadableLoaderOptions options = m_options;
+ if (m_actualRequest) {
+ // Don't sniff content or send load callbacks for the preflight request.
+ options.sendLoadCallbacks = false;
+ options.sniffContent = false;
+ // Keep buffering the data for the preflight request.
+ options.shouldBufferData = true;
+ }
#if ENABLE(INSPECTOR)
if (m_actualRequest) {
@@ -360,8 +363,7 @@
// Clear the loader so that any callbacks from SubresourceLoader::create will not have the old loader.
m_loader = 0;
- m_loader = resourceLoadScheduler()->scheduleSubresourceLoad(m_document->frame(), this, request, ResourceLoadPriorityMedium, securityCheck, sendLoadCallbacks,
- sniffContent, shouldBufferData);
+ m_loader = resourceLoadScheduler()->scheduleSubresourceLoad(m_document->frame(), this, request, ResourceLoadPriorityMedium, securityCheck, options);
return;
}
Modified: trunk/Source/WebCore/loader/MainResourceLoader.cpp (93810 => 93811)
--- trunk/Source/WebCore/loader/MainResourceLoader.cpp 2011-08-25 19:53:32 UTC (rev 93810)
+++ trunk/Source/WebCore/loader/MainResourceLoader.cpp 2011-08-25 19:55:06 UTC (rev 93811)
@@ -60,7 +60,7 @@
namespace WebCore {
MainResourceLoader::MainResourceLoader(Frame* frame)
- : ResourceLoader(frame, true, true)
+ : ResourceLoader(frame, ResourceLoaderOptions(true, true, true))
, m_dataLoadTimer(this, &MainResourceLoader::handleDataLoadNow)
, m_loadingMultipartContent(false)
, m_waitingForContentPolicy(false)
Modified: trunk/Source/WebCore/loader/NetscapePlugInStreamLoader.cpp (93810 => 93811)
--- trunk/Source/WebCore/loader/NetscapePlugInStreamLoader.cpp 2011-08-25 19:53:32 UTC (rev 93810)
+++ trunk/Source/WebCore/loader/NetscapePlugInStreamLoader.cpp 2011-08-25 19:55:06 UTC (rev 93811)
@@ -29,14 +29,14 @@
#include "config.h"
#include "NetscapePlugInStreamLoader.h"
+#include "DocumentLoader.h"
#include "FrameLoader.h"
#include "FrameLoaderClient.h"
-#include "DocumentLoader.h"
namespace WebCore {
NetscapePlugInStreamLoader::NetscapePlugInStreamLoader(Frame* frame, NetscapePlugInStreamLoaderClient* client)
- : ResourceLoader(frame, true, true)
+ : ResourceLoader(frame, ResourceLoaderOptions(true, true, true))
, m_client(client)
{
}
Modified: trunk/Source/WebCore/loader/ResourceLoadScheduler.cpp (93810 => 93811)
--- trunk/Source/WebCore/loader/ResourceLoadScheduler.cpp 2011-08-25 19:53:32 UTC (rev 93810)
+++ trunk/Source/WebCore/loader/ResourceLoadScheduler.cpp 2011-08-25 19:55:06 UTC (rev 93811)
@@ -85,10 +85,9 @@
#endif
}
-PassRefPtr<SubresourceLoader> ResourceLoadScheduler::scheduleSubresourceLoad(Frame* frame, SubresourceLoaderClient* client, const ResourceRequest& request, ResourceLoadPriority priority, SecurityCheckPolicy securityCheck,
- bool sendResourceLoadCallbacks, bool shouldContentSniff, bool shouldBufferData)
+PassRefPtr<SubresourceLoader> ResourceLoadScheduler::scheduleSubresourceLoad(Frame* frame, SubresourceLoaderClient* client, const ResourceRequest& request, ResourceLoadPriority priority, SecurityCheckPolicy securityCheck, const ResourceLoaderOptions& options)
{
- RefPtr<SubresourceLoader> loader = SubresourceLoader::create(frame, client, request, securityCheck, sendResourceLoadCallbacks, shouldContentSniff, shouldBufferData);
+ RefPtr<SubresourceLoader> loader = SubresourceLoader::create(frame, client, request, securityCheck, options);
if (loader)
scheduleLoad(loader.get(), priority);
return loader.release();
Modified: trunk/Source/WebCore/loader/ResourceLoadScheduler.h (93810 => 93811)
--- trunk/Source/WebCore/loader/ResourceLoadScheduler.h 2011-08-25 19:53:32 UTC (rev 93810)
+++ trunk/Source/WebCore/loader/ResourceLoadScheduler.h 2011-08-25 19:55:06 UTC (rev 93811)
@@ -25,6 +25,7 @@
#include "FrameLoaderTypes.h"
#include "PlatformString.h"
+#include "ResourceLoaderOptions.h"
#include "ResourceLoadPriority.h"
#include "Timer.h"
#include <wtf/Deque.h>
@@ -50,7 +51,7 @@
public:
friend ResourceLoadScheduler* resourceLoadScheduler();
- PassRefPtr<SubresourceLoader> scheduleSubresourceLoad(Frame*, SubresourceLoaderClient*, const ResourceRequest&, ResourceLoadPriority = ResourceLoadPriorityLow, SecurityCheckPolicy = DoSecurityCheck, bool sendResourceLoadCallbacks = true, bool shouldContentSniff = true, bool shouldBufferData = true);
+ PassRefPtr<SubresourceLoader> scheduleSubresourceLoad(Frame*, SubresourceLoaderClient*, const ResourceRequest&, ResourceLoadPriority = ResourceLoadPriorityLow, SecurityCheckPolicy = DoSecurityCheck, const ResourceLoaderOptions& = ResourceLoaderOptions(true, true, true));
PassRefPtr<NetscapePlugInStreamLoader> schedulePluginStreamLoad(Frame*, NetscapePlugInStreamLoaderClient*, const ResourceRequest&);
void addMainResourceLoad(ResourceLoader*);
void remove(ResourceLoader*);
Modified: trunk/Source/WebCore/loader/ResourceLoader.cpp (93810 => 93811)
--- trunk/Source/WebCore/loader/ResourceLoader.cpp 2011-08-25 19:53:32 UTC (rev 93810)
+++ trunk/Source/WebCore/loader/ResourceLoader.cpp 2011-08-25 19:55:06 UTC (rev 93811)
@@ -58,7 +58,7 @@
return 0;
}
-ResourceLoader::ResourceLoader(Frame* frame, bool sendResourceLoadCallbacks, bool shouldContentSniff)
+ResourceLoader::ResourceLoader(Frame* frame, ResourceLoaderOptions options)
: m_frame(frame)
, m_documentLoader(frame->loader()->activeDocumentLoader())
, m_identifier(0)
@@ -66,10 +66,8 @@
, m_calledWillCancel(false)
, m_cancelled(false)
, m_calledDidFinishLoad(false)
- , m_sendResourceLoadCallbacks(sendResourceLoadCallbacks)
- , m_shouldContentSniff(shouldContentSniff)
- , m_shouldBufferData(true)
, m_defersLoading(frame->page()->defersLoading())
+ , m_options(options)
{
}
@@ -162,7 +160,7 @@
}
if (!m_reachedTerminalState)
- m_handle = ResourceHandle::create(m_frame->loader()->networkingContext(), m_request, this, m_defersLoading, m_shouldContentSniff);
+ m_handle = ResourceHandle::create(m_frame->loader()->networkingContext(), m_request, this, m_defersLoading, m_options.sniffContent);
}
void ResourceLoader::setDefersLoading(bool defers)
@@ -186,17 +184,17 @@
void ResourceLoader::setShouldBufferData(bool shouldBufferData)
{
- m_shouldBufferData = shouldBufferData;
+ m_options.shouldBufferData = shouldBufferData;
// Reset any already buffered data
- if (!m_shouldBufferData)
+ if (!shouldBufferData)
m_resourceData = 0;
}
void ResourceLoader::addData(const char* data, int length, bool allAtOnce)
{
- if (!m_shouldBufferData)
+ if (!m_options.shouldBufferData)
return;
if (allAtOnce) {
@@ -236,7 +234,7 @@
ASSERT(!m_reachedTerminalState);
- if (m_sendResourceLoadCallbacks) {
+ if (m_options.sendLoadCallbacks) {
if (!m_identifier) {
m_identifier = m_frame->page()->progress()->createUniqueIdentifier();
frameLoader()->notifier()->assignIdentifierToInitialRequest(m_identifier, documentLoader(), request);
@@ -279,7 +277,7 @@
if (FormData* data = ""
data->removeGeneratedFilesIfNeeded();
- if (m_sendResourceLoadCallbacks)
+ if (m_options.sendLoadCallbacks)
frameLoader()->notifier()->didReceiveResponse(this, m_response);
}
@@ -305,13 +303,13 @@
// FIXME: If we get a resource with more than 2B bytes, this code won't do the right thing.
// However, with today's computers and networking speeds, this won't happen in practice.
// Could be an issue with a giant local file.
- if (m_sendResourceLoadCallbacks && m_frame)
+ if (m_options.sendLoadCallbacks && m_frame)
frameLoader()->notifier()->didReceiveData(this, data, length, static_cast<int>(encodedDataLength));
}
void ResourceLoader::willStopBufferingData(const char* data, int length)
{
- if (!m_shouldBufferData)
+ if (!m_options.shouldBufferData)
return;
ASSERT(!m_resourceData);
@@ -339,7 +337,7 @@
if (m_calledDidFinishLoad)
return;
m_calledDidFinishLoad = true;
- if (m_sendResourceLoadCallbacks)
+ if (m_options.sendLoadCallbacks)
frameLoader()->notifier()->didFinishLoad(this, finishTime);
}
@@ -356,7 +354,7 @@
if (FormData* data = ""
data->removeGeneratedFilesIfNeeded();
- if (m_sendResourceLoadCallbacks && !m_calledDidFinishLoad)
+ if (m_options.sendLoadCallbacks && !m_calledDidFinishLoad)
frameLoader()->notifier()->didFailToLoad(this, error);
releaseResources();
@@ -404,7 +402,7 @@
m_handle = 0;
}
- if (m_sendResourceLoadCallbacks && m_identifier && !m_calledDidFinishLoad)
+ if (m_options.sendLoadCallbacks && m_identifier && !m_calledDidFinishLoad)
frameLoader()->notifier()->didFailToLoad(this, nonNullError);
}
Modified: trunk/Source/WebCore/loader/ResourceLoader.h (93810 => 93811)
--- trunk/Source/WebCore/loader/ResourceLoader.h 2011-08-25 19:53:32 UTC (rev 93810)
+++ trunk/Source/WebCore/loader/ResourceLoader.h 2011-08-25 19:55:06 UTC (rev 93811)
@@ -30,6 +30,7 @@
#define ResourceLoader_h
#include "ResourceHandleClient.h"
+#include "ResourceLoaderOptions.h"
#include "ResourceRequest.h"
#include "ResourceResponse.h"
@@ -134,14 +135,14 @@
const KURL& url() const { return m_request.url(); }
ResourceHandle* handle() const { return m_handle.get(); }
- bool sendResourceLoadCallbacks() const { return m_sendResourceLoadCallbacks; }
+ bool sendResourceLoadCallbacks() const { return m_options.sendLoadCallbacks; }
bool reachedTerminalState() const { return m_reachedTerminalState; }
void setShouldBufferData(bool shouldBufferData);
protected:
- ResourceLoader(Frame*, bool sendResourceLoadCallbacks, bool shouldContentSniff);
+ ResourceLoader(Frame*, ResourceLoaderOptions);
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
friend class ApplicationCacheHost; // for access to request()
@@ -177,11 +178,9 @@
bool m_cancelled;
bool m_calledDidFinishLoad;
- bool m_sendResourceLoadCallbacks;
- bool m_shouldContentSniff;
- bool m_shouldBufferData;
bool m_defersLoading;
ResourceRequest m_deferredRequest;
+ ResourceLoaderOptions m_options;
};
inline const ResourceResponse& ResourceLoader::response() const
Added: trunk/Source/WebCore/loader/ResourceLoaderOptions.h (0 => 93811)
--- trunk/Source/WebCore/loader/ResourceLoaderOptions.h (rev 0)
+++ trunk/Source/WebCore/loader/ResourceLoaderOptions.h 2011-08-25 19:55:06 UTC (rev 93811)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ResourceLoaderOptions_h
+#define ResourceLoaderOptions_h
+
+namespace WebCore {
+
+struct ResourceLoaderOptions {
+ ResourceLoaderOptions() : sendLoadCallbacks(false), sniffContent(false), shouldBufferData(true) { }
+ ResourceLoaderOptions(bool sendLoadCallbacksArg, bool sniffContentArg, bool shouldBufferDataArg) : sendLoadCallbacks(sendLoadCallbacksArg), sniffContent(sniffContentArg), shouldBufferData(shouldBufferDataArg) { }
+ bool sendLoadCallbacks;
+ bool sniffContent;
+ bool shouldBufferData;
+};
+
+} // namespace WebCore
+
+#endif // ResourceLoaderOptions_h
Modified: trunk/Source/WebCore/loader/SubresourceLoader.cpp (93810 => 93811)
--- trunk/Source/WebCore/loader/SubresourceLoader.cpp 2011-08-25 19:53:32 UTC (rev 93810)
+++ trunk/Source/WebCore/loader/SubresourceLoader.cpp 2011-08-25 19:55:06 UTC (rev 93811)
@@ -44,8 +44,8 @@
static WTF::RefCountedLeakCounter subresourceLoaderCounter("SubresourceLoader");
#endif
-SubresourceLoader::SubresourceLoader(Frame* frame, SubresourceLoaderClient* client, bool sendResourceLoadCallbacks, bool shouldContentSniff)
- : ResourceLoader(frame, sendResourceLoadCallbacks, shouldContentSniff)
+SubresourceLoader::SubresourceLoader(Frame* frame, SubresourceLoaderClient* client, const ResourceLoaderOptions& options)
+ : ResourceLoader(frame, options)
, m_client(client)
, m_loadingMultipartContent(false)
{
@@ -61,7 +61,7 @@
#endif
}
-PassRefPtr<SubresourceLoader> SubresourceLoader::create(Frame* frame, SubresourceLoaderClient* client, const ResourceRequest& request, SecurityCheckPolicy securityCheck, bool sendResourceLoadCallbacks, bool shouldContentSniff, bool shouldBufferData)
+PassRefPtr<SubresourceLoader> SubresourceLoader::create(Frame* frame, SubresourceLoaderClient* client, const ResourceRequest& request, SecurityCheckPolicy securityCheck, const ResourceLoaderOptions& options)
{
if (!frame)
return 0;
@@ -99,8 +99,7 @@
fl->addExtraFieldsToSubresourceRequest(newRequest);
- RefPtr<SubresourceLoader> subloader(adoptRef(new SubresourceLoader(frame, client, sendResourceLoadCallbacks, shouldContentSniff)));
- subloader->setShouldBufferData(shouldBufferData);
+ RefPtr<SubresourceLoader> subloader(adoptRef(new SubresourceLoader(frame, client, options)));
subloader->documentLoader()->addSubresourceLoader(subloader.get());
if (!subloader->init(newRequest))
return 0;
Modified: trunk/Source/WebCore/loader/SubresourceLoader.h (93810 => 93811)
--- trunk/Source/WebCore/loader/SubresourceLoader.h 2011-08-25 19:53:32 UTC (rev 93810)
+++ trunk/Source/WebCore/loader/SubresourceLoader.h 2011-08-25 19:55:06 UTC (rev 93811)
@@ -41,12 +41,12 @@
class SubresourceLoader : public ResourceLoader {
public:
- static PassRefPtr<SubresourceLoader> create(Frame*, SubresourceLoaderClient*, const ResourceRequest&, SecurityCheckPolicy = DoSecurityCheck, bool sendResourceLoadCallbacks = true, bool shouldContentSniff = true, bool shouldBufferData = true);
+ static PassRefPtr<SubresourceLoader> create(Frame*, SubresourceLoaderClient*, const ResourceRequest&, SecurityCheckPolicy, const ResourceLoaderOptions&);
void clearClient() { m_client = 0; }
private:
- SubresourceLoader(Frame*, SubresourceLoaderClient*, bool sendResourceLoadCallbacks, bool shouldContentSniff);
+ SubresourceLoader(Frame*, SubresourceLoaderClient*, const ResourceLoaderOptions&);
virtual ~SubresourceLoader();
virtual void willSendRequest(ResourceRequest&, const ResourceResponse& redirectResponse);
Modified: trunk/Source/WebCore/loader/ThreadableLoader.h (93810 => 93811)
--- trunk/Source/WebCore/loader/ThreadableLoader.h 2011-08-25 19:53:32 UTC (rev 93810)
+++ trunk/Source/WebCore/loader/ThreadableLoader.h 2011-08-25 19:55:06 UTC (rev 93811)
@@ -31,6 +31,7 @@
#ifndef ThreadableLoader_h
#define ThreadableLoader_h
+#include "ResourceLoaderOptions.h"
#include "SecurityOrigin.h"
#include <wtf/Noncopyable.h>
#include <wtf/PassRefPtr.h>
@@ -62,14 +63,11 @@
PreventPreflight
};
- struct ThreadableLoaderOptions {
- ThreadableLoaderOptions() : sendLoadCallbacks(false), sniffContent(false), allowCredentials(false), preflightPolicy(ConsiderPreflight), crossOriginRequestPolicy(DenyCrossOriginRequests), shouldBufferData(true) { }
- bool sendLoadCallbacks;
- bool sniffContent;
+ struct ThreadableLoaderOptions : public ResourceLoaderOptions {
+ ThreadableLoaderOptions() : allowCredentials(false), preflightPolicy(ConsiderPreflight), crossOriginRequestPolicy(DenyCrossOriginRequests) { }
bool allowCredentials; // Whether HTTP credentials and cookies are sent with the request.
PreflightPolicy preflightPolicy; // If AccessControl is used, how to determine if a preflight is needed.
CrossOriginRequestPolicy crossOriginRequestPolicy;
- bool shouldBufferData;
RefPtr<SecurityOrigin> securityOrigin;
};
Modified: trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp (93810 => 93811)
--- trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp 2011-08-25 19:53:32 UTC (rev 93810)
+++ trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp 2011-08-25 19:55:06 UTC (rev 93811)
@@ -125,7 +125,7 @@
resourceRequest.setPriority(priority);
RefPtr<SubresourceLoader> loader = resourceLoadScheduler()->scheduleSubresourceLoad(cachedResourceLoader->document()->frame(),
- request.get(), resourceRequest, priority, securityCheck, sendResourceLoadCallbacks);
+ request.get(), resourceRequest, priority, securityCheck, ResourceLoaderOptions(sendResourceLoadCallbacks, true, true));
if (!loader || loader->reachedTerminalState()) {
// FIXME: What if resources in other frames were waiting for this revalidation?
LOG(ResourceLoading, "Cannot start loading '%s'", resource->url().string().latin1().data());
Modified: trunk/Source/WebCore/loader/mac/ResourceLoaderMac.mm (93810 => 93811)
--- trunk/Source/WebCore/loader/mac/ResourceLoaderMac.mm 2011-08-25 19:53:32 UTC (rev 93810)
+++ trunk/Source/WebCore/loader/mac/ResourceLoaderMac.mm 2011-08-25 19:55:06 UTC (rev 93811)
@@ -61,7 +61,7 @@
NSCachedURLResponse* ResourceLoader::willCacheResponse(ResourceHandle*, NSCachedURLResponse* response)
{
- if (!m_sendResourceLoadCallbacks)
+ if (!m_options.sendLoadCallbacks)
return 0;
return frameLoader()->client()->willCacheResponse(documentLoader(), identifier(), response);
}