Synchronous XMLHTTPRequests need to go to the NetworkProcess.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Jan 2013 00:45:30 +0000 (00:45 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Jan 2013 00:45:30 +0000 (00:45 +0000)
<rdar://problem/12951765> and https://bugs.webkit.org/show_bug.cgi?id=106826

Reviewed by Sam Weinig and Alexey Proskuryakov.

Source/WebCore:

No new tests (No changes to any config that is currently tested)

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadResourceSynchronously): Consult the LoaderStrategy when strategies are
  being used.

* loader/LoaderStrategy.cpp:
(WebCore::LoaderStrategy::loadResourceSynchronously): Defaults to using ResourceHandle directly.
* loader/LoaderStrategy.h:

Break out the StoredCredentials enum to a new header:
* platform/network/ResourceHandle.h:
* platform/network/ResourceHandleTypes.h:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.exp.in:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:

Source/WebKit2:

* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::loadResourceSynchronously): Entry point for WebCore to get
  synchronous requests to the NetworkProcess.
* WebProcess/WebCoreSupport/WebPlatformStrategies.h:

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::performSynchronousLoad): Create a SyncNetworkResourceLoader
  and schedule it.
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:

* NetworkProcess/NetworkResourceLoadScheduler.cpp:
(WebKit::NetworkResourceLoadScheduler::scheduleSyncNetworkResourceLoader):
(WebKit::NetworkResourceLoadScheduler::servePendingRequestsForHost): Serve synchronous loaders
  before async loaders.
* NetworkProcess/NetworkResourceLoadScheduler.h:

A class that encapsulates a synchronous load request and the CoreIPC reply to be made once it is complete:
* NetworkProcess/SyncNetworkResourceLoader.cpp: Added.
(WebKit::SyncNetworkResourceLoader::SyncNetworkResourceLoader):
(WebKit::SyncNetworkResourceLoader::start):
* NetworkProcess/SyncNetworkResourceLoader.h: Copied from Source/WebKit2/NetworkProcess/HostRecord.h.
(WebKit::SyncNetworkResourceLoader::create):
(WebKit::SyncNetworkResourceLoader::setIdentifier):
(WebKit::SyncNetworkResourceLoader::identifier):
(WebKit::SyncNetworkResourceLoader::loadParameters):

Add a second queue of sync loaders:
* NetworkProcess/HostRecord.h:
(WebKit::HostRecord::syncLoadersPending):

Add comments to explicitly spell out the current reliance on some messages that are currently synchronous:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::willSendRequest):
(WebKit::NetworkResourceLoader::canAuthenticateAgainstProtectionSpace):

* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@139935 268f45cc-cd09-0410-ab3c-d52691b4dbfc

25 files changed:
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/LoaderStrategy.cpp
Source/WebCore/loader/LoaderStrategy.h
Source/WebCore/platform/network/ResourceHandle.h
Source/WebCore/platform/network/ResourceHandleTypes.h [new file with mode: 0644]
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/HostRecord.cpp
Source/WebKit2/NetworkProcess/HostRecord.h
Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp
Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h
Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in
Source/WebKit2/NetworkProcess/NetworkResourceLoadScheduler.cpp
Source/WebKit2/NetworkProcess/NetworkResourceLoadScheduler.h
Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp
Source/WebKit2/NetworkProcess/SyncNetworkResourceLoader.cpp [new file with mode: 0644]
Source/WebKit2/NetworkProcess/SyncNetworkResourceLoader.h [new file with mode: 0644]
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h

index 16fa285..ce8d242 100644 (file)
@@ -1,3 +1,29 @@
+2013-01-16  Brady Eidson  <beidson@apple.com>
+
+        Synchronous XMLHTTPRequests need to go to the NetworkProcess.
+        <rdar://problem/12951765> and https://bugs.webkit.org/show_bug.cgi?id=106826
+
+        Reviewed by Sam Weinig and Alexey Proskuryakov.
+
+        No new tests (No changes to any config that is currently tested)
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::loadResourceSynchronously): Consult the LoaderStrategy when strategies are
+          being used.
+
+        * loader/LoaderStrategy.cpp:
+        (WebCore::LoaderStrategy::loadResourceSynchronously): Defaults to using ResourceHandle directly.
+        * loader/LoaderStrategy.h:
+
+        Break out the StoredCredentials enum to a new header:
+        * platform/network/ResourceHandle.h:
+        * platform/network/ResourceHandleTypes.h:
+        * GNUmakefile.list.am:
+        * Target.pri:
+        * WebCore.exp.in:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+
 2013-01-16  Robert Iannucci  <iannucci@chromium.org>
 
         Explicitly set msvs_cygwin_shell to true for bison rule
index 5cabfe2..b77f009 100644 (file)
@@ -5811,6 +5811,7 @@ webcore_platform_sources += \
        Source/WebCore/platform/network/ResourceHandle.cpp \
        Source/WebCore/platform/network/ResourceHandle.h \
        Source/WebCore/platform/network/ResourceHandleInternal.h \
