OLD | NEW |
1 /* | 1 /* |
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) |
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) | 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) |
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) | 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) |
5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
rights reserved. | 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
rights reserved. |
6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ | 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ |
7 | 7 |
8 This library is free software; you can redistribute it and/or | 8 This library is free software; you can redistribute it and/or |
9 modify it under the terms of the GNU Library General Public | 9 modify it under the terms of the GNU Library General Public |
10 License as published by the Free Software Foundation; either | 10 License as published by the Free Software Foundation; either |
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 { | 1045 { |
1046 if (res->ignoreForRequestCount()) | 1046 if (res->ignoreForRequestCount()) |
1047 return; | 1047 return; |
1048 | 1048 |
1049 --m_requestCount; | 1049 --m_requestCount; |
1050 ASSERT(m_requestCount > -1); | 1050 ASSERT(m_requestCount > -1); |
1051 } | 1051 } |
1052 | 1052 |
1053 void ResourceFetcher::preload(Resource::Type type, FetchRequest& request, const
String& charset) | 1053 void ResourceFetcher::preload(Resource::Type type, FetchRequest& request, const
String& charset) |
1054 { | 1054 { |
1055 bool delaySubresourceLoad = true; | |
1056 delaySubresourceLoad = false; | |
1057 if (delaySubresourceLoad) { | |
1058 // FIXME: It seems wrong to poke body()->renderer() here. | |
1059 bool hasRendering = m_document->body() && m_document->body()->renderer()
; | |
1060 bool canBlockParser = type == Resource::Script || type == Resource::CSSS
tyleSheet; | |
1061 if (!hasRendering && !canBlockParser) { | |
1062 // Don't preload subresources that can't block the parser before we
have something to draw. | |
1063 // This helps prevent preloads from delaying first display when band
width is limited. | |
1064 PendingPreload pendingPreload = { type, request, charset }; | |
1065 m_pendingPreloads.append(pendingPreload); | |
1066 return; | |
1067 } | |
1068 } | |
1069 requestPreload(type, request, charset); | 1055 requestPreload(type, request, charset); |
1070 } | 1056 } |
1071 | 1057 |
1072 void ResourceFetcher::checkForPendingPreloads() | 1058 void ResourceFetcher::checkForPendingPreloads() |
1073 { | 1059 { |
1074 // FIXME: It seems wrong to poke body()->renderer() here. | 1060 // FIXME: It seems wrong to poke body()->renderer() here. |
1075 if (m_pendingPreloads.isEmpty() || !m_document->body() || !m_document->body(
)->renderer()) | 1061 if (m_pendingPreloads.isEmpty() || !m_document->body() || !m_document->body(
)->renderer()) |
1076 return; | 1062 return; |
1077 while (!m_pendingPreloads.isEmpty()) { | 1063 while (!m_pendingPreloads.isEmpty()) { |
1078 PendingPreload preload = m_pendingPreloads.takeFirst(); | 1064 PendingPreload preload = m_pendingPreloads.takeFirst(); |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1334 } | 1320 } |
1335 #endif | 1321 #endif |
1336 | 1322 |
1337 const ResourceLoaderOptions& ResourceFetcher::defaultResourceOptions() | 1323 const ResourceLoaderOptions& ResourceFetcher::defaultResourceOptions() |
1338 { | 1324 { |
1339 DEFINE_STATIC_LOCAL(ResourceLoaderOptions, options, (SendCallbacks, SniffCon
tent, BufferData, AllowStoredCredentials, ClientRequestedCredentials, AskClientF
orCrossOriginCredentials, DoSecurityCheck, CheckContentSecurityPolicy, UseDefaul
tOriginRestrictionsForType, DocumentContext)); | 1325 DEFINE_STATIC_LOCAL(ResourceLoaderOptions, options, (SendCallbacks, SniffCon
tent, BufferData, AllowStoredCredentials, ClientRequestedCredentials, AskClientF
orCrossOriginCredentials, DoSecurityCheck, CheckContentSecurityPolicy, UseDefaul
tOriginRestrictionsForType, DocumentContext)); |
1340 return options; | 1326 return options; |
1341 } | 1327 } |
1342 | 1328 |
1343 } | 1329 } |
OLD | NEW |