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

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

Issue 1879793003: Remove DeferredByClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Resource_load
Patch Set: Add UpdateForcedReload check for the m_loadingImageDocument special case Created 4 years, 7 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
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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 return true; 250 return true;
251 } 251 }
252 252
253 bool ResourceFetcher::isControlledByServiceWorker() const 253 bool ResourceFetcher::isControlledByServiceWorker() const
254 { 254 {
255 return context().isControlledByServiceWorker(); 255 return context().isControlledByServiceWorker();
256 } 256 }
257 257
258 bool ResourceFetcher::resourceNeedsLoad(Resource* resource, const FetchRequest& request, RevalidationPolicy policy) 258 bool ResourceFetcher::resourceNeedsLoad(Resource* resource, const FetchRequest& request, RevalidationPolicy policy)
259 { 259 {
260 if (FetchRequest::DeferredByClient == request.defer()) 260 // Defer a font load until it is actually needed unless this is a preload.
261 if (resource->getType() == Resource::Font && !request.forPreload())
261 return false; 262 return false;
262 if (resource->isImage() && shouldDeferImageLoad(resource->url())) 263 if (resource->isImage() && shouldDeferImageLoad(resource->url()))
263 return false; 264 return false;
264 return policy != Use || resource->stillNeedsLoad(); 265 return policy != Use || resource->stillNeedsLoad();
265 } 266 }
266 267
267 // Limit the number of URLs in m_validatedURLs to avoid memory bloat. 268 // Limit the number of URLs in m_validatedURLs to avoid memory bloat.
268 // http://crbug.com/52411 269 // http://crbug.com/52411
269 static const int kMaxValidatedURLsSize = 10000; 270 static const int kMaxValidatedURLsSize = 10000;
270 271
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 // cached or it is a data: url. In this case, we "Reload" the image, 654 // cached or it is a data: url. In this case, we "Reload" the image,
654 // then defer it with resourceNeedsLoad() so that it never actually 655 // then defer it with resourceNeedsLoad() so that it never actually
655 // goes to the network. 656 // goes to the network.
656 // 2. Images are enabled, but not loaded automatically. In this case, we 657 // 2. Images are enabled, but not loaded automatically. In this case, we
657 // will Use cached resources or data: urls, but will similarly fall back 658 // will Use cached resources or data: urls, but will similarly fall back
658 // to a deferred network load if we don't have the data available 659 // to a deferred network load if we don't have the data available
659 // without a network request. We check allowImage() here, which is 660 // without a network request. We check allowImage() here, which is
660 // affected by m_imagesEnabled but not m_autoLoadImages, in order to 661 // affected by m_imagesEnabled but not m_autoLoadImages, in order to
661 // allow for this differing behavior. 662 // allow for this differing behavior.
662 // TODO(japhet): Can we get rid of one of these settings? 663 // TODO(japhet): Can we get rid of one of these settings?
663 if (existingResource->isImage() && (FetchRequest::DeferredByClient == fetchR equest.defer() || !context().allowImage(m_imagesEnabled, existingResource->url() ))) 664 if (existingResource->isImage() && !context().allowImage(m_imagesEnabled, ex istingResource->url()))
664 return Reload; 665 return Reload;
665 666
666 // Never use cache entries for downloadToFile / useStreamOnResponse 667 // Never use cache entries for downloadToFile / useStreamOnResponse
667 // requests. The data will be delivered through other paths. 668 // requests. The data will be delivered through other paths.
668 if (request.downloadToFile() || request.useStreamOnResponse()) 669 if (request.downloadToFile() || request.useStreamOnResponse())
669 return Reload; 670 return Reload;
670 671
671 // If resource was populated from a SubstituteData load or data: url, use it . 672 // If resource was populated from a SubstituteData load or data: url, use it .
672 if (isStaticData) 673 if (isStaticData)
673 return Use; 674 return Use;
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 visitor->trace(m_context); 1176 visitor->trace(m_context);
1176 visitor->trace(m_archive); 1177 visitor->trace(m_archive);
1177 visitor->trace(m_loaders); 1178 visitor->trace(m_loaders);
1178 visitor->trace(m_nonBlockingLoaders); 1179 visitor->trace(m_nonBlockingLoaders);
1179 visitor->trace(m_documentResources); 1180 visitor->trace(m_documentResources);
1180 visitor->trace(m_preloads); 1181 visitor->trace(m_preloads);
1181 visitor->trace(m_resourceTimingInfoMap); 1182 visitor->trace(m_resourceTimingInfoMap);
1182 } 1183 }
1183 1184
1184 } // namespace blink 1185 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ImageResource.h ('k') | third_party/WebKit/Source/core/loader/ImageLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698