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

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: Rebase 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 11 matching lines...) Expand all
164 PassRefPtrWillBeRawPtr<Resource> resourceForStaticData(const FetchRequest&, const ResourceFactory&, const SubstituteData&); 159 PassRefPtrWillBeRawPtr<Resource> resourceForStaticData(const FetchRequest&, const ResourceFactory&, const SubstituteData&);
165 160
166 // RevalidationPolicy enum values are used in UMAs https://crbug.com/579496. 161 // RevalidationPolicy enum values are used in UMAs https://crbug.com/579496.
167 enum RevalidationPolicy { Use, Revalidate, Reload, Load }; 162 enum RevalidationPolicy { Use, Revalidate, Reload, Load };
168 RevalidationPolicy determineRevalidationPolicy(Resource::Type, const FetchRe quest&, Resource* existingResource, bool isStaticData) const; 163 RevalidationPolicy determineRevalidationPolicy(Resource::Type, const FetchRe quest&, Resource* existingResource, bool isStaticData) const;
169 164
170 void moveCachedNonBlockingResourceToBlocking(Resource*, const FetchRequest&) ; 165 void moveCachedNonBlockingResourceToBlocking(Resource*, const FetchRequest&) ;
171 166
172 void initializeResourceRequest(ResourceRequest&, Resource::Type); 167 void initializeResourceRequest(ResourceRequest&, Resource::Type);
173 168
174 static bool resourceNeedsLoad(Resource*, const FetchRequest&, RevalidationPo licy); 169 bool resourceNeedsLoad(Resource*, const FetchRequest&, RevalidationPolicy);
170 bool shouldDeferImageLoad(const KURL&) const;
175 171
176 void resourceTimingReportTimerFired(Timer<ResourceFetcher>*); 172 void resourceTimingReportTimerFired(Timer<ResourceFetcher>*);
177 173
178 void reloadImagesIfNotDeferred(); 174 void reloadImagesIfNotDeferred();
179 175
180 void updateMemoryCacheStats(Resource*, RevalidationPolicy, const FetchReques t&, const ResourceFactory&, bool isStaticData) const; 176 void updateMemoryCacheStats(Resource*, RevalidationPolicy, const FetchReques t&, const ResourceFactory&, bool isStaticData) const;
181 177
182 Member<FetchContext> m_context; 178 Member<FetchContext> m_context;
183 179
184 HashSet<String> m_validatedURLs; 180 HashSet<String> m_validatedURLs;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 m_loader->m_allowStaleResources = m_previousState; 234 m_loader->m_allowStaleResources = m_previousState;
239 } 235 }
240 private: 236 private:
241 Member<ResourceFetcher> m_loader; 237 Member<ResourceFetcher> m_loader;
242 bool m_previousState; 238 bool m_previousState;
243 }; 239 };
244 240
245 } // namespace blink 241 } // namespace blink
246 242
247 #endif // ResourceFetcher_h 243 #endif // ResourceFetcher_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698