Commit 93ac97c6 authored by antti@apple.com's avatar antti@apple.com

Print stylesheet on nytimes.com loads too early

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: svn://svn.chromium.org/blink/trunk@82951 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent c8f65810
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> 2011-04-04 Steve Block <steveblock@google.com>
Reviewed by Dimitri Glazkov. Reviewed by Dimitri Glazkov.
...@@ -183,7 +183,7 @@ void ResourceLoadScheduler::servePendingRequests(HostInformation* host, Resource ...@@ -183,7 +183,7 @@ void ResourceLoadScheduler::servePendingRequests(HostInformation* host, Resource
LOG(ResourceLoading, "ResourceLoadScheduler::servePendingRequests HostInformation.m_name='%s'", host->name().latin1().data()); LOG(ResourceLoading, "ResourceLoadScheduler::servePendingRequests HostInformation.m_name='%s'", host->name().latin1().data());
for (int priority = ResourceLoadPriorityHighest; priority >= minimumPriority; --priority) { for (int priority = ResourceLoadPriorityHighest; priority >= minimumPriority; --priority) {
HostInformation::RequestQueue& requestsPending = host->requestsPending((ResourceLoadPriority) priority); HostInformation::RequestQueue& requestsPending = host->requestsPending(ResourceLoadPriority(priority));
while (!requestsPending.isEmpty()) { while (!requestsPending.isEmpty()) {
RefPtr<ResourceLoader> resourceLoader = requestsPending.first(); RefPtr<ResourceLoader> resourceLoader = requestsPending.first();
...@@ -193,7 +193,7 @@ void ResourceLoadScheduler::servePendingRequests(HostInformation* host, Resource ...@@ -193,7 +193,7 @@ void ResourceLoadScheduler::servePendingRequests(HostInformation* host, Resource
// and we don't know all stylesheets yet. // and we don't know all stylesheets yet.
Document* document = resourceLoader->frameLoader() ? resourceLoader->frameLoader()->frame()->document() : 0; Document* document = resourceLoader->frameLoader() ? resourceLoader->frameLoader()->frame()->document() : 0;
bool shouldLimitRequests = !host->name().isNull() || (document && (document->parsing() || !document->haveStylesheetsLoaded())); bool shouldLimitRequests = !host->name().isNull() || (document && (document->parsing() || !document->haveStylesheetsLoaded()));
if (shouldLimitRequests && host->limitRequests()) if (shouldLimitRequests && host->limitRequests(ResourceLoadPriority(priority)))
return; return;
requestsPending.removeFirst(); requestsPending.removeFirst();
...@@ -283,8 +283,10 @@ bool ResourceLoadScheduler::HostInformation::hasRequests() const ...@@ -283,8 +283,10 @@ bool ResourceLoadScheduler::HostInformation::hasRequests() const
return false; 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); return m_requestsLoading.size() >= (resourceLoadScheduler()->isSerialLoadingEnabled() ? 1 : m_maxRequestsInFlight);
} }
......
...@@ -82,7 +82,7 @@ private: ...@@ -82,7 +82,7 @@ private:
void addLoadInProgress(ResourceLoader*); void addLoadInProgress(ResourceLoader*);
void remove(ResourceLoader*); void remove(ResourceLoader*);
bool hasRequests() const; bool hasRequests() const;
bool limitRequests() const; bool limitRequests(ResourceLoadPriority) const;
typedef Deque<RefPtr<ResourceLoader> > RequestQueue; typedef Deque<RefPtr<ResourceLoader> > RequestQueue;
RequestQueue& requestsPending(ResourceLoadPriority priority) { return m_requestsPending[priority]; } RequestQueue& requestsPending(ResourceLoadPriority priority) { return m_requestsPending[priority]; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment