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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
249 return true; | 249 return true; |
250 return request.options().synchronousPolicy == RequestSynchronously && resour ce->isLoading(); | 250 return request.options().synchronousPolicy == RequestSynchronously && resour ce->isLoading(); |
251 } | 251 } |
252 | 252 |
253 // Limit the number of URLs in m_validatedURLs to avoid memory bloat. | 253 // Limit the number of URLs in m_validatedURLs to avoid memory bloat. |
254 // http://crbug.com/52411 | 254 // http://crbug.com/52411 |
255 static const int kMaxValidatedURLsSize = 10000; | 255 static const int kMaxValidatedURLsSize = 10000; |
256 | 256 |
257 void ResourceFetcher::requestLoadStarted(Resource* resource, const FetchRequest& request, ResourceLoadStartType type, bool isStaticData) | 257 void ResourceFetcher::requestLoadStarted(Resource* resource, const FetchRequest& request, ResourceLoadStartType type, bool isStaticData) |
258 { | 258 { |
259 if (type == ResourceLoadingFromCache) | 259 if (type == ResourceLoadingFromCache && resource->status() == Resource::Cach ed && !m_validatedURLs.contains(resource->url())) |
260 notifyLoadedFromMemoryCache(resource); | 260 context().dispatchDidLoadResourceFromMemoryCache(resource); |
261 | 261 |
262 if (isStaticData) | 262 if (isStaticData) |
263 return; | 263 return; |
264 | 264 |
265 if (type == ResourceLoadingFromCache && !resource->stillNeedsLoad() && !m_va lidatedURLs.contains(request.resourceRequest().url())) { | 265 if (type == ResourceLoadingFromCache && !resource->stillNeedsLoad() && !m_va lidatedURLs.contains(request.resourceRequest().url())) { |
266 // Resources loaded from memory cache should be reported the first time they're used. | 266 // Resources loaded from memory cache should be reported the first time they're used. |
267 OwnPtr<ResourceTimingInfo> info = ResourceTimingInfo::create(request.opt ions().initiatorInfo.name, monotonicallyIncreasingTime(), resource->type() == Re source::MainResource); | 267 OwnPtr<ResourceTimingInfo> info = ResourceTimingInfo::create(request.opt ions().initiatorInfo.name, monotonicallyIncreasingTime(), resource->type() == Re source::MainResource); |
268 populateResourceTiming(info.get(), resource, true); | 268 populateResourceTiming(info.get(), resource, true); |
269 m_scheduledResourceTimingReports.append(info.release()); | 269 m_scheduledResourceTimingReports.append(info.release()); |
270 if (!m_resourceTimingReportTimer.isActive()) | 270 if (!m_resourceTimingReportTimer.isActive()) |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
785 StringVector resourcesToDelete; | 785 StringVector resourcesToDelete; |
786 | 786 |
787 for (const auto& documentResource : m_documentResources) { | 787 for (const auto& documentResource : m_documentResources) { |
788 if (documentResource.value->hasOneHandle()) | 788 if (documentResource.value->hasOneHandle()) |
789 resourcesToDelete.append(documentResource.key); | 789 resourcesToDelete.append(documentResource.key); |
790 } | 790 } |
791 | 791 |
792 m_documentResources.removeAll(resourcesToDelete); | 792 m_documentResources.removeAll(resourcesToDelete); |
793 } | 793 } |
794 | 794 |
795 void ResourceFetcher::notifyLoadedFromMemoryCache(Resource* resource) | |
796 { | |
797 if (resource->status() != Resource::Cached || m_validatedURLs.contains(resou rce->url())) | |
798 return; | |
799 | |
Nate Chapin
2015/08/21 18:06:26
The logic below this point moved to FrameFetchCont
| |
800 ResourceRequest request(resource->url()); | |
801 unsigned long identifier = createUniqueIdentifier(); | |
802 context().dispatchDidLoadResourceFromMemoryCache(request, resource->response ()); | |
803 // FIXME: If willSendRequest changes the request, we don't respect it. | |
804 willSendRequest(identifier, request, ResourceResponse(), resource->options() .initiatorInfo); | |
805 context().sendRemainingDelegateMessages(identifier, resource->response(), re source->encodedSize()); | |
806 } | |
807 | |
808 int ResourceFetcher::requestCount() const | 795 int ResourceFetcher::requestCount() const |
809 { | 796 { |
810 return m_loaders ? m_loaders->size() : 0; | 797 return m_loaders ? m_loaders->size() : 0; |
811 } | 798 } |
812 | 799 |
813 void ResourceFetcher::preloadStarted(Resource* resource) | 800 void ResourceFetcher::preloadStarted(Resource* resource) |
814 { | 801 { |
815 if (m_preloads && m_preloads->contains(resource)) | 802 if (m_preloads && m_preloads->contains(resource)) |
816 return; | 803 return; |
817 TRACE_EVENT_ASYNC_STEP_INTO0("blink.net", "Resource", resource, "Preload"); | 804 TRACE_EVENT_ASYNC_STEP_INTO0("blink.net", "Resource", resource, "Preload"); |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1147 visitor->trace(m_archiveResourceCollection); | 1134 visitor->trace(m_archiveResourceCollection); |
1148 visitor->trace(m_loaders); | 1135 visitor->trace(m_loaders); |
1149 visitor->trace(m_nonBlockingLoaders); | 1136 visitor->trace(m_nonBlockingLoaders); |
1150 #if ENABLE(OILPAN) | 1137 #if ENABLE(OILPAN) |
1151 visitor->trace(m_preloads); | 1138 visitor->trace(m_preloads); |
1152 visitor->trace(m_resourceTimingInfoMap); | 1139 visitor->trace(m_resourceTimingInfoMap); |
1153 #endif | 1140 #endif |
1154 } | 1141 } |
1155 | 1142 |
1156 } | 1143 } |
OLD | NEW |