Title: [132501] trunk/Source
Revision
132501
Author
[email protected]
Date
2012-10-25 10:16:38 -0700 (Thu, 25 Oct 2012)

Log Message

Allow LoaderStrategy to override the ResourceLoadScheduler
https://bugs.webkit.org/show_bug.cgi?id=100355

Reviewed by Anders Carlsson.

Source/WebCore:

Allow LoaderStrategy to override the implementation of the ResourceLoadScheduler.
Add a default implementation that just returns the current ResourceLoadScheduler.

No new tests (No behavior change).

Project file stuff:
* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.exp.in:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:

"Virtualize" ResourceLoadScheduler to expose build issues in preparation for future virtualization:
* loader/ResourceLoadScheduler.cpp:
(WebCore::ResourceLoadScheduler::~ResourceLoadScheduler):
* loader/ResourceLoadScheduler.h:
(ResourceLoadScheduler):

Add the new method plus a default implementation:
 * loader/LoaderStrategy.cpp:
(WebCore::LoaderStrategy::resourceLoadScheduler):
* loader/LoaderStrategy.h:

When strategies are enabled, use the LoaderStrategy for this:
* dom/ContainerNode.cpp:
(WebCore::ContainerNode::suspendPostAttachCallbacks):
(WebCore::ContainerNode::resumePostAttachCallbacks):

* loader/MainResourceLoader.cpp:
(WebCore::MainResourceLoader::loadNow):

* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::releaseResources):
(WebCore::ResourceLoader::willSendRequest):

* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::load):

* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::performPostLoadActions):

Source/WebKit2:

Add a WebKit2 subclass of ResourceLoadScheduler that currently adds no new functionality:
* WebProcess/Network/WebResourceLoadScheduler.cpp:
(WebKit::WebResourceLoadScheduler::~WebResourceLoadScheduler):
* WebProcess/Network/WebResourceLoadScheduler.h:

WebProcess hangs on to the default shared WebResourceLoadScheduler:
* WebProcess/WebProcess.h:
(WebKit::WebProcess::webResourceLoadScheduler):

If the NetworkProcess is enabled, return the new WebResourceLoadScheduler:
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::resourceLoadScheduler):
* WebProcess/WebCoreSupport/WebPlatformStrategies.h:

* WebKit2.xcodeproj/project.pbxproj:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (132500 => 132501)


--- trunk/Source/WebCore/CMakeLists.txt	2012-10-25 17:09:53 UTC (rev 132500)
+++ trunk/Source/WebCore/CMakeLists.txt	2012-10-25 17:16:38 UTC (rev 132501)
@@ -1636,6 +1636,7 @@
     loader/HistoryController.cpp
     loader/ImageLoader.cpp
     loader/LinkLoader.cpp
+    loader/LoaderStrategy.cpp
     loader/MainResourceLoader.cpp
     loader/MixedContentChecker.cpp
     loader/NavigationAction.cpp

Modified: trunk/Source/WebCore/ChangeLog (132500 => 132501)


--- trunk/Source/WebCore/ChangeLog	2012-10-25 17:09:53 UTC (rev 132500)
+++ trunk/Source/WebCore/ChangeLog	2012-10-25 17:16:38 UTC (rev 132501)
@@ -1,3 +1,53 @@
+2012-10-25  Brady Eidson  <[email protected]>
+
+        Allow LoaderStrategy to override the ResourceLoadScheduler
+        https://bugs.webkit.org/show_bug.cgi?id=100355
+
+        Reviewed by Anders Carlsson.
+
+        Allow LoaderStrategy to override the implementation of the ResourceLoadScheduler.
+        Add a default implementation that just returns the current ResourceLoadScheduler.
+
+        No new tests (No behavior change).
+
+        Project file stuff:
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * Target.pri:
+        * WebCore.exp.in:
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+
+        "Virtualize" ResourceLoadScheduler to expose build issues in preparation for future virtualization:
+        * loader/ResourceLoadScheduler.cpp:
+        (WebCore::ResourceLoadScheduler::~ResourceLoadScheduler):
+        * loader/ResourceLoadScheduler.h:
+        (ResourceLoadScheduler):
+
+        Add the new method plus a default implementation:
+         * loader/LoaderStrategy.cpp: 
+        (WebCore::LoaderStrategy::resourceLoadScheduler):
+        * loader/LoaderStrategy.h:
+
+        When strategies are enabled, use the LoaderStrategy for this:
+        * dom/ContainerNode.cpp:
+        (WebCore::ContainerNode::suspendPostAttachCallbacks):
+        (WebCore::ContainerNode::resumePostAttachCallbacks):
+
+        * loader/MainResourceLoader.cpp:
+        (WebCore::MainResourceLoader::loadNow):
+
+        * loader/ResourceLoader.cpp:
+        (WebCore::ResourceLoader::releaseResources):
+        (WebCore::ResourceLoader::willSendRequest):
+
+        * loader/cache/CachedResource.cpp:
+        (WebCore::CachedResource::load):
+
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::performPostLoadActions):
+
 2012-10-25  Yury Semikhatsky  <[email protected]>
 
         Web Inspector: inspector tests failing after r132454

