| 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 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 if (resource->options().requestInitiatorContext == DocumentContext) | 1157 if (resource->options().requestInitiatorContext == DocumentContext) |
| 1158 context().addResourceTiming(*info); | 1158 context().addResourceTiming(*info); |
| 1159 resource->reportResourceTimingToClients(*info); | 1159 resource->reportResourceTimingToClients(*info); |
| 1160 } | 1160 } |
| 1161 } | 1161 } |
| 1162 context().dispatchDidFinishLoading(resource->identifier(), finishTime, | 1162 context().dispatchDidFinishLoading(resource->identifier(), finishTime, |
| 1163 encodedDataLength); | 1163 encodedDataLength); |
| 1164 if (finishReason == DidFinishLoading) | 1164 if (finishReason == DidFinishLoading) |
| 1165 resource->finish(finishTime); | 1165 resource->finish(finishTime); |
| 1166 context().didLoadResource(resource); | 1166 context().didLoadResource(resource); |
| 1167 |
| 1168 if (resource->isImage() && |
| 1169 toImageResource(resource)->shouldReloadBrokenPlaceholder()) { |
| 1170 toImageResource(resource)->reloadIfLoFiOrPlaceholder(this); |
| 1171 } |
| 1167 } | 1172 } |
| 1168 | 1173 |
| 1169 void ResourceFetcher::didFailLoading(Resource* resource, | 1174 void ResourceFetcher::didFailLoading(Resource* resource, |
| 1170 const ResourceError& error) { | 1175 const ResourceError& error) { |
| 1171 TRACE_EVENT_ASYNC_END0("blink.net", "Resource", resource->identifier()); | 1176 TRACE_EVENT_ASYNC_END0("blink.net", "Resource", resource->identifier()); |
| 1172 removeResourceLoader(resource->loader()); | 1177 removeResourceLoader(resource->loader()); |
| 1173 m_resourceTimingInfoMap.take(const_cast<Resource*>(resource)); | 1178 m_resourceTimingInfoMap.take(const_cast<Resource*>(resource)); |
| 1174 bool isInternalRequest = resource->options().initiatorInfo.name == | 1179 bool isInternalRequest = resource->options().initiatorInfo.name == |
| 1175 FetchInitiatorTypeNames::internal; | 1180 FetchInitiatorTypeNames::internal; |
| 1176 context().dispatchDidFail(resource->identifier(), error, isInternalRequest); | 1181 context().dispatchDidFail(resource->identifier(), error, isInternalRequest); |
| 1177 resource->error(error); | 1182 resource->error(error); |
| 1178 context().didLoadResource(resource); | 1183 context().didLoadResource(resource); |
| 1184 |
| 1185 if (resource->isImage() && |
| 1186 toImageResource(resource)->shouldReloadBrokenPlaceholder()) { |
| 1187 toImageResource(resource)->reloadIfLoFiOrPlaceholder(this); |
| 1188 } |
| 1179 } | 1189 } |
| 1180 | 1190 |
| 1181 void ResourceFetcher::didReceiveResponse(Resource* resource, | 1191 void ResourceFetcher::didReceiveResponse(Resource* resource, |
| 1182 const ResourceResponse& response, | 1192 const ResourceResponse& response, |
| 1183 WebDataConsumerHandle* rawHandle) { | 1193 WebDataConsumerHandle* rawHandle) { |
| 1184 // |rawHandle|'s ownership is transferred to the callee. | 1194 // |rawHandle|'s ownership is transferred to the callee. |
| 1185 std::unique_ptr<WebDataConsumerHandle> handle = wrapUnique(rawHandle); | 1195 std::unique_ptr<WebDataConsumerHandle> handle = wrapUnique(rawHandle); |
| 1186 | 1196 |
| 1187 if (response.wasFetchedViaServiceWorker()) { | 1197 if (response.wasFetchedViaServiceWorker()) { |
| 1188 if (resource->options().corsEnabled == IsCORSEnabled && | 1198 if (resource->options().corsEnabled == IsCORSEnabled && |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1416 resource->identifier(), resourceLoadPriority, | 1426 resource->identifier(), resourceLoadPriority, |
| 1417 resourcePriority.intraPriorityValue); | 1427 resourcePriority.intraPriorityValue); |
| 1418 } | 1428 } |
| 1419 } | 1429 } |
| 1420 | 1430 |
| 1421 void ResourceFetcher::reloadLoFiImages() { | 1431 void ResourceFetcher::reloadLoFiImages() { |
| 1422 for (const auto& documentResource : m_documentResources) { | 1432 for (const auto& documentResource : m_documentResources) { |
| 1423 Resource* resource = documentResource.value.get(); | 1433 Resource* resource = documentResource.value.get(); |
| 1424 if (resource && resource->isImage()) { | 1434 if (resource && resource->isImage()) { |
| 1425 ImageResource* imageResource = toImageResource(resource); | 1435 ImageResource* imageResource = toImageResource(resource); |
| 1426 imageResource->reloadIfLoFi(this); | 1436 imageResource->reloadIfLoFiOrPlaceholder(this); |
| 1427 } | 1437 } |
| 1428 } | 1438 } |
| 1429 } | 1439 } |
| 1430 | 1440 |
| 1431 void ResourceFetcher::logPreloadStats() { | 1441 void ResourceFetcher::logPreloadStats() { |
| 1432 if (!m_preloads) | 1442 if (!m_preloads) |
| 1433 return; | 1443 return; |
| 1434 unsigned scripts = 0; | 1444 unsigned scripts = 0; |
| 1435 unsigned scriptMisses = 0; | 1445 unsigned scriptMisses = 0; |
| 1436 unsigned stylesheets = 0; | 1446 unsigned stylesheets = 0; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1612 visitor->trace(m_context); | 1622 visitor->trace(m_context); |
| 1613 visitor->trace(m_archive); | 1623 visitor->trace(m_archive); |
| 1614 visitor->trace(m_loaders); | 1624 visitor->trace(m_loaders); |
| 1615 visitor->trace(m_nonBlockingLoaders); | 1625 visitor->trace(m_nonBlockingLoaders); |
| 1616 visitor->trace(m_documentResources); | 1626 visitor->trace(m_documentResources); |
| 1617 visitor->trace(m_preloads); | 1627 visitor->trace(m_preloads); |
| 1618 visitor->trace(m_resourceTimingInfoMap); | 1628 visitor->trace(m_resourceTimingInfoMap); |
| 1619 } | 1629 } |
| 1620 | 1630 |
| 1621 } // namespace blink | 1631 } // namespace blink |
| OLD | NEW |