| 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 | 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
| 6 rights reserved. | 6 rights reserved. |
| 7 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ | 7 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ |
| 8 | 8 |
| 9 This library is free software; you can redistribute it and/or | 9 This library is free software; you can redistribute it and/or |
| 10 modify it under the terms of the GNU Library General Public | 10 modify it under the terms of the GNU Library General Public |
| (...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1163 info->addFinalTransferSize(encodedDataLength == -1 ? 0 | 1163 info->addFinalTransferSize(encodedDataLength == -1 ? 0 |
| 1164 : encodedDataLength); | 1164 : encodedDataLength); |
| 1165 if (resource->options().requestInitiatorContext == DocumentContext) | 1165 if (resource->options().requestInitiatorContext == DocumentContext) |
| 1166 context().addResourceTiming(*info); | 1166 context().addResourceTiming(*info); |
| 1167 resource->reportResourceTimingToClients(*info); | 1167 resource->reportResourceTimingToClients(*info); |
| 1168 } | 1168 } |
| 1169 } | 1169 } |
| 1170 context().dispatchDidFinishLoading(resource->identifier(), finishTime, | 1170 context().dispatchDidFinishLoading(resource->identifier(), finishTime, |
| 1171 encodedDataLength); | 1171 encodedDataLength); |
| 1172 if (finishReason == DidFinishLoading) | 1172 if (finishReason == DidFinishLoading) |
| 1173 resource->finish(finishTime); | 1173 resource->finish(finishTime, this); |
| 1174 context().didLoadResource(resource); | 1174 context().didLoadResource(resource); |
| 1175 | |
| 1176 if (resource->isImage() && | |
| 1177 toImageResource(resource)->shouldReloadBrokenPlaceholder()) { | |
| 1178 toImageResource(resource)->reloadIfLoFiOrPlaceholder(this); | |
| 1179 } | |
| 1180 } | 1175 } |
| 1181 | 1176 |
| 1182 void ResourceFetcher::didFailLoading(Resource* resource, | 1177 void ResourceFetcher::didFailLoading(Resource* resource, |
| 1183 const ResourceError& error) { | 1178 const ResourceError& error) { |
| 1184 network_instrumentation::endResourceLoad( | 1179 network_instrumentation::endResourceLoad( |
| 1185 resource->identifier(), network_instrumentation::RequestOutcome::Fail); | 1180 resource->identifier(), network_instrumentation::RequestOutcome::Fail); |
| 1186 removeResourceLoader(resource->loader()); | 1181 removeResourceLoader(resource->loader()); |
| 1187 m_resourceTimingInfoMap.take(const_cast<Resource*>(resource)); | 1182 m_resourceTimingInfoMap.take(const_cast<Resource*>(resource)); |
| 1188 bool isInternalRequest = resource->options().initiatorInfo.name == | 1183 bool isInternalRequest = resource->options().initiatorInfo.name == |
| 1189 FetchInitiatorTypeNames::internal; | 1184 FetchInitiatorTypeNames::internal; |
| 1190 context().dispatchDidFail(resource->identifier(), error, isInternalRequest); | 1185 context().dispatchDidFail(resource->identifier(), error, isInternalRequest); |
| 1191 resource->error(error); | 1186 resource->error(error, this); |
| 1192 context().didLoadResource(resource); | 1187 context().didLoadResource(resource); |
| 1193 | |
| 1194 if (resource->isImage() && | |
| 1195 toImageResource(resource)->shouldReloadBrokenPlaceholder()) { | |
| 1196 toImageResource(resource)->reloadIfLoFiOrPlaceholder(this); | |
| 1197 } | |
| 1198 } | 1188 } |
| 1199 | 1189 |
| 1200 void ResourceFetcher::didReceiveResponse( | 1190 void ResourceFetcher::didReceiveResponse( |
| 1201 Resource* resource, | 1191 Resource* resource, |
| 1202 const ResourceResponse& response, | 1192 const ResourceResponse& response, |
| 1203 std::unique_ptr<WebDataConsumerHandle> handle) { | 1193 std::unique_ptr<WebDataConsumerHandle> handle) { |
| 1204 if (response.wasFetchedViaServiceWorker()) { | 1194 if (response.wasFetchedViaServiceWorker()) { |
| 1205 if (resource->options().corsEnabled == IsCORSEnabled && | 1195 if (resource->options().corsEnabled == IsCORSEnabled && |
| 1206 response.wasFallbackRequiredByServiceWorker()) { | 1196 response.wasFallbackRequiredByServiceWorker()) { |
| 1207 ResourceRequest request = resource->lastResourceRequest(); | 1197 ResourceRequest request = resource->lastResourceRequest(); |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1436 resourcePriority.intraPriorityValue); | 1426 resourcePriority.intraPriorityValue); |
| 1437 network_instrumentation::resourcePrioritySet(resource->identifier(), | 1427 network_instrumentation::resourcePrioritySet(resource->identifier(), |
| 1438 resourceLoadPriority); | 1428 resourceLoadPriority); |
| 1439 context().dispatchDidChangeResourcePriority( | 1429 context().dispatchDidChangeResourcePriority( |
| 1440 resource->identifier(), resourceLoadPriority, | 1430 resource->identifier(), resourceLoadPriority, |
| 1441 resourcePriority.intraPriorityValue); | 1431 resourcePriority.intraPriorityValue); |
| 1442 } | 1432 } |
| 1443 } | 1433 } |
| 1444 | 1434 |
| 1445 void ResourceFetcher::reloadLoFiImages() { | 1435 void ResourceFetcher::reloadLoFiImages() { |
| 1446 for (const auto& documentResource : m_documentResources) { | 1436 for (auto& documentResource : m_documentResources) { |
| 1447 Resource* resource = documentResource.value.get(); | 1437 Resource* resource = documentResource.value.get(); |
| 1448 if (resource && resource->isImage()) { | 1438 if (resource && resource->isImage()) { |
| 1449 ImageResource* imageResource = toImageResource(resource); | 1439 ImageResource* imageResource = toImageResource(resource); |
| 1450 imageResource->reloadIfLoFiOrPlaceholder(this); | 1440 ImageResource* newImageResource = |
| 1441 imageResource->reloadIfLoFiOrPlaceholder(this); |
| 1442 if (newImageResource) |
| 1443 documentResource.value = newImageResource; |
| 1451 } | 1444 } |
| 1452 } | 1445 } |
| 1453 } | 1446 } |
| 1454 | 1447 |
| 1455 void ResourceFetcher::logPreloadStats(ClearPreloadsPolicy policy) { | 1448 void ResourceFetcher::logPreloadStats(ClearPreloadsPolicy policy) { |
| 1456 if (!m_preloads) | 1449 if (!m_preloads) |
| 1457 return; | 1450 return; |
| 1458 unsigned scripts = 0; | 1451 unsigned scripts = 0; |
| 1459 unsigned scriptMisses = 0; | 1452 unsigned scriptMisses = 0; |
| 1460 unsigned stylesheets = 0; | 1453 unsigned stylesheets = 0; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1655 visitor->trace(m_context); | 1648 visitor->trace(m_context); |
| 1656 visitor->trace(m_archive); | 1649 visitor->trace(m_archive); |
| 1657 visitor->trace(m_loaders); | 1650 visitor->trace(m_loaders); |
| 1658 visitor->trace(m_nonBlockingLoaders); | 1651 visitor->trace(m_nonBlockingLoaders); |
| 1659 visitor->trace(m_documentResources); | 1652 visitor->trace(m_documentResources); |
| 1660 visitor->trace(m_preloads); | 1653 visitor->trace(m_preloads); |
| 1661 visitor->trace(m_resourceTimingInfoMap); | 1654 visitor->trace(m_resourceTimingInfoMap); |
| 1662 } | 1655 } |
| 1663 | 1656 |
| 1664 } // namespace blink | 1657 } // namespace blink |
| OLD | NEW |