Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: Source/core/fetch/ResourceFetcher.cpp

Issue 317703005: Revert of Always preload all tokens before parsing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 { 887 {
888 if (!existingResource) 888 if (!existingResource)
889 return Load; 889 return Load;
890 890
891 // We already have a preload going for this URL. 891 // We already have a preload going for this URL.
892 if (forPreload && existingResource->isPreloaded()) 892 if (forPreload && existingResource->isPreloaded())
893 return Use; 893 return Use;
894 894
895 // If the same URL has been loaded as a different type, we need to reload. 895 // If the same URL has been loaded as a different type, we need to reload.
896 if (existingResource->type() != type) { 896 if (existingResource->type() != type) {
897 // FIXME: If existingResource is a Preload and the new type is LinkPrefe tch
898 // We really should discard the new prefetch since the preload has more
899 // specific type information! crbug.com/379893
900 // fast/dom/HTMLLinkElement/link-and-subresource-test hits this case.
901 WTF_LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy r eloading due to type mismatch."); 897 WTF_LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy r eloading due to type mismatch.");
902 return Reload; 898 return Reload;
903 } 899 }
904 900
905 // Do not load from cache if images are not enabled. The load for this image will be blocked 901 // Do not load from cache if images are not enabled. The load for this image will be blocked
906 // in ImageResource::load. 902 // in ImageResource::load.
907 if (FetchRequest::DeferredByClient == defer) 903 if (FetchRequest::DeferredByClient == defer)
908 return Reload; 904 return Reload;
909 905
910 // Always use data uris. 906 // Always use data uris.
(...skipping 15 matching lines...) Expand all
926 // Certain requests (e.g., XHRs) might have manually set headers that requir e revalidation. 922 // Certain requests (e.g., XHRs) might have manually set headers that requir e revalidation.
927 // FIXME: In theory, this should be a Revalidate case. In practice, the Memo ryCache revalidation path assumes a whole bunch 923 // FIXME: In theory, this should be a Revalidate case. In practice, the Memo ryCache revalidation path assumes a whole bunch
928 // of things about how revalidation works that manual headers violate, so pu nt to Reload instead. 924 // of things about how revalidation works that manual headers violate, so pu nt to Reload instead.
929 if (request.isConditional()) 925 if (request.isConditional())
930 return Reload; 926 return Reload;
931 927
932 // Don't reload resources while pasting. 928 // Don't reload resources while pasting.
933 if (m_allowStaleResources) 929 if (m_allowStaleResources)
934 return Use; 930 return Use;
935 931
936 // If fetching a resource with a different 'CORS enabled' flag, reload.
937 if (type != Resource::MainResource && options.corsEnabled != existingResourc e->options().corsEnabled)
938 return Reload;
939
940 // Always use preloads. 932 // Always use preloads.
941 if (existingResource->isPreloaded()) 933 if (existingResource->isPreloaded())
942 return Use; 934 return Use;
943 935
944 // CachePolicyHistoryBuffer uses the cache no matter what. 936 // CachePolicyHistoryBuffer uses the cache no matter what.
945 CachePolicy cachePolicy = context().cachePolicy(document()); 937 CachePolicy cachePolicy = context().cachePolicy(document());
946 if (cachePolicy == CachePolicyHistoryBuffer) 938 if (cachePolicy == CachePolicyHistoryBuffer)
947 return Use; 939 return Use;
948 940
949 // Don't reuse resources with Cache-control: no-store. 941 // Don't reuse resources with Cache-control: no-store.
950 if (existingResource->hasCacheControlNoStoreHeader()) { 942 if (existingResource->hasCacheControlNoStoreHeader()) {
951 WTF_LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy r eloading due to Cache-control: no-store."); 943 WTF_LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy r eloading due to Cache-control: no-store.");
952 return Reload; 944 return Reload;
953 } 945 }
954 946
947 // If fetching a resource with a different 'CORS enabled' flag, reload.
948 if (type != Resource::MainResource && options.corsEnabled != existingResourc e->options().corsEnabled)
949 return Reload;
950
955 // If credentials were sent with the previous request and won't be 951 // If credentials were sent with the previous request and won't be
956 // with this one, or vice versa, re-fetch the resource. 952 // with this one, or vice versa, re-fetch the resource.
957 // 953 //
958 // This helps with the case where the server sends back 954 // This helps with the case where the server sends back
959 // "Access-Control-Allow-Origin: *" all the time, but some of the 955 // "Access-Control-Allow-Origin: *" all the time, but some of the
960 // client's requests are made without CORS and some with. 956 // client's requests are made without CORS and some with.
961 if (existingResource->resourceRequest().allowStoredCredentials() != request. allowStoredCredentials()) { 957 if (existingResource->resourceRequest().allowStoredCredentials() != request. allowStoredCredentials()) {
962 WTF_LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy r eloading due to difference in credentials settings."); 958 WTF_LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy r eloading due to difference in credentials settings.");
963 return Reload; 959 return Reload;
964 } 960 }
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 } 1463 }
1468 } 1464 }
1469 1465
1470 void ResourceFetcher::trace(Visitor* visitor) 1466 void ResourceFetcher::trace(Visitor* visitor)
1471 { 1467 {
1472 visitor->trace(m_document); 1468 visitor->trace(m_document);
1473 ResourceLoaderHost::trace(visitor); 1469 ResourceLoaderHost::trace(visitor);
1474 } 1470 }
1475 1471
1476 } 1472 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698