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 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1101 } | 1101 } |
1102 context().dispatchDidFinishLoading(resource->identifier(), finishTime, | 1102 context().dispatchDidFinishLoading(resource->identifier(), finishTime, |
1103 encodedDataLength); | 1103 encodedDataLength); |
1104 if (finishReason == DidFinishLoading) | 1104 if (finishReason == DidFinishLoading) |
1105 resource->finish(finishTime); | 1105 resource->finish(finishTime); |
1106 context().didLoadResource(resource); | 1106 context().didLoadResource(resource); |
1107 } | 1107 } |
1108 | 1108 |
1109 void ResourceFetcher::didFailLoading(Resource* resource, | 1109 void ResourceFetcher::didFailLoading(Resource* resource, |
1110 const ResourceError& error) { | 1110 const ResourceError& error) { |
1111 if (resource->resourceRequest().isCacheAwareLoadingActivated()) { | |
1112 // Assume error.errorCode() == net::ERR_CACHE_MISS, resend request with | |
hiroshige
2016/10/03 08:08:02
- We have to drop the isCacheAwareLoadingActivated
yhirano
2016/10/04 05:27:10
But we don't need the former if we have the latter
Shao-Chuan Lee
2016/10/04 09:08:04
Now we check isCancellation() and isAccessCheck()
Shao-Chuan Lee
2016/10/04 09:46:25
Now dropping flags in Resource::finish() instead o
Shao-Chuan Lee
2016/10/07 08:10:06
Now dropping flags in didFinishLoading().
| |
1113 // existing ResourceLoader. | |
1114 resource->willReloadAfterDiskCacheMiss(); | |
1115 resource->loader()->start(resource->resourceRequest(), | |
1116 context().loadingTaskRunner(), | |
1117 context().defersLoading()); | |
1118 return; | |
1119 } | |
1120 | |
1111 TRACE_EVENT_ASYNC_END0("blink.net", "Resource", resource->identifier()); | 1121 TRACE_EVENT_ASYNC_END0("blink.net", "Resource", resource->identifier()); |
1112 removeResourceLoader(resource->loader()); | 1122 removeResourceLoader(resource->loader()); |
1113 m_resourceTimingInfoMap.take(const_cast<Resource*>(resource)); | 1123 m_resourceTimingInfoMap.take(const_cast<Resource*>(resource)); |
1114 bool isInternalRequest = resource->options().initiatorInfo.name == | 1124 bool isInternalRequest = resource->options().initiatorInfo.name == |
1115 FetchInitiatorTypeNames::internal; | 1125 FetchInitiatorTypeNames::internal; |
1116 context().dispatchDidFail(resource->identifier(), error, isInternalRequest); | 1126 context().dispatchDidFail(resource->identifier(), error, isInternalRequest); |
1117 resource->error(error); | 1127 resource->error(error); |
1118 context().didLoadResource(resource); | 1128 context().didLoadResource(resource); |
1119 } | 1129 } |
1120 | 1130 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1213 resource->options()); | 1223 resource->options()); |
1214 | 1224 |
1215 // Resource requests from suborigins should not be intercepted by the | 1225 // Resource requests from suborigins should not be intercepted by the |
1216 // service worker of the physical origin. This has the effect that, for | 1226 // service worker of the physical origin. This has the effect that, for |
1217 // now, suborigins do not work with service workers. See | 1227 // now, suborigins do not work with service workers. See |
1218 // https://w3c.github.io/webappsec-suborigins/. | 1228 // https://w3c.github.io/webappsec-suborigins/. |
1219 SecurityOrigin* sourceOrigin = context().getSecurityOrigin(); | 1229 SecurityOrigin* sourceOrigin = context().getSecurityOrigin(); |
1220 if (sourceOrigin && sourceOrigin->hasSuborigin()) | 1230 if (sourceOrigin && sourceOrigin->hasSuborigin()) |
1221 request.setSkipServiceWorker(WebURLRequest::SkipServiceWorker::All); | 1231 request.setSkipServiceWorker(WebURLRequest::SkipServiceWorker::All); |
1222 | 1232 |
1233 // TODO(632580): Workaround to persist cache-aware state, remove after fixed. | |
1234 resource->setResourceRequest(request); | |
1235 | |
1223 ResourceLoader* loader = ResourceLoader::create(this, resource); | 1236 ResourceLoader* loader = ResourceLoader::create(this, resource); |
1224 if (resource->shouldBlockLoadEvent()) | 1237 if (resource->shouldBlockLoadEvent()) |
1225 m_loaders.add(loader); | 1238 m_loaders.add(loader); |
1226 else | 1239 else |
1227 m_nonBlockingLoaders.add(loader); | 1240 m_nonBlockingLoaders.add(loader); |
1228 | 1241 |
1229 storeResourceTimingInitiatorInformation(resource); | 1242 storeResourceTimingInitiatorInformation(resource); |
1230 resource->setFetcherSecurityOrigin(sourceOrigin); | 1243 resource->setFetcherSecurityOrigin(sourceOrigin); |
1231 loader->start(request, context().loadingTaskRunner(), | 1244 loader->start(request, context().loadingTaskRunner(), |
1232 context().defersLoading()); | 1245 context().defersLoading()); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1325 resource->options()); | 1338 resource->options()); |
1326 return true; | 1339 return true; |
1327 } | 1340 } |
1328 | 1341 |
1329 void ResourceFetcher::willSendRequest(unsigned long identifier, | 1342 void ResourceFetcher::willSendRequest(unsigned long identifier, |
1330 ResourceRequest& newRequest, | 1343 ResourceRequest& newRequest, |
1331 const ResourceResponse& redirectResponse, | 1344 const ResourceResponse& redirectResponse, |
1332 const ResourceLoaderOptions& options) { | 1345 const ResourceLoaderOptions& options) { |
1333 context().dispatchWillSendRequest(identifier, newRequest, redirectResponse, | 1346 context().dispatchWillSendRequest(identifier, newRequest, redirectResponse, |
1334 options.initiatorInfo); | 1347 options.initiatorInfo); |
1348 newRequest.mayActivateCacheAwareLoading(); | |
1335 } | 1349 } |
1336 | 1350 |
1337 void ResourceFetcher::updateAllImageResourcePriorities() { | 1351 void ResourceFetcher::updateAllImageResourcePriorities() { |
1338 TRACE_EVENT0( | 1352 TRACE_EVENT0( |
1339 "blink", | 1353 "blink", |
1340 "ResourceLoadPriorityOptimizer::updateAllImageResourcePriorities"); | 1354 "ResourceLoadPriorityOptimizer::updateAllImageResourcePriorities"); |
1341 for (const auto& documentResource : m_documentResources) { | 1355 for (const auto& documentResource : m_documentResources) { |
1342 Resource* resource = documentResource.value.get(); | 1356 Resource* resource = documentResource.value.get(); |
1343 if (!resource || !resource->isImage() || !resource->isLoading()) | 1357 if (!resource || !resource->isImage() || !resource->isLoading()) |
1344 continue; | 1358 continue; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1556 visitor->trace(m_context); | 1570 visitor->trace(m_context); |
1557 visitor->trace(m_archive); | 1571 visitor->trace(m_archive); |
1558 visitor->trace(m_loaders); | 1572 visitor->trace(m_loaders); |
1559 visitor->trace(m_nonBlockingLoaders); | 1573 visitor->trace(m_nonBlockingLoaders); |
1560 visitor->trace(m_documentResources); | 1574 visitor->trace(m_documentResources); |
1561 visitor->trace(m_preloads); | 1575 visitor->trace(m_preloads); |
1562 visitor->trace(m_resourceTimingInfoMap); | 1576 visitor->trace(m_resourceTimingInfoMap); |
1563 } | 1577 } |
1564 | 1578 |
1565 } // namespace blink | 1579 } // namespace blink |
OLD | NEW |