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

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

Issue 1802123002: Unify Resource loading status tracking (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 4 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
5 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 5 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 virtual ~ResourceFetcher(); 73 virtual ~ResourceFetcher();
74 DECLARE_VIRTUAL_TRACE(); 74 DECLARE_VIRTUAL_TRACE();
75 75
76 PassRefPtrWillBeRawPtr<Resource> requestResource(FetchRequest&, const Resour ceFactory&, const SubstituteData& = SubstituteData()); 76 PassRefPtrWillBeRawPtr<Resource> requestResource(FetchRequest&, const Resour ceFactory&, const SubstituteData& = SubstituteData());
77 77
78 Resource* cachedResource(const KURL&) const; 78 Resource* cachedResource(const KURL&) const;
79 79
80 using DocumentResourceMap = WillBeHeapHashMap<String, WeakPtrWillBeWeakMembe r<Resource>>; 80 using DocumentResourceMap = WillBeHeapHashMap<String, WeakPtrWillBeWeakMembe r<Resource>>;
81 const DocumentResourceMap& allResources() const { return m_documentResources ; } 81 const DocumentResourceMap& allResources() const { return m_documentResources ; }
82 82
83 bool autoLoadImages() const { return m_autoLoadImages; }
84 void setAutoLoadImages(bool); 83 void setAutoLoadImages(bool);
85
86 void setImagesEnabled(bool); 84 void setImagesEnabled(bool);
87 85
88 bool shouldDeferImageLoad(const KURL&) const;
89
90 FetchContext& context() const { return m_context ? *m_context.get() : FetchC ontext::nullInstance(); } 86 FetchContext& context() const { return m_context ? *m_context.get() : FetchC ontext::nullInstance(); }
91 void clearContext() { m_context.clear(); } 87 void clearContext() { m_context.clear(); }
92 88
93 int requestCount() const; 89 int requestCount() const;
94 90
95 enum ClearPreloadsPolicy { ClearAllPreloads, ClearSpeculativeMarkupPreloads }; 91 enum ClearPreloadsPolicy { ClearAllPreloads, ClearSpeculativeMarkupPreloads };
96 92
97 bool isPreloaded(const KURL&) const; 93 bool isPreloaded(const KURL&) const;
98 void clearPreloads(ClearPreloadsPolicy = ClearAllPreloads); 94 void clearPreloads(ClearPreloadsPolicy = ClearAllPreloads);
99 void preloadStarted(Resource*); 95 void preloadStarted(Resource*);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 128
133 enum ResourceLoadStartType { 129 enum ResourceLoadStartType {
134 ResourceLoadingFromNetwork, 130 ResourceLoadingFromNetwork,
135 ResourceLoadingFromCache 131 ResourceLoadingFromCache
136 }; 132 };
137 void requestLoadStarted(Resource*, const FetchRequest&, ResourceLoadStartTyp e, bool isStaticData = false); 133 void requestLoadStarted(Resource*, const FetchRequest&, ResourceLoadStartTyp e, bool isStaticData = false);
138 static const ResourceLoaderOptions& defaultResourceOptions(); 134 static const ResourceLoaderOptions& defaultResourceOptions();
139 135
140 String getCacheIdentifier() const; 136 String getCacheIdentifier() const;
141 137
142 bool clientDefersImage(const KURL&) const;
143 static void determineRequestContext(ResourceRequest&, Resource::Type, bool i sMainFrame); 138 static void determineRequestContext(ResourceRequest&, Resource::Type, bool i sMainFrame);
144 void determineRequestContext(ResourceRequest&, Resource::Type); 139 void determineRequestContext(ResourceRequest&, Resource::Type);
145 140
146 WebTaskRunner* loadingTaskRunner(); 141 WebTaskRunner* loadingTaskRunner();
147 142
148 void updateAllImageResourcePriorities(); 143 void updateAllImageResourcePriorities();
149 144
150 void reloadLoFiImages(); 145 void reloadLoFiImages();
151 146
152 // This is only exposed for testing purposes. 147 // This is only exposed for testing purposes.
(...skipping 12 matching lines...) Expand all
165 PassRefPtrWillBeRawPtr<Resource> resourceForStaticData(const FetchRequest&, const ResourceFactory&, const SubstituteData&); 160 PassRefPtrWillBeRawPtr<Resource> resourceForStaticData(const FetchRequest&, const ResourceFactory&, const SubstituteData&);
166 161
167 // RevalidationPolicy enum values are used in UMAs https://crbug.com/579496. 162 // RevalidationPolicy enum values are used in UMAs https://crbug.com/579496.
168 enum RevalidationPolicy { Use, Revalidate, Reload, Load }; 163 enum RevalidationPolicy { Use, Revalidate, Reload, Load };
169 RevalidationPolicy determineRevalidationPolicy(Resource::Type, const FetchRe quest&, Resource* existingResource, bool isStaticData) const; 164 RevalidationPolicy determineRevalidationPolicy(Resource::Type, const FetchRe quest&, Resource* existingResource, bool isStaticData) const;
170 165
171 void moveCachedNonBlockingResourceToBlocking(Resource*, const FetchRequest&) ; 166 void moveCachedNonBlockingResourceToBlocking(Resource*, const FetchRequest&) ;
172 167
173 void initializeResourceRequest(ResourceRequest&, Resource::Type); 168 void initializeResourceRequest(ResourceRequest&, Resource::Type);
174 169
175 static bool resourceNeedsLoad(Resource*, const FetchRequest&, RevalidationPo licy); 170 bool resourceNeedsLoad(Resource*, const FetchRequest&, RevalidationPolicy);
171 bool shouldDeferImageLoad(const KURL&) const;
176 172
177 void resourceTimingReportTimerFired(Timer<ResourceFetcher>*); 173 void resourceTimingReportTimerFired(Timer<ResourceFetcher>*);
178 174
179 void reloadImagesIfNotDeferred(); 175 void reloadImagesIfNotDeferred();
180 176
181 void updateMemoryCacheStats(Resource*, RevalidationPolicy, const FetchReques t&, const ResourceFactory&, bool isStaticData) const; 177 void updateMemoryCacheStats(Resource*, RevalidationPolicy, const FetchReques t&, const ResourceFactory&, bool isStaticData) const;
182 178
183 Member<FetchContext> m_context; 179 Member<FetchContext> m_context;
184 180
185 HashSet<String> m_validatedURLs; 181 HashSet<String> m_validatedURLs;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 m_loader->m_allowStaleResources = m_previousState; 235 m_loader->m_allowStaleResources = m_previousState;
240 } 236 }
241 private: 237 private:
242 Member<ResourceFetcher> m_loader; 238 Member<ResourceFetcher> m_loader;
243 bool m_previousState; 239 bool m_previousState;
244 }; 240 };
245 241
246 } // namespace blink 242 } // namespace blink
247 243
248 #endif // ResourceFetcher_h 244 #endif // ResourceFetcher_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698