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

Side by Side Diff: third_party/WebKit/Source/core/fetch/FetchRequest.cpp

Issue 2390583002: [WIP] WebFonts cache-aware timeout adaption (Closed)
Patch Set: check ERR_CACHE_MISS directly in ResourceError Created 4 years, 1 month 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) 2012 Google, Inc. All rights reserved. 2 * Copyright (C) 2012 Google, Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 24 matching lines...) Expand all
35 const AtomicString& initiator, 35 const AtomicString& initiator,
36 const String& charset) 36 const String& charset)
37 : m_resourceRequest(resourceRequest), 37 : m_resourceRequest(resourceRequest),
38 m_charset(charset), 38 m_charset(charset),
39 m_options(ResourceFetcher::defaultResourceOptions()), 39 m_options(ResourceFetcher::defaultResourceOptions()),
40 m_forPreload(false), 40 m_forPreload(false),
41 m_linkPreload(false), 41 m_linkPreload(false),
42 m_preloadDiscoveryTime(0.0), 42 m_preloadDiscoveryTime(0.0),
43 m_defer(NoDefer), 43 m_defer(NoDefer),
44 m_originRestriction(UseDefaultOriginRestrictionForType), 44 m_originRestriction(UseDefaultOriginRestrictionForType),
45 m_placeholderImageRequestType(DisallowPlaceholder) { 45 m_placeholderImageRequestType(DisallowPlaceholder),
46 m_isCacheAwareLoadingEnabled(false) {
46 m_options.initiatorInfo.name = initiator; 47 m_options.initiatorInfo.name = initiator;
47 } 48 }
48 49
49 FetchRequest::FetchRequest(const ResourceRequest& resourceRequest, 50 FetchRequest::FetchRequest(const ResourceRequest& resourceRequest,
50 const AtomicString& initiator, 51 const AtomicString& initiator,
51 const ResourceLoaderOptions& options) 52 const ResourceLoaderOptions& options)
52 : m_resourceRequest(resourceRequest), 53 : m_resourceRequest(resourceRequest),
53 m_options(options), 54 m_options(options),
54 m_forPreload(false), 55 m_forPreload(false),
55 m_linkPreload(false), 56 m_linkPreload(false),
56 m_preloadDiscoveryTime(0.0), 57 m_preloadDiscoveryTime(0.0),
57 m_defer(NoDefer), 58 m_defer(NoDefer),
58 m_originRestriction(UseDefaultOriginRestrictionForType), 59 m_originRestriction(UseDefaultOriginRestrictionForType),
59 m_placeholderImageRequestType( 60 m_placeholderImageRequestType(
60 PlaceholderImageRequestType::DisallowPlaceholder) { 61 PlaceholderImageRequestType::DisallowPlaceholder),
62 m_isCacheAwareLoadingEnabled(false) {
61 m_options.initiatorInfo.name = initiator; 63 m_options.initiatorInfo.name = initiator;
62 } 64 }
63 65
64 FetchRequest::FetchRequest(const ResourceRequest& resourceRequest, 66 FetchRequest::FetchRequest(const ResourceRequest& resourceRequest,
65 const FetchInitiatorInfo& initiator) 67 const FetchInitiatorInfo& initiator)
66 : m_resourceRequest(resourceRequest), 68 : m_resourceRequest(resourceRequest),
67 m_options(ResourceFetcher::defaultResourceOptions()), 69 m_options(ResourceFetcher::defaultResourceOptions()),
68 m_forPreload(false), 70 m_forPreload(false),
69 m_linkPreload(false), 71 m_linkPreload(false),
70 m_preloadDiscoveryTime(0.0), 72 m_preloadDiscoveryTime(0.0),
71 m_defer(NoDefer), 73 m_defer(NoDefer),
72 m_originRestriction(UseDefaultOriginRestrictionForType), 74 m_originRestriction(UseDefaultOriginRestrictionForType),
73 m_placeholderImageRequestType( 75 m_placeholderImageRequestType(
74 PlaceholderImageRequestType::DisallowPlaceholder) { 76 PlaceholderImageRequestType::DisallowPlaceholder),
77 m_isCacheAwareLoadingEnabled(false) {
75 m_options.initiatorInfo = initiator; 78 m_options.initiatorInfo = initiator;
76 } 79 }
77 80
78 FetchRequest::~FetchRequest() {} 81 FetchRequest::~FetchRequest() {}
79 82
80 void FetchRequest::setCrossOriginAccessControl( 83 void FetchRequest::setCrossOriginAccessControl(
81 SecurityOrigin* origin, 84 SecurityOrigin* origin,
82 CrossOriginAttributeValue crossOrigin) { 85 CrossOriginAttributeValue crossOrigin) {
83 DCHECK_NE(crossOrigin, CrossOriginAttributeNotSet); 86 DCHECK_NE(crossOrigin, CrossOriginAttributeNotSet);
84 const bool useCredentials = crossOrigin == CrossOriginAttributeUseCredentials; 87 const bool useCredentials = crossOrigin == CrossOriginAttributeUseCredentials;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // the dimensions for larger images. 143 // the dimensions for larger images.
141 // TODO(sclittle): Calculate the optimal value for this number. 144 // TODO(sclittle): Calculate the optimal value for this number.
142 m_resourceRequest.setHTTPHeaderField("range", "bytes=0-2047"); 145 m_resourceRequest.setHTTPHeaderField("range", "bytes=0-2047");
143 146
144 // TODO(sclittle): Indicate somehow (e.g. through a new request bit) to the 147 // TODO(sclittle): Indicate somehow (e.g. through a new request bit) to the
145 // embedder that it should return the full resource if the entire resource is 148 // embedder that it should return the full resource if the entire resource is
146 // fresh in the cache. 149 // fresh in the cache.
147 } 150 }
148 151
149 } // namespace blink 152 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698