Print stylesheet on nytimes.com loads too early
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Apr 2011 17:20:00 +0000 (17:20 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Apr 2011 17:20:00 +0000 (17:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=57814

Reviewed by Sam Weinig.

Don't load resources with Very Low priority until there are no other resources to
load for the host (or until document is complete enough that we stop limiting requests).

No tests, this is  difficult to observe reliably with our current testing infrastructure.
Verified working with Wireshark.

* loader/ResourceLoadScheduler.cpp:
(WebCore::ResourceLoadScheduler::servePendingRequests):
(WebCore::ResourceLoadScheduler::HostInformation::limitRequests):
* loader/ResourceLoadScheduler.h:

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

Source/WebCore/ChangeLog
Source/WebCore/loader/ResourceLoadScheduler.cpp
Source/WebCore/loader/ResourceLoadScheduler.h

index 4f3fc98..87a7d4f 100644 (file)
@@ -1,3 +1,21 @@
+2011-04-04  Antti Koivisto  <antti@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Print stylesheet on nytimes.com loads too early
+        https://bugs.webkit.org/show_bug.cgi?id=57814
+
+        Don't load resources with Very Low priority until there are no other resources to 
+        load for the host (or until document is complete enough that we stop limiting requests).
+
+        No tests, this is  difficult to observe reliably with our current testing infrastructure.
+        Verified working with Wireshark.
+
+        * loader/ResourceLoadScheduler.cpp:
+        (WebCore::ResourceLoadScheduler::servePendingRequests):
+        (WebCore::ResourceLoadScheduler::HostInformation::limitRequests):
+        * loader/ResourceLoadScheduler.h:
+
 2011-04-04  Steve Block  <steveblock@google.com>
 
         Reviewed by Dimitri Glazkov.
index 7cceff7..0c0abb1 100644 (file)
@@ -183,7 +183,7 @@ void ResourceLoadScheduler::servePendingRequests(HostInformation* host, Resource
     LOG(ResourceLoading, "ResourceLoadScheduler::servePendingRequests HostInformation.m_name='%s'", host->name().latin1().data());
 
     for (int priority = ResourceLoadPriorityHighest; priority >= minimumPriority; --priority) {
-        HostInformation::RequestQueue& requestsPending = host->requestsPending((ResourceLoadPriority) priority);
+        HostInformation::RequestQueue& requestsPending = host->requestsPending(ResourceLoadPriority(priority));
 
         while (!requestsPending.isEmpty()) {
             RefPtr<ResourceLoader> resourceLoader = requestsPending.first();
@@ -193,7 +193,7 @@ void ResourceLoadScheduler::servePendingRequests(HostInformation* host, Resource
             // and we don't know all stylesheets yet.
             Document* document = resourceLoader->frameLoader() ? resourceLoader->frameLoader()->frame()->document() : 0;
             bool shouldLimitRequests = !host->name().isNull() || (document && (document->parsing() || !document->haveStylesheetsLoaded()));
-            if (shouldLimitRequests && host->limitRequests())
+            if (shouldLimitRequests && host->limitRequests(ResourceLoadPriority(priority)))
                 return;
 
             requestsPending.removeFirst();
@@ -283,8 +283,10 @@ bool ResourceLoadScheduler::HostInformation::hasRequests() const
     return false;
 }
 
-bool ResourceLoadScheduler::HostInformation::limitRequests() const 
-{ 
+bool ResourceLoadScheduler::HostInformation::limitRequests(ResourceLoadPriority priority) const 
+{
+    if (priority == ResourceLoadPriorityVeryLow && !m_requestsLoading.isEmpty())
+        return true;
     return m_requestsLoading.size() >= (resourceLoadScheduler()->isSerialLoadingEnabled() ? 1 : m_maxRequestsInFlight);
 }
 
index 49a4546..a32b307 100644 (file)
@@ -82,7 +82,7 @@ private:
         void addLoadInProgress(ResourceLoader*);
         void remove(ResourceLoader*);
         bool hasRequests() const;
-        bool limitRequests() const;
+        bool limitRequests(ResourceLoadPriority) const;
 
         typedef Deque<RefPtr<ResourceLoader> > RequestQueue;
         RequestQueue& requestsPending(ResourceLoadPriority priority) { return m_requestsPending[priority]; }