+       Source/WebCore/platform/network/ResourceHandleTypes.h \
        Source/WebCore/platform/network/ResourceLoadInfo.h \
        Source/WebCore/platform/network/ResourceLoadPriority.h \
        Source/WebCore/platform/network/ResourceLoadTiming.cpp \
index 800f469..4557c4e 100644 (file)
@@ -2304,6 +2304,7 @@ HEADERS += \
     platform/network/qt/QNetworkReplyHandler.h \
     platform/network/ResourceErrorBase.h \
     platform/network/ResourceHandle.h \
+    platform/network/ResourceHandleTypes.h \
     platform/network/ResourceLoadInfo.h \
     platform/network/ResourceLoadPriority.h \
     platform/network/ResourceLoadTiming.h \
index e2dd400..3a78b98 100644 (file)
@@ -284,6 +284,7 @@ __ZN7WebCore14FrameSelection6modifyENS0_11EAlterationENS_18SelectionDirectionENS
 __ZN7WebCore14FrameSelection9selectAllEv
 __ZN7WebCore14FrameSelectionC1EPNS_5FrameE
 __ZN7WebCore14LoaderStrategy21resourceLoadSchedulerEv
+__ZN7WebCore14LoaderStrategy25loadResourceSynchronouslyEPNS_17NetworkingContextERKNS_15ResourceRequestENS_17StoredCredentialsERNS_13ResourceErrorERNS_16ResourceResponseERN3WTF6VectorIcLm0EEE
 __ZN7WebCore14PluginDocument10pluginNodeEv
 __ZNK7WebCore5Frame25trackedRepaintRectsAsTextEv
 __ZN7WebCore9FrameView17setTracksRepaintsEb
@@ -297,6 +298,7 @@ __ZN7WebCore14ResourceBufferC2Ev
 __ZN7WebCore14ResourceBufferD1Ev
 __ZN7WebCore14ResourceBufferD2Ev
 __ZN7WebCore14ResourceHandle20forceContentSniffingEv
+__ZN7WebCore14ResourceHandle25loadResourceSynchronouslyEPNS_17NetworkingContextERKNS_15ResourceRequestENS_17StoredCredentialsERNS_13ResourceErrorERNS_16ResourceResponseERN3WTF6VectorIcLm0EEE
 __ZN7WebCore14ResourceHandle26synchronousLoadRunLoopModeEv
 __ZN7WebCore14ResourceHandle6createEPNS_17NetworkingContextERKNS_15ResourceRequestEPNS_20ResourceHandleClientEbb
 __ZN7WebCore14ResourceLoader13setIdentifierEm
index 1656e53..f7994cc 100755 (executable)
                                        >
                                </File>
                                <File
+                                       RelativePath="..\platform\network\ResourceHandleTypes.h"
+                                       >
+                               </File>
+                               <File
                                        RelativePath="..\platform\network\ResourceHandleClient.h"
                                        >
                                </File>
index c5ce7e7..c6aba43 100644 (file)
                51E1ECC30C91C90400DC255B /* PageURLRecord.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E1ECBD0C91C90400DC255B /* PageURLRecord.h */; };
                51E3F9C70DA059DC00250911 /* Storage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51E3F9C50DA059DC00250911 /* Storage.cpp */; };
                51E3F9D60DA05E1D00250911 /* JSStorage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51E3F9D40DA05E1D00250911 /* JSStorage.cpp */; };
+               51E4143416A6596300C633C7 /* ResourceHandleTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E4143216A6595100C633C7 /* ResourceHandleTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
                51E6821016387302003BBF3C /* LoaderStrategy.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E6820F16387302003BBF3C /* LoaderStrategy.h */; settings = {ATTRIBUTES = (Private, ); }; };
                51EC92650CE90DD400F90308 /* JSCustomSQLStatementErrorCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51EC925D0CE90DD400F90308 /* JSCustomSQLStatementErrorCallback.cpp */; };
                51FA2D78152132B300C1BA0B /* DOMWindowExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 517FBA18151AA71B00B57959 /* DOMWindowExtension.h */; settings = {ATTRIBUTES = (Private, ); }; };
                51E3F9D10DA05D7100250911 /* Storage.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Storage.idl; sourceTree = "<group>"; };
                51E3F9D40DA05E1D00250911 /* JSStorage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSStorage.cpp; sourceTree = "<group>"; };
                51E3F9D50DA05E1D00250911 /* JSStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStorage.h; sourceTree = "<group>"; };
+               51E4143216A6595100C633C7 /* ResourceHandleTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceHandleTypes.h; sourceTree = "<group>"; };
                51E6820F16387302003BBF3C /* LoaderStrategy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoaderStrategy.h; sourceTree = "<group>"; };
                51EC925D0CE90DD400F90308 /* JSCustomSQLStatementErrorCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCustomSQLStatementErrorCallback.cpp; sourceTree = "<group>"; };
                51F6A3D50663BF04004D2919 /* HTMLCanvasElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLCanvasElement.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                                514C76640CE923A1007EF3CD /* ResourceHandle.h */,
                                514C76650CE923A1007EF3CD /* ResourceHandleClient.h */,
                                514C76660CE923A1007EF3CD /* ResourceHandleInternal.h */,
