| 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 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1140 } | 1140 } |
| 1141 } | 1141 } |
| 1142 | 1142 |
| 1143 void ResourceFetcher::redirectReceived(Resource* resource, const ResourceRespons
e& redirectResponse) | 1143 void ResourceFetcher::redirectReceived(Resource* resource, const ResourceRespons
e& redirectResponse) |
| 1144 { | 1144 { |
| 1145 ResourceTimingInfoMap::iterator it = m_resourceTimingInfoMap.find(resource); | 1145 ResourceTimingInfoMap::iterator it = m_resourceTimingInfoMap.find(resource); |
| 1146 if (it != m_resourceTimingInfoMap.end()) | 1146 if (it != m_resourceTimingInfoMap.end()) |
| 1147 it->value->addRedirect(redirectResponse); | 1147 it->value->addRedirect(redirectResponse); |
| 1148 } | 1148 } |
| 1149 | 1149 |
| 1150 void ResourceFetcher::didLoadResource() | 1150 void ResourceFetcher::didLoadResource(Resource* resource) |
| 1151 { | 1151 { |
| 1152 RefPtr<DocumentLoader> protectDocumentLoader(m_documentLoader); | 1152 RefPtr<DocumentLoader> protectDocumentLoader(m_documentLoader); |
| 1153 RefPtrWillBeRawPtr<Document> protectDocument(m_document.get()); | 1153 RefPtrWillBeRawPtr<Document> protectDocument(m_document.get()); |
| 1154 | 1154 |
| 1155 if (resource && resource->response().isHTTP() && ((!resource->errorOccurred(
) && !resource->wasCanceled()) || resource->response().httpStatusCode() == 304)
&& document()) { |
| 1156 ResourceTimingInfoMap::iterator it = m_resourceTimingInfoMap.find(resour
ce); |
| 1157 if (it != m_resourceTimingInfoMap.end()) { |
| 1158 RefPtr<ResourceTimingInfo> info = it->value; |
| 1159 m_resourceTimingInfoMap.remove(it); |
| 1160 populateResourceTiming(info.get(), resource, false); |
| 1161 reportResourceTiming(info.get(), document(), resource->type() == Res
ource::MainResource); |
| 1162 } |
| 1163 } |
| 1164 |
| 1155 if (frame()) | 1165 if (frame()) |
| 1156 frame()->loader().loadDone(); | 1166 frame()->loader().loadDone(); |
| 1157 scheduleDocumentResourcesGC(); | 1167 scheduleDocumentResourcesGC(); |
| 1158 } | 1168 } |
| 1159 | 1169 |
| 1160 void ResourceFetcher::scheduleDocumentResourcesGC() | 1170 void ResourceFetcher::scheduleDocumentResourcesGC() |
| 1161 { | 1171 { |
| 1162 if (!m_garbageCollectDocumentResourcesTimer.isActive()) | 1172 if (!m_garbageCollectDocumentResourcesTimer.isActive()) |
| 1163 m_garbageCollectDocumentResourcesTimer.startOneShot(0, FROM_HERE); | 1173 m_garbageCollectDocumentResourcesTimer.startOneShot(0, FROM_HERE); |
| 1164 } | 1174 } |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1281 | 1291 |
| 1282 for (Resource* resource : *m_preloads) { | 1292 for (Resource* resource : *m_preloads) { |
| 1283 resource->decreasePreloadCount(); | 1293 resource->decreasePreloadCount(); |
| 1284 bool deleted = resource->deleteIfPossible(); | 1294 bool deleted = resource->deleteIfPossible(); |
| 1285 if (!deleted && resource->preloadResult() == Resource::PreloadNotReferen
ced) | 1295 if (!deleted && resource->preloadResult() == Resource::PreloadNotReferen
ced) |
| 1286 memoryCache()->remove(resource); | 1296 memoryCache()->remove(resource); |
| 1287 } | 1297 } |
| 1288 m_preloads.clear(); | 1298 m_preloads.clear(); |
| 1289 } | 1299 } |
| 1290 | 1300 |
| 1291 void ResourceFetcher::didFinishLoading(Resource* resource, double finishTime, in
t64_t encodedDataLength) | 1301 void ResourceFetcher::didFinishLoading(const Resource* resource, double finishTi
me, int64_t encodedDataLength) |
| 1292 { | 1302 { |
| 1293 TRACE_EVENT_ASYNC_END0("net", "Resource", resource); | 1303 TRACE_EVENT_ASYNC_END0("net", "Resource", resource); |
| 1294 | |
| 1295 if (resource && resource->response().isHTTP() && resource->response().httpSt
atusCode() < 400 && document()) { | |
| 1296 ResourceTimingInfoMap::iterator it = m_resourceTimingInfoMap.find(resour
ce); | |
| 1297 if (it != m_resourceTimingInfoMap.end()) { | |
| 1298 RefPtr<ResourceTimingInfo> info = it->value; | |
| 1299 m_resourceTimingInfoMap.remove(it); | |
| 1300 populateResourceTiming(info.get(), resource, false); | |
| 1301 reportResourceTiming(info.get(), document(), resource->type() == Res
ource::MainResource); | |
| 1302 } | |
| 1303 } | |
| 1304 context().dispatchDidFinishLoading(m_documentLoader, resource->identifier(),
finishTime, encodedDataLength); | 1304 context().dispatchDidFinishLoading(m_documentLoader, resource->identifier(),
finishTime, encodedDataLength); |
| 1305 } | 1305 } |
| 1306 | 1306 |
| 1307 void ResourceFetcher::didChangeLoadingPriority(const Resource* resource, Resourc
eLoadPriority loadPriority, int intraPriorityValue) | 1307 void ResourceFetcher::didChangeLoadingPriority(const Resource* resource, Resourc
eLoadPriority loadPriority, int intraPriorityValue) |
| 1308 { | 1308 { |
| 1309 TRACE_EVENT_ASYNC_STEP_INTO1("net", "Resource", resource, "ChangePriority",
"priority", loadPriority); | 1309 TRACE_EVENT_ASYNC_STEP_INTO1("net", "Resource", resource, "ChangePriority",
"priority", loadPriority); |
| 1310 context().dispatchDidChangeResourcePriority(resource->identifier(), loadPrio
rity, intraPriorityValue); | 1310 context().dispatchDidChangeResourcePriority(resource->identifier(), loadPrio
rity, intraPriorityValue); |
| 1311 } | 1311 } |
| 1312 | 1312 |
| 1313 void ResourceFetcher::didFailLoading(const Resource* resource, const ResourceErr
or& error) | 1313 void ResourceFetcher::didFailLoading(const Resource* resource, const ResourceErr
or& error) |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1544 | 1544 |
| 1545 void ResourceFetcher::trace(Visitor* visitor) | 1545 void ResourceFetcher::trace(Visitor* visitor) |
| 1546 { | 1546 { |
| 1547 visitor->trace(m_document); | 1547 visitor->trace(m_document); |
| 1548 visitor->trace(m_loaders); | 1548 visitor->trace(m_loaders); |
| 1549 visitor->trace(m_multipartLoaders); | 1549 visitor->trace(m_multipartLoaders); |
| 1550 ResourceLoaderHost::trace(visitor); | 1550 ResourceLoaderHost::trace(visitor); |
| 1551 } | 1551 } |
| 1552 | 1552 |
| 1553 } | 1553 } |
| OLD | NEW |