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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
467 case Reload: | 467 case Reload: |
468 memoryCache()->remove(resource); | 468 memoryCache()->remove(resource); |
469 // Fall through | 469 // Fall through |
470 case Load: | 470 case Load: |
471 resource = createResourceForLoading(request, request.charset(), factory) ; | 471 resource = createResourceForLoading(request, request.charset(), factory) ; |
472 break; | 472 break; |
473 case Revalidate: | 473 case Revalidate: |
474 initializeRevalidation(request.mutableResourceRequest(), resource); | 474 initializeRevalidation(request.mutableResourceRequest(), resource); |
475 break; | 475 break; |
476 case Use: | 476 case Use: |
477 if (resource->isLinkPreload() && !request.isLinkPreload()) | |
478 resource->setLinkPreload(false); | |
477 memoryCache()->updateForAccess(resource); | 479 memoryCache()->updateForAccess(resource); |
478 break; | 480 break; |
479 } | 481 } |
480 | 482 |
481 if (!resource) | 483 if (!resource) |
482 return nullptr; | 484 return nullptr; |
483 if (resource->getType() != factory.type()) { | 485 if (resource->getType() != factory.type()) { |
484 ASSERT(request.forPreload()); | 486 ASSERT(request.forPreload()); |
485 return nullptr; | 487 return nullptr; |
486 } | 488 } |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
861 bool ResourceFetcher::hasPendingRequest() const | 863 bool ResourceFetcher::hasPendingRequest() const |
862 { | 864 { |
863 return m_loaders.size() > 0 || m_nonBlockingLoaders.size() > 0; | 865 return m_loaders.size() > 0 || m_nonBlockingLoaders.size() > 0; |
864 } | 866 } |
865 | 867 |
866 void ResourceFetcher::preloadStarted(Resource* resource) | 868 void ResourceFetcher::preloadStarted(Resource* resource) |
867 { | 869 { |
868 if (m_preloads && m_preloads->contains(resource)) | 870 if (m_preloads && m_preloads->contains(resource)) |
869 return; | 871 return; |
870 TRACE_EVENT_ASYNC_STEP_INTO0("blink.net", "Resource", resource->identifier() , "Preload"); | 872 TRACE_EVENT_ASYNC_STEP_INTO0("blink.net", "Resource", resource->identifier() , "Preload"); |
871 resource->increasePreloadCount(); | |
872 | 873 |
873 if (!m_preloads) | 874 if (!m_preloads) |
874 m_preloads = new HeapListHashSet<Member<Resource>>; | 875 m_preloads = new HeapListHashSet<Member<Resource>>; |
875 m_preloads->add(resource); | 876 if (m_preloads->add(resource).isNewEntry) |
Nate Chapin
2016/09/12 20:44:51
Why doesn't the m_preloads->contains(resource) abo
Yoav Weiss
2016/09/12 21:01:16
You're right. It does.
| |
877 resource->increasePreloadCount(); | |
876 } | 878 } |
877 | 879 |
878 bool ResourceFetcher::isPreloaded(const KURL& url) const | 880 bool ResourceFetcher::isPreloaded(const KURL& url) const |
879 { | 881 { |
880 if (m_preloads) { | 882 if (m_preloads) { |
881 for (auto resource : *m_preloads) { | 883 for (auto resource : *m_preloads) { |
882 if (resource->url() == url) | 884 if (resource->url() == url) |
883 return true; | 885 return true; |
884 } | 886 } |
885 } | 887 } |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1323 visitor->trace(m_context); | 1325 visitor->trace(m_context); |
1324 visitor->trace(m_archive); | 1326 visitor->trace(m_archive); |
1325 visitor->trace(m_loaders); | 1327 visitor->trace(m_loaders); |
1326 visitor->trace(m_nonBlockingLoaders); | 1328 visitor->trace(m_nonBlockingLoaders); |
1327 visitor->trace(m_documentResources); | 1329 visitor->trace(m_documentResources); |
1328 visitor->trace(m_preloads); | 1330 visitor->trace(m_preloads); |
1329 visitor->trace(m_resourceTimingInfoMap); | 1331 visitor->trace(m_resourceTimingInfoMap); |
1330 } | 1332 } |
1331 | 1333 |
1332 } // namespace blink | 1334 } // namespace blink |
OLD | NEW |