+                               51E4143216A6595100C633C7 /* ResourceHandleTypes.h */,
                                492863981253B8FC00F792D6 /* ResourceLoadInfo.h */,
                                E4295FA312B0614E00D1ACE0 /* ResourceLoadPriority.h */,
                                861C2EA513FB4FFF00062ABB /* ResourceLoadTiming.cpp */,
                                E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */,
                                977E2E0F12F0FC9C00C13379 /* XSSAuditor.h in Headers */,
                                FD537353137B651800008DCE /* ZeroPole.h in Headers */,
+                               51E4143416A6596300C633C7 /* ResourceHandleTypes.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index b7c2dfd..ad19b5b 100644 (file)
 #include "HistoryItem.h"
 #include "InspectorController.h"
 #include "InspectorInstrumentation.h"
+#include "LoaderStrategy.h"
 #include "Logging.h"
 #include "MIMETypeRegistry.h"
 #include "MainResourceLoader.h"
 #include "Page.h"
 #include "PageCache.h"
 #include "PageTransitionEvent.h"
+#include "PlatformStrategies.h"
 #include "PluginData.h"
 #include "PluginDatabase.h"
 #include "PluginDocument.h"
@@ -2581,7 +2583,11 @@ unsigned long FrameLoader::loadResourceSynchronously(const ResourceRequest& requ
         ASSERT(!newRequest.isNull());
         
         if (!documentLoader()->applicationCacheHost()->maybeLoadSynchronously(newRequest, error, response, data)) {
+#if USE(PLATFORM_STRATEGIES)
+            platformStrategies()->loaderStrategy()->loadResourceSynchronously(networkingContext(), newRequest, storedCredentials, error, response, data);
+#else
             ResourceHandle::loadResourceSynchronously(networkingContext(), newRequest, storedCredentials, error, response, data);
+#endif
             documentLoader()->applicationCacheHost()->maybeLoadFallbackSynchronously(newRequest, error, response, data);
         }
     }
index 1406eaa..95bc60f 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "LoaderStrategy.h"
 
+#include "ResourceHandle.h"
 #include "ResourceLoadScheduler.h"
 
 #if USE(PLATFORM_STRATEGIES)
@@ -37,6 +38,11 @@ ResourceLoadScheduler* LoaderStrategy::resourceLoadScheduler()
     return WebCore::resourceLoadScheduler();
 }
 
+void LoaderStrategy::loadResourceSynchronously(NetworkingContext* context, const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& data)
+{
+    ResourceHandle::loadResourceSynchronously(context, request, storedCredentials, error, response, data);
+}
+
 } // namespace WebCore
 
 #endif // USE(PLATFORM_STRATEGIES)
index e87c767..3d0e1db 100644 (file)
 
 #if USE(PLATFORM_STRATEGIES)
 
+#include "ResourceHandleTypes.h"
+#include <wtf/Vector.h>
+
 namespace WebCore {
 
+class NetworkingContext;
+class ResourceError;
 class ResourceLoadScheduler;
+class ResourceRequest;
+class ResourceResponse;
 
 class LoaderStrategy {
 public:
     virtual ResourceLoadScheduler* resourceLoadScheduler();
 
+    virtual void loadResourceSynchronously(NetworkingContext*, const ResourceRequest&, StoredCredentials, ResourceError&, ResourceResponse&, Vector<char>& data);
+
 protected:
     virtual ~LoaderStrategy()
     {
index 41ba388..4941d2b 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "AuthenticationClient.h"
 #include "HTTPHeaderMap.h"
+#include "ResourceHandleTypes.h"
 #include <wtf/OwnPtr.h>
 #include <wtf/RefCounted.h>
 
@@ -88,11 +89,6 @@ class ResourceResponse;
 class SchedulePair;
 class SharedBuffer;
 
-enum StoredCredentials {
-    AllowStoredCredentials,
-    DoNotAllowStoredCredentials
-};
-
 template <typename T> class Timer;
 
 class ResourceHandle : public RefCounted<ResourceHandle>
diff --git a/Source/WebCore/platform/network/ResourceHandleTypes.h b/Source/WebCore/platform/network/ResourceHandleTypes.h
new file mode 100644 (file)
index 0000000..870e795
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2013 Apple 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:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 ResourceHandleTypes_h
+#define ResourceHandleTypes_h
+
+namespace WebCore {
+
+enum StoredCredentials {
+    AllowStoredCredentials,
+    DoNotAllowStoredCredentials
+};
+
+} // namespace WebCore
+
+#endif // ResourceHandleTypes_h
index dd54a90..a814759 100644 (file)
@@ -1,3 +1,48 @@
+2013-01-16  Brady Eidson  <beidson@apple.com>
+
+        Synchronous XMLHTTPRequests need to go to the NetworkProcess.
+        <rdar://problem/12951765> and https://bugs.webkit.org/show_bug.cgi?id=106826
+
+        Reviewed by Sam Weinig and Alexey Proskuryakov.
+
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+        (WebKit::WebPlatformStrategies::loadResourceSynchronously): Entry point for WebCore to get
+          synchronous requests to the NetworkProcess.
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
+
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::NetworkConnectionToWebProcess::performSynchronousLoad): Create a SyncNetworkResourceLoader
+          and schedule it.
+        * NetworkProcess/NetworkConnectionToWebProcess.h:
+        * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
+
+        * NetworkProcess/NetworkResourceLoadScheduler.cpp:
+        (WebKit::NetworkResourceLoadScheduler::scheduleSyncNetworkResourceLoader):
+        (WebKit::NetworkResourceLoadScheduler::servePendingRequestsForHost): Serve synchronous loaders
+          before async loaders.
+        * NetworkProcess/NetworkResourceLoadScheduler.h:
+
+        A class that encapsulates a synchronous load request and the CoreIPC reply to be made once it is complete:
+        * NetworkProcess/SyncNetworkResourceLoader.cpp: Added.
+        (WebKit::SyncNetworkResourceLoader::SyncNetworkResourceLoader):
+        (WebKit::SyncNetworkResourceLoader::start):
+        * NetworkProcess/SyncNetworkResourceLoader.h: Copied from Source/WebKit2/NetworkProcess/HostRecord.h.
+        (WebKit::SyncNetworkResourceLoader::create):
+        (WebKit::SyncNetworkResourceLoader::setIdentifier):
+        (WebKit::SyncNetworkResourceLoader::identifier):
+        (WebKit::SyncNetworkResourceLoader::loadParameters):
+
+        Add a second queue of sync loaders:
+        * NetworkProcess/HostRecord.h:
+        (WebKit::HostRecord::syncLoadersPending):
+
+        Add comments to explicitly spell out the current reliance on some messages that are currently synchronous:
+        * NetworkProcess/NetworkResourceLoader.cpp:
+        (WebKit::NetworkResourceLoader::willSendRequest):
+        (WebKit::NetworkResourceLoader::canAuthenticateAgainstProtectionSpace):
+
+        * WebKit2.xcodeproj/project.pbxproj:
+
 2013-01-16  Alexey Proskuryakov  <ap@apple.com>
 
         WebProcess should not access ~/Library/Caches/com.apple.WebProcess
index 7bc9617..37391b6 100644 (file)
@@ -32,6 +32,7 @@
 #include "NetworkResourceLoadParameters.h"
 #include "NetworkResourceLoadScheduler.h"
 #include "NetworkResourceLoader.h"
+#include "SyncNetworkResourceLoader.h"
 
 #if ENABLE(NETWORK_PROCESS)
 
index 1b21376..b219e6a 100644 (file)
@@ -36,6 +36,7 @@
 namespace WebKit {
 
 class NetworkResourceLoader;
+class SyncNetworkResourceLoader;
 typedef uint64_t ResourceLoadIdentifier;
 
 class HostRecord {
@@ -54,10 +55,16 @@ public:
     typedef Deque<RefPtr<NetworkResourceLoader> > LoaderQueue;
     LoaderQueue& loadersPending(WebCore::ResourceLoadPriority priority) { return m_loadersPending[priority]; }
 
+    typedef Deque<RefPtr<SyncNetworkResourceLoader> > SyncLoaderQueue;
+    SyncLoaderQueue& syncLoadersPending() { return m_syncLoadersPending; }
+
 private:                    
     LoaderQueue m_loadersPending[WebCore::ResourceLoadPriorityHighest + 1];
     typedef HashSet<ResourceLoadIdentifier> ResourceLoadIdentifierSet;
     ResourceLoadIdentifierSet m_resourceIdentifiersLoading;
+    
+    SyncLoaderQueue m_syncLoadersPending;
+    HashSet<RefPtr<SyncNetworkResourceLoader> > m_syncLoadersLoading;
 
     const String m_name;
     int m_maxRequestsInFlight;
index 864b14b..2350188 100644 (file)
@@ -30,6 +30,7 @@
 #include "NetworkProcess.h"
 #include "NetworkResourceLoader.h"
 #include "RemoteNetworkingContext.h"
+#include "SyncNetworkResourceLoader.h"
 #include <WebCore/PlatformCookieJar.h>
 #include <WebCore/ResourceLoaderOptions.h>
 #include <WebCore/ResourceRequest.h>
@@ -120,6 +121,11 @@ void NetworkConnectionToWebProcess::scheduleResourceLoad(const NetworkResourceLo
     resourceLoadIdentifier = NetworkProcess::shared().networkResourceLoadScheduler().scheduleResourceLoad(loadParameters, this);
 }
 
+void NetworkConnectionToWebProcess::performSynchronousLoad(const NetworkResourceLoadParameters& loadParameters, PassRefPtr<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply> reply)
+{
+    NetworkProcess::shared().networkResourceLoadScheduler().scheduleSyncNetworkResourceLoader(SyncNetworkResourceLoader::create(loadParameters, reply));
+}
+
 void NetworkConnectionToWebProcess::addLoadInProgress(const KURL& url, ResourceLoadIdentifier& identifier)
 {
     identifier = NetworkProcess::shared().networkResourceLoadScheduler().addLoadInProgress(url);
index 5234424..9ce4429 100644 (file)
@@ -76,6 +76,8 @@ private:
     void didReceiveSyncNetworkConnectionToWebProcessMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&, OwnPtr<CoreIPC::MessageEncoder>&);
     
     void scheduleResourceLoad(const NetworkResourceLoadParameters&, ResourceLoadIdentifier&);
+    void performSynchronousLoad(const NetworkResourceLoadParameters&, PassRefPtr<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply>);
+
     void addLoadInProgress(const WebCore::KURL&, ResourceLoadIdentifier&);
     void removeLoadIdentifier(ResourceLoadIdentifier);
     void crossOriginRedirectReceived(ResourceLoadIdentifier, const WebCore::KURL& redirectURL);
index f576c9e..55d91d9 100644 (file)
@@ -29,6 +29,7 @@ messages -> NetworkConnectionToWebProcess {
     // There's possible ResourceLoader identifier refactoring that can remove that requirement.
     // We might also have the NetworkProcess divvy up identifiers in blocks to each WebProcess beforehand.
     ScheduleResourceLoad(WebKit::NetworkResourceLoadParameters resourceLoadParameters) -> (uint64_t resourceLoadIdentifier)
+    PerformSynchronousLoad(WebKit::NetworkResourceLoadParameters resourceLoadParameters) -> (WebCore::ResourceError error, WebCore::ResourceResponse response, CoreIPC::DataReference data) Delayed
     AddLoadInProgress(WebCore::KURL url) -> (uint64_t resourceLoadIdentifier)
     RemoveLoadIdentifier(uint64_t resourceLoadIdentifier)
     
index d378b81..8f79bcc 100644 (file)
@@ -7,6 +7,7 @@
 #include "NetworkProcessconnectionMessages.h"
 #include "NetworkResourceLoadParameters.h"
 #include "NetworkResourceLoader.h"
+#include "SyncNetworkResourceLoader.h"
 #include <wtf/MainThread.h>
 #include <wtf/text/CString.h>
 
@@ -67,6 +68,27 @@ ResourceLoadIdentifier NetworkResourceLoadScheduler::scheduleResourceLoad(const
     return identifier;
 }
 
+void NetworkResourceLoadScheduler::scheduleSyncNetworkResourceLoader(PassRefPtr<SyncNetworkResourceLoader> loader)
+{
+    // FIXME (NetworkProcess): Sync loaders need to get identifiers in a sane way.
+    ResourceLoadIdentifier identifier = ++s_currentResourceLoadIdentifier;
+    loader->setIdentifier(identifier);
+
+    const ResourceRequest& resourceRequest = loader->loadParameters().request();
+
+    LOG(NetworkScheduling, "(NetworkProcess) NetworkResourceLoadScheduler::scheduleSyncNetworkResourceLoader synchronous resource '%s'", resourceRequest.url().string().utf8().data());
+
+    HostRecord* host = hostForURL(resourceRequest.url(), CreateIfNotFound);
+    bool hadRequests = host->hasRequests();
+    host->syncLoadersPending().append(loader);
+    m_identifiers.add(identifier, host);
+    
+    if (!hadRequests)
+        servePendingRequestsForHost(host, ResourceLoadPriorityHighest);
+
+    scheduleServePendingRequests();
+}
+
 ResourceLoadIdentifier NetworkResourceLoadScheduler::addLoadInProgress(const WebCore::KURL& url)
 {
     ResourceLoadIdentifier identifier = ++s_currentResourceLoadIdentifier;
@@ -170,6 +192,24 @@ void NetworkResourceLoadScheduler::servePendingRequestsForHost(HostRecord* host,
 {
     LOG(NetworkScheduling, "NetworkResourceLoadScheduler::servePendingRequests Host name='%s'", host->name().utf8().data());
 
+    // We serve synchronous requests before any other requests to improve responsiveness in any
+    // WebProcess that is waiting on a synchronous load.
+    HostRecord::SyncLoaderQueue& syncLoadersPending = host->syncLoadersPending();
+    while (!syncLoadersPending.isEmpty()) {
+        RefPtr<SyncNetworkResourceLoader> loader = syncLoadersPending.first();
+
+        // FIXME (NetworkProcess): How do we know this synchronous load isn't associated with a WebProcess
+        // we've lost our connection to?
+        bool shouldLimitRequests = !host->name().isNull();
+        if (shouldLimitRequests && host->limitRequests(ResourceLoadPriorityHighest, false))
+            return;
+
+        syncLoadersPending.removeFirst();
+        host->addLoadInProgress(loader->identifier());
+
+        loader->start();
+    }
+    
     for (int priority = ResourceLoadPriorityHighest; priority >= minimumPriority; --priority) {
         HostRecord::LoaderQueue& loadersPending = host->loadersPending(ResourceLoadPriority(priority));
 
index 0476fcc..044123f 100644 (file)
@@ -39,6 +39,7 @@ namespace WebKit {
 class HostRecord;
 class NetworkResourceLoadParameters;
 class NetworkConnectionToWebProcess;
+class SyncNetworkResourceLoader;
 typedef uint64_t ResourceLoadIdentifier;
 
 class NetworkResourceLoadScheduler {
@@ -50,6 +51,9 @@ public:
     // Adds the request to the queue for its host and create a unique identifier for it.
     ResourceLoadIdentifier scheduleResourceLoad(const NetworkResourceLoadParameters&, NetworkConnectionToWebProcess*);
     
+    // Adds a synchronous request to the synchronous request queue for its host.
+    void scheduleSyncNetworkResourceLoader(PassRefPtr<SyncNetworkResourceLoader>);
+    
     // Creates a unique identifier for an already-in-progress load.
     ResourceLoadIdentifier addLoadInProgress(const WebCore::KURL&);
 
index ce46bd0..bd01bbf 100644 (file)
@@ -188,6 +188,10 @@ void NetworkResourceLoader::willSendRequest(ResourceHandle*, ResourceRequest& re
     ASSERT(!redirectResponse.isNull());
     ASSERT(!isMainThread());
 
+    // IMPORTANT: The fact that this message to the WebProcess is sync is what makes our current approach to synchronous XMLHttpRequests safe.
+    // If this message changes to be asynchronous we might introduce a situation where the NetworkProcess is deadlocked waiting for 6 connections
+    // to complete while the WebProcess is waiting for a 7th to complete.
+    // If we ever change this message to be asynchronous we have to include safeguards to make sure the new design interacts well with sync XHR.
     if (!sendSync(Messages::WebResourceLoader::WillSendRequest(request, redirectResponse), Messages::WebResourceLoader::WillSendRequest::Reply(request)))
         request = ResourceRequest();
 }
@@ -287,6 +291,10 @@ bool NetworkResourceLoader::canAuthenticateAgainstProtectionSpace(ResourceHandle
 {
     ASSERT(!isMainThread());
 
+    // IMPORTANT: The fact that this message to the WebProcess is sync is what makes our current approach to synchronous XMLHttpRequests safe.
+    // If this message changes to be asynchronous we might introduce a situation where the NetworkProcess is deadlocked waiting for 6 connections
+    // to complete while the WebProcess is waiting for a 7th to complete.
+    // If we ever change this message to be asynchronous we have to include safeguards to make sure the new design interacts well with sync XHR.
     bool result;
     if (!sendSync(Messages::WebResourceLoader::CanAuthenticateAgainstProtectionSpace(protectionSpace), Messages::WebResourceLoader::CanAuthenticateAgainstProtectionSpace::Reply(result)))
         return false;
diff --git a/Source/WebKit2/NetworkProcess/SyncNetworkResourceLoader.cpp b/Source/WebKit2/NetworkProcess/SyncNetworkResourceLoader.cpp
new file mode 100644 (file)
index 0000000..3de23e1
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2013 Apple 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:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.
+ */
+
+#include "config.h"
+#include "SyncNetworkResourceLoader.h"
+
+#if ENABLE(NETWORK_PROCESS)
+
+#include "DataReference.h"
+#include "NetworkProcess.h"
+#include "RemoteNetworkingContext.h"
+#include <WebCore/ResourceError.h>
+#include <WebCore/ResourceResponse.h>
+#include <wtf/MainThread.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+SyncNetworkResourceLoader::SyncNetworkResourceLoader(const NetworkResourceLoadParameters& parameters, PassRefPtr<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply> reply)
+    : m_networkResourceLoadParameters(parameters)
+    , m_delayedReply(reply)
+    , m_identifier(0)
+{
+}
+
+void SyncNetworkResourceLoader::start()
+{
+    // FIXME (NetworkProcess): This is called on the NetworkProcess main thread, blocking any other requests from being scheduled.
+    // This should move to a background thread, but we'd either need to be sure that:
+    //   A - ResourceHandle::loadResourceSynchronously is safe to run on a background thread.
+    //   B - Write custom loading logic that is known to be safe on a background thread.
+    
+    ASSERT(isMainThread());
+    ASSERT(m_identifier);
+
+    ResourceError error;
+    ResourceResponse response;
+    Vector<char> data;
+    
+    // FIXME (NetworkProcess): Create RemoteNetworkingContext with actual settings.
+    RefPtr<RemoteNetworkingContext> networkingContext = RemoteNetworkingContext::create(false, false, m_networkResourceLoadParameters.inPrivateBrowsingMode());
+    
+    ResourceHandle::loadResourceSynchronously(networkingContext.get(), m_networkResourceLoadParameters.request(), m_networkResourceLoadParameters.allowStoredCredentials(), error, response, data);
+
+    m_delayedReply->send(error, response, CoreIPC::DataReference((uint8_t*)data.data(), data.size()));
+    
+    NetworkProcess::shared().networkResourceLoadScheduler().removeLoadIdentifier(m_identifier);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(NETWORK_PROCESS)
diff --git a/Source/WebKit2/NetworkProcess/SyncNetworkResourceLoader.h b/Source/WebKit2/NetworkProcess/SyncNetworkResourceLoader.h
new file mode 100644 (file)
index 0000000..742ae8e
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2013 Apple 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:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 SyncNetworkResourceLoader_h
+#define SyncNetworkResourceLoader_h
+
+#include "NetworkConnectionToWebProcessMessages.h"
+#include "NetworkResourceLoadParameters.h"
+#include <wtf/RefCounted.h>
+
+#if ENABLE(NETWORK_PROCESS)
+
+namespace WebKit {
+
+typedef uint64_t ResourceLoadIdentifier;
+
+class SyncNetworkResourceLoader : public RefCounted<SyncNetworkResourceLoader> {
+public:
+    static PassRefPtr<SyncNetworkResourceLoader> create(const NetworkResourceLoadParameters& parameters, PassRefPtr<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply> reply)
+    {
+        return adoptRef(new SyncNetworkResourceLoader(parameters, reply));
+    }
+    
+    void setIdentifier(ResourceLoadIdentifier identifier) { m_identifier = identifier; }
+    ResourceLoadIdentifier identifier() const { return m_identifier; }
+    
+    const NetworkResourceLoadParameters& loadParameters() { return m_networkResourceLoadParameters; }
+
+    void start();
+
+private:
+    SyncNetworkResourceLoader(const NetworkResourceLoadParameters&, PassRefPtr<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply>);
+    
+    NetworkResourceLoadParameters m_networkResourceLoadParameters;
+    RefPtr<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply> m_delayedReply;
+    ResourceLoadIdentifier m_identifier;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(NETWORK_PROCESS)
+
+#endif // SyncNetworkResourceLoader_h
index 46cbe09..5d30890 100644 (file)
                51795571162877D200FA43B6 /* NetworkProcessCreationParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 51A8A60F1627F2BD000D90E9 /* NetworkProcessCreationParameters.h */; };
                517CF0E3163A486C00C2950E /* NetworkProcessConnectionMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517CF0E1163A486C00C2950E /* NetworkProcessConnectionMessageReceiver.cpp */; };
                517CF0E4163A486C00C2950E /* NetworkProcessConnectionMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 517CF0E2163A486C00C2950E /* NetworkProcessConnectionMessages.h */; };