Modified: trunk/Source/WebCore/GNUmakefile.list.am (132500 => 132501)


--- trunk/Source/WebCore/GNUmakefile.list.am	2012-10-25 17:09:53 UTC (rev 132500)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2012-10-25 17:16:38 UTC (rev 132501)
@@ -3913,6 +3913,8 @@
 	Source/WebCore/loader/LinkLoader.h \
 	Source/WebCore/loader/LinkLoader.cpp \
 	Source/WebCore/loader/LinkLoaderClient.h \
+	Source/WebCore/loader/LoaderStrategy.cpp \
+	Source/WebCore/loader/LoaderStrategy.h \
 	Source/WebCore/loader/MainResourceLoader.cpp \
 	Source/WebCore/loader/MainResourceLoader.h \
     Source/WebCore/loader/MixedContentChecker.cpp \

Modified: trunk/Source/WebCore/Target.pri (132500 => 132501)


--- trunk/Source/WebCore/Target.pri	2012-10-25 17:09:53 UTC (rev 132500)
+++ trunk/Source/WebCore/Target.pri	2012-10-25 17:16:38 UTC (rev 132501)
@@ -834,6 +834,7 @@
     loader/icon/IconLoader.cpp \
     loader/ImageLoader.cpp \
     loader/LinkLoader.cpp \
+    loader/LoaderStrategy.cpp \
     loader/MainResourceLoader.cpp \
     loader/MixedContentChecker.cpp \
     loader/NavigationAction.cpp \
@@ -1962,6 +1963,7 @@
     loader/ImageLoader.h \
     loader/LinkLoader.h \
     loader/LinkLoaderClient.h \
+    loader/LoaderStrategy.h \
     loader/MainResourceLoader.h \
     loader/MixedContentChecker.h \
     loader/NavigationAction.h \

Modified: trunk/Source/WebCore/WebCore.exp.in (132500 => 132501)


--- trunk/Source/WebCore/WebCore.exp.in	2012-10-25 17:09:53 UTC (rev 132500)
+++ trunk/Source/WebCore/WebCore.exp.in	2012-10-25 17:16:38 UTC (rev 132501)
@@ -263,6 +263,7 @@
 __ZN7WebCore14FrameSelection6modifyENS0_11EAlterationENS_18SelectionDirectionENS_15TextGranularityENS_14EUserTriggeredE
 __ZN7WebCore14FrameSelection9selectAllEv
 __ZN7WebCore14FrameSelectionC1EPNS_5FrameE
+__ZN7WebCore14LoaderStrategy21resourceLoadSchedulerEv
 __ZN7WebCore14PluginDocument12pluginWidgetEv
 __ZN7WebCore14ResourceBuffer12createNSDataEv
 __ZN7WebCore14ResourceBufferD1Ev
@@ -557,8 +558,17 @@
 __ZN7WebCore21BackForwardController11itemAtIndexEi
 __ZN7WebCore21MemoryPressureHandler7installEv
 __ZN7WebCore21PlatformKeyboardEvent24disambiguateKeyDownEventENS_13PlatformEvent4TypeEb
+__ZN7WebCore21ResourceLoadScheduler19addMainResourceLoadEPNS_14ResourceLoaderE
 __ZN7WebCore21ResourceLoadScheduler20servePendingRequestsENS_20ResourceLoadPriorityE
