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

Side by Side Diff: Source/platform/network/ResourceRequest.h

Issue 229053004: Allow cache reuse of some requests with Cache-Control headers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
4 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. 4 * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 12 matching lines...) Expand all
23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28 #ifndef ResourceRequest_h 28 #ifndef ResourceRequest_h
29 #define ResourceRequest_h 29 #define ResourceRequest_h
30 30
31 #include "platform/network/FormData.h" 31 #include "platform/network/FormData.h"
32 #include "platform/network/HTTPHeaderMap.h" 32 #include "platform/network/HTTPHeaderMap.h"
33 #include "platform/network/HTTPParsers.h"
33 #include "platform/network/ResourceLoadPriority.h" 34 #include "platform/network/ResourceLoadPriority.h"
34 #include "platform/weborigin/KURL.h" 35 #include "platform/weborigin/KURL.h"
35 #include "platform/weborigin/Referrer.h" 36 #include "platform/weborigin/Referrer.h"
36 #include "wtf/OwnPtr.h" 37 #include "wtf/OwnPtr.h"
37 38
38 namespace WebCore { 39 namespace WebCore {
39 40
40 enum ResourceRequestCachePolicy { 41 enum ResourceRequestCachePolicy {
41 UseProtocolCachePolicy, // normal load 42 UseProtocolCachePolicy, // normal load
42 ReloadIgnoringCacheData, // reload 43 ReloadIgnoringCacheData, // reload
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 void setDownloadToFile(bool downloadToFile) { m_downloadToFile = downloadToF ile; } 203 void setDownloadToFile(bool downloadToFile) { m_downloadToFile = downloadToF ile; }
203 204
204 // Extra data associated with this request. 205 // Extra data associated with this request.
205 ExtraData* extraData() const { return m_extraData.get(); } 206 ExtraData* extraData() const { return m_extraData.get(); }
206 void setExtraData(PassRefPtr<ExtraData> extraData) { m_extraData = extraData ; } 207 void setExtraData(PassRefPtr<ExtraData> extraData) { m_extraData = extraData ; }
207 208
208 // What this request is for. 209 // What this request is for.
209 TargetType targetType() const { return m_targetType; } 210 TargetType targetType() const { return m_targetType; }
210 void setTargetType(TargetType type) { m_targetType = type; } 211 void setTargetType(TargetType type) { m_targetType = type; }
211 212
213 bool cacheControlContainsNoCache();
214 bool cacheControlContainsNoStore();
215 bool hasCacheValidatorFields();
216
212 static double defaultTimeoutInterval(); // May return 0 when using platform default. 217 static double defaultTimeoutInterval(); // May return 0 when using platform default.
213 static void setDefaultTimeoutInterval(double); 218 static void setDefaultTimeoutInterval(double);
214 219
215 static bool compare(const ResourceRequest&, const ResourceRequest&); 220 static bool compare(const ResourceRequest&, const ResourceRequest&);
216 221
217 private: 222 private:
218 void initialize(const KURL& url, ResourceRequestCachePolicy cachePolicy); 223 void initialize(const KURL& url, ResourceRequestCachePolicy cachePolicy);
219 224
220 KURL m_url; 225 KURL m_url;
221 ResourceRequestCachePolicy m_cachePolicy; 226 ResourceRequestCachePolicy m_cachePolicy;
222 double m_timeoutInterval; // 0 is a magic value for platform default on plat forms that have one. 227 double m_timeoutInterval; // 0 is a magic value for platform default on plat forms that have one.
223 KURL m_firstPartyForCookies; 228 KURL m_firstPartyForCookies;
224 AtomicString m_httpMethod; 229 AtomicString m_httpMethod;
225 HTTPHeaderMap m_httpHeaderFields; 230 HTTPHeaderMap m_httpHeaderFields;
226 RefPtr<FormData> m_httpBody; 231 RefPtr<FormData> m_httpBody;
227 bool m_allowStoredCredentials : 1; 232 bool m_allowStoredCredentials : 1;
228 bool m_reportUploadProgress : 1; 233 bool m_reportUploadProgress : 1;
229 bool m_reportLoadTiming : 1; 234 bool m_reportLoadTiming : 1;
230 bool m_reportRawHeaders : 1; 235 bool m_reportRawHeaders : 1;
231 bool m_hasUserGesture : 1; 236 bool m_hasUserGesture : 1;
232 bool m_downloadToFile : 1; 237 bool m_downloadToFile : 1;
233 ResourceLoadPriority m_priority; 238 ResourceLoadPriority m_priority;
234 int m_intraPriorityValue; 239 int m_intraPriorityValue;
235 int m_requestorID; 240 int m_requestorID;
236 int m_requestorProcessID; 241 int m_requestorProcessID;
237 int m_appCacheHostID; 242 int m_appCacheHostID;
238 RefPtr<ExtraData> m_extraData; 243 RefPtr<ExtraData> m_extraData;
239 TargetType m_targetType; 244 TargetType m_targetType;
240 ReferrerPolicy m_referrerPolicy; 245 ReferrerPolicy m_referrerPolicy;
246 CacheControlHeader m_cacheControlHeader;
241 247
242 static double s_defaultTimeoutInterval; 248 static double s_defaultTimeoutInterval;
243 }; 249 };
244 250
245 bool equalIgnoringHeaderFields(const ResourceRequest&, const ResourceRequest&); 251 bool equalIgnoringHeaderFields(const ResourceRequest&, const ResourceRequest&);
246 252
247 inline bool operator==(const ResourceRequest& a, const ResourceRequest& b) { ret urn ResourceRequest::compare(a, b); } 253 inline bool operator==(const ResourceRequest& a, const ResourceRequest& b) { ret urn ResourceRequest::compare(a, b); }
248 inline bool operator!=(ResourceRequest& a, const ResourceRequest& b) { return !( a == b); } 254 inline bool operator!=(ResourceRequest& a, const ResourceRequest& b) { return !( a == b); }
249 255
250 struct CrossThreadResourceRequestData { 256 struct CrossThreadResourceRequestData {
(...skipping 20 matching lines...) Expand all
271 int m_appCacheHostID; 277 int m_appCacheHostID;
272 ResourceRequest::TargetType m_targetType; 278 ResourceRequest::TargetType m_targetType;
273 ReferrerPolicy m_referrerPolicy; 279 ReferrerPolicy m_referrerPolicy;
274 }; 280 };
275 281
276 unsigned initializeMaximumHTTPConnectionCountPerHost(); 282 unsigned initializeMaximumHTTPConnectionCountPerHost();
277 283
278 } // namespace WebCore 284 } // namespace WebCore
279 285
280 #endif // ResourceRequest_h 286 #endif // ResourceRequest_h
OLDNEW
« no previous file with comments | « Source/platform/network/HTTPParsersTest.cpp ('k') | Source/platform/network/ResourceRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698