+               51815B9F16A622210054501F /* SyncNetworkResourceLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51815B9D16A622210054501F /* SyncNetworkResourceLoader.cpp */; };
+               51815BA016A622210054501F /* SyncNetworkResourceLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 51815B9E16A622210054501F /* SyncNetworkResourceLoader.h */; };
                51829DA51637C70C000953D6 /* NetworkResourceLoadScheduler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51829DA31637C70C000953D6 /* NetworkResourceLoadScheduler.cpp */; };
                51829DA61637C70C000953D6 /* NetworkResourceLoadScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = 51829DA41637C70C000953D6 /* NetworkResourceLoadScheduler.h */; };
                51834592134532E90092B696 /* WebIconDatabaseClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51834590134532E80092B696 /* WebIconDatabaseClient.cpp */; };
                517A33B4130B308C00F80CB5 /* WKApplicationCacheManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKApplicationCacheManager.h; sourceTree = "<group>"; };
                517CF0E1163A486C00C2950E /* NetworkProcessConnectionMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkProcessConnectionMessageReceiver.cpp; sourceTree = "<group>"; };
                517CF0E2163A486C00C2950E /* NetworkProcessConnectionMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkProcessConnectionMessages.h; sourceTree = "<group>"; };
+               51815B9D16A622210054501F /* SyncNetworkResourceLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SyncNetworkResourceLoader.cpp; path = NetworkProcess/SyncNetworkResourceLoader.cpp; sourceTree = "<group>"; };
+               51815B9E16A622210054501F /* SyncNetworkResourceLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SyncNetworkResourceLoader.h; path = NetworkProcess/SyncNetworkResourceLoader.h; sourceTree = "<group>"; };
                51829DA31637C70C000953D6 /* NetworkResourceLoadScheduler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkResourceLoadScheduler.cpp; path = NetworkProcess/NetworkResourceLoadScheduler.cpp; sourceTree = "<group>"; };
                51829DA41637C70C000953D6 /* NetworkResourceLoadScheduler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkResourceLoadScheduler.h; path = NetworkProcess/NetworkResourceLoadScheduler.h; sourceTree = "<group>"; };
                51834590134532E80092B696 /* WebIconDatabaseClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebIconDatabaseClient.cpp; sourceTree = "<group>"; };
                                515705521657018C00101A90 /* NetworkResourceLoader.messages.in */,
                                51829DA31637C70C000953D6 /* NetworkResourceLoadScheduler.cpp */,
                                51829DA41637C70C000953D6 /* NetworkResourceLoadScheduler.h */,