+__ZN7WebCore21ResourceLoadScheduler20servePendingRequestsEPNS0_15HostInformationENS_20ResourceLoadPriorityE
+__ZN7WebCore21ResourceLoadScheduler21resumePendingRequestsEv
+__ZN7WebCore21ResourceLoadScheduler22suspendPendingRequestsEv
+__ZN7WebCore21ResourceLoadScheduler23scheduleSubresourceLoadEPNS_5FrameEPNS_14CachedResourceERKNS_15ResourceRequestENS_20ResourceLoadPriorityERKNS_21ResourceLoaderOptionsE
 __ZN7WebCore21ResourceLoadScheduler24schedulePluginStreamLoadEPNS_5FrameEPNS_32NetscapePlugInStreamLoaderClientERKNS_15ResourceRequestE
+__ZN7WebCore21ResourceLoadScheduler27crossOriginRedirectReceivedEPNS_14ResourceLoaderERKNS_4KURLE
+__ZN7WebCore21ResourceLoadScheduler6removeEPNS_14ResourceLoaderE
+__ZN7WebCore21ResourceLoadSchedulerC2Ev
+__ZN7WebCore21ResourceLoadSchedulerD2Ev
 __ZN7WebCore21SerializedScriptValue11deserializeEPK15OpaqueJSContextPPK13OpaqueJSValue
 __ZN7WebCore21SerializedScriptValue6createEPK15OpaqueJSContextPK13OpaqueJSValuePS6_
 __ZN7WebCore21SerializedScriptValueC1ERN3WTF6VectorIhLm0EEE
@@ -1451,6 +1461,7 @@
 __ZNK7WebCore9PageCache21autoreleasedPageCountEv
 __ZNK7WebCore9TreeScope14getElementByIdERKN3WTF12AtomicStringE
 __ZTVN7WebCore12ChromeClientE
+__ZTVN7WebCore14LoaderStrategyE
 __ZTVN7WebCore16IconDatabaseBaseE
 __ZTVN7WebCore17FrameLoaderClientE
 __ZTVN7WebCore25HistoryPropertyListWriterE

Modified: trunk/Source/WebCore/WebCore.gypi (132500 => 132501)


--- trunk/Source/WebCore/WebCore.gypi	2012-10-25 17:09:53 UTC (rev 132500)
+++ trunk/Source/WebCore/WebCore.gypi	2012-10-25 17:16:38 UTC (rev 132501)
@@ -2993,6 +2993,8 @@
             'loader/LinkLoader.cpp',
             'loader/LinkLoader.h',
             'loader/LinkLoaderClient.h',
+            'loader/LoaderStrategy.cpp',
+            'loader/LoaderStrategy.h',
             'loader/MainResourceLoader.cpp',
             'loader/MainResourceLoader.h',
             'loader/MixedContentChecker.cpp',

Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (132500 => 132501)


--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-10-25 17:09:53 UTC (rev 132500)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-10-25 17:16:38 UTC (rev 132501)
@@ -27607,6 +27607,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\loader\LoaderStrategy.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\loader\LoaderStrategy.h"
 				>
 			</File>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (132500 => 132501)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2012-10-25 17:09:53 UTC (rev 132500)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2012-10-25 17:16:38 UTC (rev 132501)
@@ -1598,6 +1598,7 @@
 		51ABAE1B103C18FF008C5260 /* SocketStreamError.h in Headers */ = {isa = PBXBuildFile; fileRef = 51ABAE1A103C18FF008C5260 /* SocketStreamError.h */; };
 		51ABAE1E103C1913008C5260 /* SocketStreamHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 51ABAE1C103C1913008C5260 /* SocketStreamHandle.h */; };
 		51ABAE1F103C1913008C5260 /* SocketStreamHandleCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51ABAE1D103C1913008C5260 /* SocketStreamHandleCFNet.cpp */; };
+		51ABF64D16392E2800132A7A /* LoaderStrategy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51ABF64C16392E2800132A7A /* LoaderStrategy.cpp */; };
 		51B2417B0D931F3F00E83F5C /* LegacyWebArchiveMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51B2417A0D931F3F00E83F5C /* LegacyWebArchiveMac.mm */; };
 		51BE37E00DAEE00E001085FC /* StorageArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 51BE37DE0DAEE00E001085FC /* StorageArea.h */; };
 		51C0AA390F2AA10A001648C2 /* CachedFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 51C0AA380F2AA10A001648C2 /* CachedFrame.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -8809,6 +8810,7 @@
 		51ABAE1A103C18FF008C5260 /* SocketStreamError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocketStreamError.h; sourceTree = "<group>"; };
 		51ABAE1C103C1913008C5260 /* SocketStreamHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocketStreamHandle.h; sourceTree = "<group>"; };
 		51ABAE1D103C1913008C5260 /* SocketStreamHandleCFNet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SocketStreamHandleCFNet.cpp; sourceTree = "<group>"; };
+		51ABF64C16392E2800132A7A /* LoaderStrategy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoaderStrategy.cpp; sourceTree = "<group>"; };
 		51B2417A0D931F3F00E83F5C /* LegacyWebArchiveMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LegacyWebArchiveMac.mm; sourceTree = "<group>"; };
 		51BE37DE0DAEE00E001085FC /* StorageArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageArea.h; sourceTree = "<group>"; };
 		51C0AA380F2AA10A001648C2 /* CachedFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedFrame.h; sourceTree = "<group>"; };
@@ -20718,6 +20720,7 @@
 				98CE4329129E00E5005821DC /* LinkLoader.h */,
 				984264EF12D5280A000D88A4 /* LinkLoaderClient.h */,
 				51E6820F16387302003BBF3C /* LoaderStrategy.h */,
