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

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

Issue 2533683002: Move the code in ResourceFetcher handling calls from WebURLLoaderImpl to ResourceLoader (Closed)
Patch Set: Fixed a bug in resource timing population Created 4 years 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 void logPreloadStats(ClearPreloadsPolicy); 110 void logPreloadStats(ClearPreloadsPolicy);
111 void warnUnusedPreloads(); 111 void warnUnusedPreloads();
112 112
113 MHTMLArchive* archive() const { return m_archive.get(); } 113 MHTMLArchive* archive() const { return m_archive.get(); }
114 ArchiveResource* createArchive(Resource*); 114 ArchiveResource* createArchive(Resource*);
115 115
116 void setDefersLoading(bool); 116 void setDefersLoading(bool);
117 void stopFetching(); 117 void stopFetching();
118 bool isFetching() const; 118 bool isFetching() const;
119 119
120 bool willFollowRedirect(Resource*, ResourceRequest&, const ResourceResponse&); 120 bool shouldDeferImageLoad(const KURL&) const;
121 enum DidFinishLoadingReason { 121
122 DidFinishLoading, 122 void recordResourceTimingOnRedirect(Resource*, const ResourceResponse&, bool);
123 DidFinishFirstPartInMultipart 123
124 }; 124 enum LoaderFinishType { DidFinishLoading, DidFinishFirstPartInMultipart };
125 void didFinishLoading(Resource*, 125 void handleLoaderFinish(Resource*, double finishTime, LoaderFinishType);
126 double finishTime, 126 void handleLoaderError(Resource*, const ResourceError&);
127 DidFinishLoadingReason);
128 void didFailLoading(Resource*, const ResourceError&);
129 void didReceiveResponse(Resource*,
130 const ResourceResponse&,
131 std::unique_ptr<WebDataConsumerHandle>);
132 void didReceiveData(const Resource*,
133 const char* data,
134 int dataLength,
135 int encodedDataLength);
136 void didDownloadData(const Resource*, int dataLength, int encodedDataLength);
137 bool defersLoading() const;
138 bool isControlledByServiceWorker() const; 127 bool isControlledByServiceWorker() const;
139 128
140 void acceptDataFromThreadedReceiver(unsigned long identifier,
141 const char* data,
142 int dataLength,
143 int encodedDataLength);
144
145 enum ResourceLoadStartType { 129 enum ResourceLoadStartType {
146 ResourceLoadingFromNetwork, 130 ResourceLoadingFromNetwork,
147 ResourceLoadingFromCache 131 ResourceLoadingFromCache
148 }; 132 };
149 void requestLoadStarted(unsigned long identifier, 133 void requestLoadStarted(unsigned long identifier,
150 Resource*, 134 Resource*,
151 const FetchRequest&, 135 const FetchRequest&,
152 ResourceLoadStartType, 136 ResourceLoadStartType,
153 bool isStaticData = false); 137 bool isStaticData = false);
154 static const ResourceLoaderOptions& defaultResourceOptions(); 138 static const ResourceLoaderOptions& defaultResourceOptions();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // RevalidationPolicy enum values are used in UMAs https://crbug.com/579496. 174 // RevalidationPolicy enum values are used in UMAs https://crbug.com/579496.
191 enum RevalidationPolicy { Use, Revalidate, Reload, Load }; 175 enum RevalidationPolicy { Use, Revalidate, Reload, Load };
192 RevalidationPolicy determineRevalidationPolicy(Resource::Type, 176 RevalidationPolicy determineRevalidationPolicy(Resource::Type,
193 const FetchRequest&, 177 const FetchRequest&,
194 Resource* existingResource, 178 Resource* existingResource,
195 bool isStaticData) const; 179 bool isStaticData) const;
196 180
197 void moveCachedNonBlockingResourceToBlocking(Resource*, const FetchRequest&); 181 void moveCachedNonBlockingResourceToBlocking(Resource*, const FetchRequest&);
198 void moveResourceLoaderToNonBlocking(ResourceLoader*); 182 void moveResourceLoaderToNonBlocking(ResourceLoader*);
199 void removeResourceLoader(ResourceLoader*); 183 void removeResourceLoader(ResourceLoader*);
184 void handleLoadCompletion(Resource*);
200 185
201 void initializeResourceRequest(ResourceRequest&, 186 void initializeResourceRequest(ResourceRequest&,
202 Resource::Type, 187 Resource::Type,
203 FetchRequest::DeferOption); 188 FetchRequest::DeferOption);
204 void willSendRequest(unsigned long identifier,
205 ResourceRequest&,
206 const ResourceResponse&,
207 const ResourceLoaderOptions&);
208 bool canAccessResponse(Resource*, const ResourceResponse&) const;
209 189
210 bool resourceNeedsLoad(Resource*, const FetchRequest&, RevalidationPolicy); 190 bool resourceNeedsLoad(Resource*, const FetchRequest&, RevalidationPolicy);
211 bool shouldDeferImageLoad(const KURL&) const;
212 191
213 void resourceTimingReportTimerFired(TimerBase*); 192 void resourceTimingReportTimerFired(TimerBase*);
214 193
215 void reloadImagesIfNotDeferred(); 194 void reloadImagesIfNotDeferred();
216 195
217 void updateMemoryCacheStats(Resource*, 196 void updateMemoryCacheStats(Resource*,
218 RevalidationPolicy, 197 RevalidationPolicy,
219 const FetchRequest&, 198 const FetchRequest&,
220 const ResourceFactory&, 199 const ResourceFactory&,
221 bool isStaticData) const; 200 bool isStaticData) const;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 } 262 }
284 263
285 private: 264 private:
286 Member<ResourceFetcher> m_loader; 265 Member<ResourceFetcher> m_loader;
287 bool m_previousState; 266 bool m_previousState;
288 }; 267 };
289 268
290 } // namespace blink 269 } // namespace blink
291 270
292 #endif // ResourceFetcher_h 271 #endif // ResourceFetcher_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698