+                               51815B9D16A622210054501F /* SyncNetworkResourceLoader.cpp */,
+                               51815B9E16A622210054501F /* SyncNetworkResourceLoader.h */,
                        );
                        name = NetworkProcess;
                        sourceTree = "<group>";
                                E179088F169BAA6A006904C7 /* SecItemShim.h in Headers */,
                                E1790891169BAA82006904C7 /* SecItemShimMessages.h in Headers */,
                                1A97E07616A5F9E0000BC9E5 /* LayerTreeHostMac.h in Headers */,
+                               51815BA016A622210054501F /* SyncNetworkResourceLoader.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                E179088D169BAA62006904C7 /* SecItemShim.cpp in Sources */,
                                E1790890169BAA7F006904C7 /* SecItemShimMessageReceiver.cpp in Sources */,
                                1A97E07716A5F9E0000BC9E5 /* LayerTreeHostMac.mm in Sources */,
+                               51815B9F16A622210054501F /* SyncNetworkResourceLoader.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 9dc48c5..b0b65f7 100644 (file)
 #if USE(PLATFORM_STRATEGIES)
 
 #include "BlockingResponseMap.h"
+#include "DataReference.h"
+#include "NetworkResourceLoadParameters.h"
 #include "PluginInfoStore.h"
 #include "WebContextMessages.h"
 #include "WebCookieManager.h"
 #include "WebCoreArgumentCoders.h"
+#include "WebErrors.h"
 #include "WebProcess.h"
 #include "WebProcessProxyMessages.h"
 #include <WebCore/Color.h>
 #include <WebCore/KURL.h>
 #include <WebCore/LoaderStrategy.h>
 #include <WebCore/NetworkStorageSession.h>
+#include <WebCore/NetworkingContext.h>
 #include <WebCore/Page.h>
 #include <WebCore/PlatformCookieJar.h>
 #include <WebCore/PlatformPasteboard.h>
+#include <WebCore/ResourceError.h>
 #include <wtf/Atomics.h>
 
 #if ENABLE(NETWORK_PROCESS)
@@ -208,6 +213,24 @@ ResourceLoadScheduler* WebPlatformStrategies::resourceLoadScheduler()
     
     return scheduler;
 }
+
+void WebPlatformStrategies::loadResourceSynchronously(NetworkingContext* context, const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& data)
+{
+    CoreIPC::DataReference dataReference;
+
+    NetworkResourceLoadParameters loadParameters(request, ResourceLoadPriorityHighest, SniffContent, storedCredentials, context->storageSession().isPrivateBrowsingSession());
+    if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad(loadParameters), Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::Reply(error, response, dataReference), 0)) {
+        response = ResourceResponse();
+        error = internalError(request.url());
+        data.resize(0);
+
+        return;
+    }
+
+    data.resize(dataReference.size());
+    memcpy(data.data(), dataReference.data(), dataReference.size());
+}
+
 #endif
 
 // PluginStrategy
index cc0dc8c..c1ff10b 100644 (file)
@@ -71,6 +71,7 @@ private:
     // WebCore::LoaderStrategy
 #if ENABLE(NETWORK_PROCESS)
     virtual WebCore::ResourceLoadScheduler* resourceLoadScheduler() OVERRIDE;
+    virtual void loadResourceSynchronously(WebCore::NetworkingContext*, const WebCore::ResourceRequest&, WebCore::StoredCredentials, WebCore::ResourceError&, WebCore::ResourceResponse&, Vector<char>& data) OVERRIDE;
 #endif
 
     // WebCore::PluginStrategy