+				51ABF64C16392E2800132A7A /* LoaderStrategy.cpp */,
 				93E227DC0AF589AD00D48324 /* MainResourceLoader.cpp */,
 				656D37290ADBA5DE00A4554D /* MainResourceLoader.h */,
 				52F10862162B6D82009AC81E /* MixedContentChecker.cpp */,
@@ -28780,6 +28783,7 @@
 				E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */,
 				977E2E0E12F0FC9C00C13379 /* XSSAuditor.cpp in Sources */,
 				FD537352137B651800008DCE /* ZeroPole.cpp in Sources */,
+				51ABF64D16392E2800132A7A /* LoaderStrategy.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (132500 => 132501)


--- trunk/Source/WebCore/dom/ContainerNode.cpp	2012-10-25 17:09:53 UTC (rev 132500)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp	2012-10-25 17:16:38 UTC (rev 132501)
@@ -35,10 +35,12 @@
 #include "InlineTextBox.h"
 #include "InsertionPoint.h"
 #include "InspectorInstrumentation.h"
+#include "LoaderStrategy.h"
 #include "MemoryCache.h"
 #include "MutationEvent.h"
 #include "ResourceLoadScheduler.h"
 #include "Page.h"
+#include "PlatformStrategies.h"
 #include "RenderBox.h"
 #include "RenderTheme.h"
 #include "RenderWidget.h"
@@ -641,7 +643,11 @@
                 s_shouldReEnableMemoryCacheCallsAfterAttach = true;
             }
         }
+#if USE(PLATFORM_STRATEGIES)
+        platformStrategies()->loaderStrategy()->resourceLoadScheduler()->suspendPendingRequests();
+#else
         resourceLoadScheduler()->suspendPendingRequests();
+#endif
     }
     ++s_attachDepth;
 }
@@ -658,7 +664,11 @@
             if (Page* page = document()->page())
                 page->setMemoryCacheClientCallsEnabled(true);
         }
+#if USE(PLATFORM_STRATEGIES)
+        platformStrategies()->loaderStrategy()->resourceLoadScheduler()->resumePendingRequests();
+#else
         resourceLoadScheduler()->resumePendingRequests();
+#endif
     }
     --s_attachDepth;
 }

Copied: trunk/Source/WebCore/loader/LoaderStrategy.cpp (from rev 132500, trunk/Source/WebCore/loader/LoaderStrategy.h) (0 => 132501)


--- trunk/Source/WebCore/loader/LoaderStrategy.cpp	                        (rev 0)
+++ trunk/Source/WebCore/loader/LoaderStrategy.cpp	2012-10-25 17:16:38 UTC (rev 132501)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2012 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 "LoaderStrategy.h"
+
+#include "ResourceLoadScheduler.h"
+
+#if USE(PLATFORM_STRATEGIES)
+
+namespace WebCore {
+
+ResourceLoadScheduler* LoaderStrategy::resourceLoadScheduler()
+{
+    return WebCore::resourceLoadScheduler();
+}
+
+} // namespace WebCore
+
+#endif // USE(PLATFORM_STRATEGIES)

Modified: trunk/Source/WebCore/loader/LoaderStrategy.h (132500 => 132501)


--- trunk/Source/WebCore/loader/LoaderStrategy.h	2012-10-25 17:09:53 UTC (rev 132500)
+++ trunk/Source/WebCore/loader/LoaderStrategy.h	2012-10-25 17:16:38 UTC (rev 132501)
@@ -29,16 +29,21 @@
 #if USE(PLATFORM_STRATEGIES)
 
 namespace WebCore {
-    
+
+class ResourceLoadScheduler;
+
 class LoaderStrategy {
 public:
+    virtual ResourceLoadScheduler* resourceLoadScheduler();
+
 protected:
     virtual ~LoaderStrategy()
     {
     }
 };
 
-}
+} // namespace WebCore
+
 #endif // USE(PLATFORM_STRATEGIES)
 
 #endif // LoaderStrategy_h

Modified: trunk/Source/WebCore/loader/MainResourceLoader.cpp (132500 => 132501)


--- trunk/Source/WebCore/loader/MainResourceLoader.cpp	2012-10-25 17:09:53 UTC (rev 132500)
+++ trunk/Source/WebCore/loader/MainResourceLoader.cpp	2012-10-25 17:16:38 UTC (rev 132501)
@@ -44,7 +44,9 @@
 #include "HTMLFormElement.h"
 #include "HistoryItem.h"
 #include "InspectorInstrumentation.h"
+#include "LoaderStrategy.h"
 #include "Page.h"
+#include "PlatformStrategies.h"
 #include "ResourceError.h"
 #include "ResourceHandle.h"
 #include "ResourceLoadScheduler.h"
@@ -630,8 +632,13 @@
     if (shouldLoadEmptyBeforeRedirect && !shouldLoadEmpty && defersLoading())
         return true;
 
+#if USE(PLATFORM_STRATEGIES)
+    platformStrategies()->loaderStrategy()->resourceLoadScheduler()->addMainResourceLoad(this);
+#else
     resourceLoadScheduler()->addMainResourceLoad(this);
-    if (m_substituteData.isValid()) 
+#endif
+
+    if (m_substituteData.isValid())
         handleSubstituteDataLoadSoon(r);
     else if (shouldLoadEmpty || frameLoader()->client()->representationExistsForURLScheme(url.protocol()))
         handleEmptyLoad(url, !shouldLoadEmpty);

Modified: trunk/Source/WebCore/loader/ResourceLoadScheduler.cpp (132500 => 132501)


--- trunk/Source/WebCore/loader/ResourceLoadScheduler.cpp	2012-10-25 17:09:53 UTC (rev 132500)
+++ trunk/Source/WebCore/loader/ResourceLoadScheduler.cpp	2012-10-25 17:16:38 UTC (rev 132501)
@@ -89,6 +89,10 @@
 #endif
 }
 
+ResourceLoadScheduler::~ResourceLoadScheduler()
+{
+}
+
 PassRefPtr<SubresourceLoader> ResourceLoadScheduler::scheduleSubresourceLoad(Frame* frame, CachedResource* resource, const ResourceRequest& request, ResourceLoadPriority priority, const ResourceLoaderOptions& options)
 {
     RefPtr<SubresourceLoader> loader = SubresourceLoader::create(frame, resource, request, options);

Modified: trunk/Source/WebCore/loader/ResourceLoadScheduler.h (132500 => 132501)


--- trunk/Source/WebCore/loader/ResourceLoadScheduler.h	2012-10-25 17:09:53 UTC (rev 132500)
+++ trunk/Source/WebCore/loader/ResourceLoadScheduler.h	2012-10-25 17:16:38 UTC (rev 132501)
@@ -64,10 +64,11 @@
     bool isSerialLoadingEnabled() const { return m_isSerialLoadingEnabled; }
     void setSerialLoadingEnabled(bool b) { m_isSerialLoadingEnabled = b; }
 
-private:
+protected:
     ResourceLoadScheduler();
-    ~ResourceLoadScheduler();
+    virtual ~ResourceLoadScheduler();
 
+private:
     void scheduleLoad(ResourceLoader*, ResourceLoadPriority);
     void scheduleServePendingRequests();
     void requestTimerFired(Timer<ResourceLoadScheduler>*);

Modified: trunk/Source/WebCore/loader/ResourceLoader.cpp (132500 => 132501)


--- trunk/Source/WebCore/loader/ResourceLoader.cpp	2012-10-25 17:09:53 UTC (rev 132500)
+++ trunk/Source/WebCore/loader/ResourceLoader.cpp	2012-10-25 17:16:38 UTC (rev 132501)
@@ -37,7 +37,9 @@
 #include "FrameLoader.h"
 #include "FrameLoaderClient.h"
 #include "InspectorInstrumentation.h"
+#include "LoaderStrategy.h"
 #include "Page.h"
+#include "PlatformStrategies.h"
 #include "ProgressTracker.h"
 #include "ResourceBuffer.h"
 #include "ResourceError.h"
@@ -89,9 +91,13 @@
     // the resources to prevent a double dealloc of WebView <rdar://problem/4372628>
     m_reachedTerminalState = true;
 
+#if USE(PLATFORM_STRATEGIES)
+    platformStrategies()->loaderStrategy()->resourceLoadScheduler()->remove(this);
+#endif
     m_identifier = 0;
-
+#if !USE(PLATFORM_STRATEGIES)
     resourceLoadScheduler()->remove(this);
+#endif
 
     if (m_handle) {
         // Clear out the ResourceHandle's client so that it doesn't try to call
@@ -237,8 +243,13 @@
         frameLoader()->notifier()->willSendRequest(this, request, redirectResponse);
     }
 
-    if (!redirectResponse.isNull())
+    if (!redirectResponse.isNull()) {
+#if USE(PLATFORM_STRATEGIES)
+        platformStrategies()->loaderStrategy()->resourceLoadScheduler()->crossOriginRedirectReceived(this, request.url());
+#else
         resourceLoadScheduler()->crossOriginRedirectReceived(this, request.url());
+#endif
+    }
     m_request = request;
 }
 

Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (132500 => 132501)


--- trunk/Source/WebCore/loader/cache/CachedResource.cpp	2012-10-25 17:09:53 UTC (rev 132500)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp	2012-10-25 17:16:38 UTC (rev 132501)
@@ -36,7 +36,9 @@
 #include "FrameLoaderClient.h"
 #include "InspectorInstrumentation.h"
 #include "KURL.h"
+#include "LoaderStrategy.h"
 #include "Logging.h"
+#include "PlatformStrategies.h"
 #include "PurgeableBuffer.h"
 #include "ResourceBuffer.h"
 #include "ResourceHandle.h"
@@ -277,7 +279,12 @@
     m_resourceRequest.setPriority(loadPriority());
     addAdditionalRequestHeaders(cachedResourceLoader);
 
+#if USE(PLATFORM_STRATEGIES)
+    m_loader = platformStrategies()->loaderStrategy()->resourceLoadScheduler()->scheduleSubresourceLoad(cachedResourceLoader->frame(), this, m_resourceRequest, m_resourceRequest.priority(), options);
+#else
     m_loader = resourceLoadScheduler()->scheduleSubresourceLoad(cachedResourceLoader->frame(), this, m_resourceRequest, m_resourceRequest.priority(), options);
+#endif
+
     if (!m_loader) {
         failBeforeStarting();
         return;

Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (132500 => 132501)


--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2012-10-25 17:09:53 UTC (rev 132500)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2012-10-25 17:16:38 UTC (rev 132501)
@@ -44,9 +44,11 @@
 #include "FrameLoader.h"
 #include "FrameLoaderClient.h"
 #include "HTMLElement.h"
+#include "LoaderStrategy.h"
 #include "Logging.h"
 #include "MemoryCache.h"
 #include "PingLoader.h"
+#include "PlatformStrategies.h"
 #include "ResourceLoadScheduler.h"
 #include "SecurityOrigin.h"
 #include "Settings.h"
@@ -719,7 +721,12 @@
 void CachedResourceLoader::performPostLoadActions()
 {
     checkForPendingPreloads();
+
+#if USE(PLATFORM_STRATEGIES)
+    platformStrategies()->loaderStrategy()->resourceLoadScheduler()->servePendingRequests();
+#else
     resourceLoadScheduler()->servePendingRequests();
+#endif
 }
 
 void CachedResourceLoader::notifyLoadedFromMemoryCache(CachedResource* resource)

Modified: trunk/Source/WebKit2/ChangeLog (132500 => 132501)


--- trunk/Source/WebKit2/ChangeLog	2012-10-25 17:09:53 UTC (rev 132500)
+++ trunk/Source/WebKit2/ChangeLog	2012-10-25 17:16:38 UTC (rev 132501)
@@ -1,3 +1,26 @@
+2012-10-25  Brady Eidson  <[email protected]>
+
+        Allow LoaderStrategy to override the ResourceLoadScheduler
+        https://bugs.webkit.org/show_bug.cgi?id=100355
+
+        Reviewed by Anders Carlsson.
+
+        Add a WebKit2 subclass of ResourceLoadScheduler that currently adds no new functionality:
+        * WebProcess/Network/WebResourceLoadScheduler.cpp: 
+        (WebKit::WebResourceLoadScheduler::~WebResourceLoadScheduler):
+        * WebProcess/Network/WebResourceLoadScheduler.h: 
+
+        WebProcess hangs on to the default shared WebResourceLoadScheduler:
+        * WebProcess/WebProcess.h:
+        (WebKit::WebProcess::webResourceLoadScheduler):
+
+        If the NetworkProcess is enabled, return the new WebResourceLoadScheduler:
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+        (WebKit::WebPlatformStrategies::resourceLoadScheduler):
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
+
+        * WebKit2.xcodeproj/project.pbxproj:
+
 2012-10-25  Christophe Dumez  <[email protected]>
 
         [EFL][WK2] Remove some C'ism from EwkView

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (132500 => 132501)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2012-10-25 17:09:53 UTC (rev 132500)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2012-10-25 17:16:38 UTC (rev 132501)
@@ -461,6 +461,7 @@
 		51A9E1291315ED35009E7031 /* WebKeyValueStorageManagerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 51A9E1251315ED35009E7031 /* WebKeyValueStorageManagerMessages.h */; };
 		51A9E12A1315ED35009E7031 /* WebKeyValueStorageManagerProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51A9E1261315ED35009E7031 /* WebKeyValueStorageManagerProxyMessageReceiver.cpp */; };
 		51A9E12B1315ED35009E7031 /* WebKeyValueStorageManagerProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 51A9E1271315ED35009E7031 /* WebKeyValueStorageManagerProxyMessages.h */; };
