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

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

Issue 2751973005: Link prefetch fetches deferred until onload
Patch Set: Fixed post onload addition and crash Created 3 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 4 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
5 rights reserved. 5 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 String getCacheIdentifier() const; 132 String getCacheIdentifier() const;
133 133
134 WARN_UNUSED_RESULT static WebURLRequest::RequestContext 134 WARN_UNUSED_RESULT static WebURLRequest::RequestContext
135 determineRequestContext(Resource::Type, bool isMainFrame); 135 determineRequestContext(Resource::Type, bool isMainFrame);
136 WARN_UNUSED_RESULT WebURLRequest::RequestContext determineRequestContext( 136 WARN_UNUSED_RESULT WebURLRequest::RequestContext determineRequestContext(
137 Resource::Type) const; 137 Resource::Type) const;
138 138
139 void updateAllImageResourcePriorities(); 139 void updateAllImageResourcePriorities();
140 140
141 void reloadLoFiImages(); 141 void reloadLoFiImages();
142 void loadOnloadDeferredResources();
142 143
143 // Calling this method before main document resource is fetched is invalid. 144 // Calling this method before main document resource is fetched is invalid.
144 ResourceTimingInfo* getNavigationTimingInfo(); 145 ResourceTimingInfo* getNavigationTimingInfo();
145 146
146 // This is only exposed for testing purposes. 147 // This is only exposed for testing purposes.
147 HeapListHashSet<Member<Resource>>* preloads() { return m_preloads.get(); } 148 HeapListHashSet<Member<Resource>>* preloads() { return m_preloads.get(); }
148 149
149 // Workaround for https://crbug.com/666214. 150 // Workaround for https://crbug.com/666214.
150 // TODO(hiroshige): Remove this hack. 151 // TODO(hiroshige): Remove this hack.
151 void emulateLoadStartedForInspector(Resource*, 152 void emulateLoadStartedForInspector(Resource*,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 const FetchRequest&, 218 const FetchRequest&,
218 const ResourceFactory&, 219 const ResourceFactory&,
219 bool isStaticData) const; 220 bool isStaticData) const;
220 221
221 Member<FetchContext> m_context; 222 Member<FetchContext> m_context;
222 223
223 HashSet<String> m_validatedURLs; 224 HashSet<String> m_validatedURLs;
224 mutable DocumentResourceMap m_documentResources; 225 mutable DocumentResourceMap m_documentResources;
225 226
226 Member<HeapListHashSet<Member<Resource>>> m_preloads; 227 Member<HeapListHashSet<Member<Resource>>> m_preloads;
228 Member<HeapVector<Member<Resource>>> m_onloadDeferredResources;
227 Member<MHTMLArchive> m_archive; 229 Member<MHTMLArchive> m_archive;
228 230
229 TaskRunnerTimer<ResourceFetcher> m_resourceTimingReportTimer; 231 TaskRunnerTimer<ResourceFetcher> m_resourceTimingReportTimer;
230 232
231 using ResourceTimingInfoMap = 233 using ResourceTimingInfoMap =
232 HeapHashMap<Member<Resource>, std::unique_ptr<ResourceTimingInfo>>; 234 HeapHashMap<Member<Resource>, std::unique_ptr<ResourceTimingInfo>>;
233 ResourceTimingInfoMap m_resourceTimingInfoMap; 235 ResourceTimingInfoMap m_resourceTimingInfoMap;
234 236
235 std::unique_ptr<ResourceTimingInfo> m_navigationTimingInfo; 237 std::unique_ptr<ResourceTimingInfo> m_navigationTimingInfo;
236 238
(...skipping 14 matching lines...) Expand all
251 253
252 private: 254 private:
253 int m_useCount; 255 int m_useCount;
254 int m_revalidateCount; 256 int m_revalidateCount;
255 int m_loadCount; 257 int m_loadCount;
256 }; 258 };
257 DeadResourceStatsRecorder m_deadStatsRecorder; 259 DeadResourceStatsRecorder m_deadStatsRecorder;
258 260
259 std::unique_ptr<HashSet<String>> m_preloadedURLsForTest; 261 std::unique_ptr<HashSet<String>> m_preloadedURLsForTest;
260 262
261 // 28 bits left 263 // 27 bits left
262 bool m_autoLoadImages : 1; 264 bool m_autoLoadImages : 1;
263 bool m_imagesEnabled : 1; 265 bool m_imagesEnabled : 1;
264 bool m_allowStaleResources : 1; 266 bool m_allowStaleResources : 1;
265 bool m_imageFetched : 1; 267 bool m_imageFetched : 1;
268 bool m_onloadDeferredResourcesLoaded : 1;
266 }; 269 };
267 270
268 class ResourceCacheValidationSuppressor { 271 class ResourceCacheValidationSuppressor {
269 WTF_MAKE_NONCOPYABLE(ResourceCacheValidationSuppressor); 272 WTF_MAKE_NONCOPYABLE(ResourceCacheValidationSuppressor);
270 STACK_ALLOCATED(); 273 STACK_ALLOCATED();
271 274
272 public: 275 public:
273 explicit ResourceCacheValidationSuppressor(ResourceFetcher* loader) 276 explicit ResourceCacheValidationSuppressor(ResourceFetcher* loader)
274 : m_loader(loader), m_previousState(false) { 277 : m_loader(loader), m_previousState(false) {
275 if (m_loader) { 278 if (m_loader) {
276 m_previousState = m_loader->m_allowStaleResources; 279 m_previousState = m_loader->m_allowStaleResources;
277 m_loader->m_allowStaleResources = true; 280 m_loader->m_allowStaleResources = true;
278 } 281 }
279 } 282 }
280 ~ResourceCacheValidationSuppressor() { 283 ~ResourceCacheValidationSuppressor() {
281 if (m_loader) 284 if (m_loader)
282 m_loader->m_allowStaleResources = m_previousState; 285 m_loader->m_allowStaleResources = m_previousState;
283 } 286 }
284 287
285 private: 288 private:
286 Member<ResourceFetcher> m_loader; 289 Member<ResourceFetcher> m_loader;
287 bool m_previousState; 290 bool m_previousState;
288 }; 291 };
289 292
290 } // namespace blink 293 } // namespace blink
291 294
292 #endif // ResourceFetcher_h 295 #endif // ResourceFetcher_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698