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 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1094 ResourceTimingInfoMap::iterator it = m_resourceTimingInfoMap.find(resource); | 1094 ResourceTimingInfoMap::iterator it = m_resourceTimingInfoMap.find(resource); |
1095 if (it != m_resourceTimingInfoMap.end()) | 1095 if (it != m_resourceTimingInfoMap.end()) |
1096 it->value->addRedirect(redirectResponse); | 1096 it->value->addRedirect(redirectResponse); |
1097 } | 1097 } |
1098 | 1098 |
1099 void ResourceFetcher::didLoadResource(Resource* resource) | 1099 void ResourceFetcher::didLoadResource(Resource* resource) |
1100 { | 1100 { |
1101 RefPtr<DocumentLoader> protectDocumentLoader(m_documentLoader); | 1101 RefPtr<DocumentLoader> protectDocumentLoader(m_documentLoader); |
1102 RefPtrWillBeRawPtr<Document> protectDocument(m_document.get()); | 1102 RefPtrWillBeRawPtr<Document> protectDocument(m_document.get()); |
1103 | 1103 |
1104 if (resource && resource->response().isHTTP() && ((!resource->errorOccurred( ) && !resource->wasCanceled()) || resource->response().httpStatusCode() == 304) && document()) { | |
1105 ResourceTimingInfoMap::iterator it = m_resourceTimingInfoMap.find(resour ce); | |
1106 if (it != m_resourceTimingInfoMap.end()) { | |
1107 RefPtr<ResourceTimingInfo> info = it->value; | |
1108 m_resourceTimingInfoMap.remove(it); | |
1109 populateResourceTiming(info.get(), resource, false); | |
1110 reportResourceTiming(info.get(), document(), resource->type() == Res ource::MainResource); | |
1111 } | |
1112 } | |
1113 | |
1114 if (frame()) | 1104 if (frame()) |
1115 frame()->loader().loadDone(); | 1105 frame()->loader().loadDone(); |
1116 scheduleDocumentResourcesGC(); | 1106 scheduleDocumentResourcesGC(); |
1117 } | 1107 } |
1118 | 1108 |
1119 void ResourceFetcher::scheduleDocumentResourcesGC() | 1109 void ResourceFetcher::scheduleDocumentResourcesGC() |
1120 { | 1110 { |
1121 if (!m_garbageCollectDocumentResourcesTimer.isActive()) | 1111 if (!m_garbageCollectDocumentResourcesTimer.isActive()) |
1122 m_garbageCollectDocumentResourcesTimer.startOneShot(0, FROM_HERE); | 1112 m_garbageCollectDocumentResourcesTimer.startOneShot(0, FROM_HERE); |
1123 } | 1113 } |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1245 for (ListHashSet<Resource*>::iterator it = m_preloads->begin(); it != end; + +it) { | 1235 for (ListHashSet<Resource*>::iterator it = m_preloads->begin(); it != end; + +it) { |
1246 Resource* res = *it; | 1236 Resource* res = *it; |
1247 res->decreasePreloadCount(); | 1237 res->decreasePreloadCount(); |
1248 bool deleted = res->deleteIfPossible(); | 1238 bool deleted = res->deleteIfPossible(); |
1249 if (!deleted && res->preloadResult() == Resource::PreloadNotReferenced) | 1239 if (!deleted && res->preloadResult() == Resource::PreloadNotReferenced) |
1250 memoryCache()->remove(res); | 1240 memoryCache()->remove(res); |
1251 } | 1241 } |
1252 m_preloads.clear(); | 1242 m_preloads.clear(); |
1253 } | 1243 } |
1254 | 1244 |
1255 void ResourceFetcher::didFinishLoading(const Resource* resource, double finishTi me, int64_t encodedDataLength) | 1245 void ResourceFetcher::didFinishLoading(Resource* resource, double finishTime, in t64_t encodedDataLength) |
1256 { | 1246 { |
1257 TRACE_EVENT_ASYNC_END0("net", "Resource", resource); | 1247 TRACE_EVENT_ASYNC_END0("net", "Resource", resource); |
1248 | |
1249 if (resource && resource->response().isHTTP() && resource->response().httpSt atusCode() < 400 && document()) { | |
Nate Chapin
2014/09/15 23:39:35
dispatchDidFinishLoading might end a test, so ensu
| |
1250 ResourceTimingInfoMap::iterator it = m_resourceTimingInfoMap.find(resour ce); | |
1251 if (it != m_resourceTimingInfoMap.end()) { | |
1252 RefPtr<ResourceTimingInfo> info = it->value; | |
1253 m_resourceTimingInfoMap.remove(it); | |
1254 populateResourceTiming(info.get(), resource, false); | |
1255 reportResourceTiming(info.get(), document(), resource->type() == Res ource::MainResource); | |
1256 } | |
1257 } | |
1258 context().dispatchDidFinishLoading(m_documentLoader, resource->identifier(), finishTime, encodedDataLength); | 1258 context().dispatchDidFinishLoading(m_documentLoader, resource->identifier(), finishTime, encodedDataLength); |
1259 } | 1259 } |
1260 | 1260 |
1261 void ResourceFetcher::didChangeLoadingPriority(const Resource* resource, Resourc eLoadPriority loadPriority, int intraPriorityValue) | 1261 void ResourceFetcher::didChangeLoadingPriority(const Resource* resource, Resourc eLoadPriority loadPriority, int intraPriorityValue) |
1262 { | 1262 { |
1263 TRACE_EVENT_ASYNC_STEP_INTO1("net", "Resource", resource, "ChangePriority", "priority", loadPriority); | 1263 TRACE_EVENT_ASYNC_STEP_INTO1("net", "Resource", resource, "ChangePriority", "priority", loadPriority); |
1264 context().dispatchDidChangeResourcePriority(resource->identifier(), loadPrio rity, intraPriorityValue); | 1264 context().dispatchDidChangeResourcePriority(resource->identifier(), loadPrio rity, intraPriorityValue); |
1265 } | 1265 } |
1266 | 1266 |
1267 void ResourceFetcher::didFailLoading(const Resource* resource, const ResourceErr or& error) | 1267 void ResourceFetcher::didFailLoading(const Resource* resource, const ResourceErr or& error) |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1496 | 1496 |
1497 void ResourceFetcher::trace(Visitor* visitor) | 1497 void ResourceFetcher::trace(Visitor* visitor) |
1498 { | 1498 { |
1499 visitor->trace(m_document); | 1499 visitor->trace(m_document); |
1500 visitor->trace(m_loaders); | 1500 visitor->trace(m_loaders); |
1501 visitor->trace(m_multipartLoaders); | 1501 visitor->trace(m_multipartLoaders); |
1502 ResourceLoaderHost::trace(visitor); | 1502 ResourceLoaderHost::trace(visitor); |
1503 } | 1503 } |
1504 | 1504 |
1505 } | 1505 } |
OLD | NEW |