+		51ABF65A16392F2000132A7A /* WebResourceLoadScheduler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51ABF65616392F1500132A7A /* WebResourceLoadScheduler.cpp */; };
 		51ACBB82127A8BAD00D203B9 /* WebContextMenuProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 51ACBB81127A8BAD00D203B9 /* WebContextMenuProxy.h */; };
 		51ACBBA0127A8F2C00D203B9 /* WebContextMenuProxyMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 51ACBB9E127A8F2C00D203B9 /* WebContextMenuProxyMac.h */; };
 		51ACBBA1127A8F2C00D203B9 /* WebContextMenuProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51ACBB9F127A8F2C00D203B9 /* WebContextMenuProxyMac.mm */; };
@@ -1636,6 +1637,8 @@
 		51A9E1251315ED35009E7031 /* WebKeyValueStorageManagerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKeyValueStorageManagerMessages.h; sourceTree = "<group>"; };
 		51A9E1261315ED35009E7031 /* WebKeyValueStorageManagerProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKeyValueStorageManagerProxyMessageReceiver.cpp; sourceTree = "<group>"; };
 		51A9E1271315ED35009E7031 /* WebKeyValueStorageManagerProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKeyValueStorageManagerProxyMessages.h; sourceTree = "<group>"; };
+		51ABF65616392F1500132A7A /* WebResourceLoadScheduler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebResourceLoadScheduler.cpp; path = Network/WebResourceLoadScheduler.cpp; sourceTree = "<group>"; };
+		51ABF65716392F1500132A7A /* WebResourceLoadScheduler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebResourceLoadScheduler.h; path = Network/WebResourceLoadScheduler.h; sourceTree = "<group>"; };
 		51ACBB81127A8BAD00D203B9 /* WebContextMenuProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenuProxy.h; sourceTree = "<group>"; };
 		51ACBB9E127A8F2C00D203B9 /* WebContextMenuProxyMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenuProxyMac.h; sourceTree = "<group>"; };
 		51ACBB9F127A8F2C00D203B9 /* WebContextMenuProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebContextMenuProxyMac.mm; sourceTree = "<group>"; };
@@ -2952,6 +2955,8 @@
 			children = (
 				5105B0D4162F7A7A00E27709 /* NetworkProcessConnection.cpp */,
 				5105B0D5162F7A7A00E27709 /* NetworkProcessConnection.h */,
+				51ABF65616392F1500132A7A /* WebResourceLoadScheduler.cpp */,
+				51ABF65716392F1500132A7A /* WebResourceLoadScheduler.h */,
 			);
 			name = Network;
 			sourceTree = "<group>";
@@ -5694,6 +5699,7 @@
 				513A164C1630A9BF005D7D22 /* NetworkConnectionToWebProcess.cpp in Sources */,
 				5183DDEC1630BDFC008BE5C7 /* NetworkProcessConnection.cpp in Sources */,
 				1A13BEB31635A9C800F19C03 /* StringReference.cpp in Sources */,
+				51ABF65A16392F2000132A7A /* WebResourceLoadScheduler.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Copied: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp (from rev 132500, trunk/Source/WebCore/loader/LoaderStrategy.h) (0 => 132501)


--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp	2012-10-25 17:16:38 UTC (rev 132501)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2012 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 "WebResourceLoadScheduler.h"
+
+#if ENABLE(NETWORK_PROCESS)
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebResourceLoadScheduler::~WebResourceLoadScheduler()
+{
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(NETWORK_PROCESS)

Copied: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.h (from rev 132500, trunk/Source/WebCore/loader/LoaderStrategy.h) (0 => 132501)


--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.h	                        (rev 0)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.h	2012-10-25 17:16:38 UTC (rev 132501)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2012 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 WebResourceLoadScheduler_h
+#define WebResourceLoadScheduler_h
+
+#include <WebCore/ResourceLoadScheduler.h>
+
+#if ENABLE(NETWORK_PROCESS)
+
+namespace WebKit {
+
+class WebResourceLoadScheduler : public WebCore::ResourceLoadScheduler {
+public:
+    virtual ~WebResourceLoadScheduler();
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(NETWORK_PROCESS)
+
+#endif // WebResourceLoadScheduler_h

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp (132500 => 132501)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp	2012-10-25 17:09:53 UTC (rev 132500)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp	2012-10-25 17:16:38 UTC (rev 132501)
@@ -37,6 +37,7 @@
 #include "WebProcessProxyMessages.h"
 #include <WebCore/Color.h>
 #include <WebCore/KURL.h>
+#include <WebCore/LoaderStrategy.h>
 #include <WebCore/Page.h>
 #include <WebCore/PlatformPasteboard.h>
 #include <wtf/Atomics.h>
@@ -100,6 +101,21 @@
     WebCookieManager::shared().dispatchCookiesDidChange();
 }
 
+// LoaderStrategy
+
+#if ENABLE(NETWORK_PROCESS)
+
+ResourceLoadScheduler* WebPlatformStrategies::resourceLoadScheduler()
+{
+    static ResourceLoadScheduler* scheduler;
+    if (!scheduler)
+        scheduler = &WebProcess::shared().webResourceLoadScheduler();
+        
+    return scheduler;
+}
+
+#endif
+
 // PluginStrategy
 
 void WebPlatformStrategies::refreshPlugins()

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h (132500 => 132501)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h	2012-10-25 17:09:53 UTC (rev 132500)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h	2012-10-25 17:16:38 UTC (rev 132501)
@@ -56,6 +56,11 @@
     // WebCore::CookiesStrategy
     virtual void notifyCookiesChanged() OVERRIDE;
 
+    // WebCore::LoaderStrategy
+#if ENABLE(NETWORK_PROCESS)
+    virtual WebCore::ResourceLoadScheduler* resourceLoadScheduler() OVERRIDE;
+#endif
+
     // WebCore::PluginStrategy
     virtual void refreshPlugins() OVERRIDE;
     virtual void getPluginInfo(const WebCore::Page*, Vector<WebCore::PluginInfo>&) OVERRIDE;

Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (132500 => 132501)


--- trunk/Source/WebKit2/WebProcess/WebProcess.h	2012-10-25 17:09:53 UTC (rev 132500)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.h	2012-10-25 17:16:38 UTC (rev 132501)
@@ -72,6 +72,10 @@
 #include "WebNotificationManager.h"
 #endif
 
+#if ENABLE(NETWORK_PROCESS)
+#include "WebResourceLoadScheduler.h"
+#endif
+
 #if ENABLE(PLUGIN_PROCESS)
 #include "PluginProcessConnectionManager.h"
 #endif
@@ -200,6 +204,7 @@
 
 #if ENABLE(NETWORK_PROCESS)
     void networkProcessConnectionClosed(NetworkProcessConnection*);
+    WebResourceLoadScheduler& webResourceLoadScheduler() { return m_webResourceLoadScheduler; }
 #endif
 
 private:
@@ -357,6 +362,7 @@
     void ensureNetworkProcessConnection();
     RefPtr<NetworkProcessConnection> m_networkProcessConnection;
     bool m_usesNetworkProcess;
+    WebResourceLoadScheduler m_webResourceLoadScheduler;
 #endif
 
 #if ENABLE(PLUGIN_PROCESS)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to