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

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

Issue 2676163002: Refactor the forPreload flag to mean speculative preload. (Closed)
Patch Set: Renamed ReportingPolicy and moved comments Created 3 years, 10 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) 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 UseDefaultOriginRestrictionForType, 50 UseDefaultOriginRestrictionForType,
51 RestrictToSameOrigin, 51 RestrictToSameOrigin,
52 NoOriginRestriction 52 NoOriginRestriction
53 }; 53 };
54 enum PlaceholderImageRequestType { 54 enum PlaceholderImageRequestType {
55 DisallowPlaceholder = 0, // The requested image must not be a placeholder. 55 DisallowPlaceholder = 0, // The requested image must not be a placeholder.
56 AllowPlaceholder, // The image is allowed to be a placeholder. 56 AllowPlaceholder, // The image is allowed to be a placeholder.
57 }; 57 };
58 // TODO(toyoshim): Consider to define an enum for preload options, and use it 58 // TODO(toyoshim): Consider to define an enum for preload options, and use it
59 // instead of bool in this class, FrameFetchContext, and so on. If it is 59 // instead of bool in this class, FrameFetchContext, and so on. If it is
60 // reasonable, we try merging m_forPreload and m_linkPreload into one enum 60 // reasonable, we try merging m_speculativePreload and m_linkPreload into one
61 // type. See https://crbug.com/675883. 61 // enum type. See https://crbug.com/675883.
62 62
63 struct ResourceWidth { 63 struct ResourceWidth {
64 DISALLOW_NEW(); 64 DISALLOW_NEW();
65 float width; 65 float width;
66 bool isSet; 66 bool isSet;
67 67
68 ResourceWidth() : width(0), isSet(false) {} 68 ResourceWidth() : width(0), isSet(false) {}
69 }; 69 };
70 70
71 FetchRequest(const ResourceRequest&, 71 FetchRequest(const ResourceRequest&,
(...skipping 17 matching lines...) Expand all
89 DeferOption defer() const { return m_defer; } 89 DeferOption defer() const { return m_defer; }
90 void setDefer(DeferOption defer) { m_defer = defer; } 90 void setDefer(DeferOption defer) { m_defer = defer; }
91 91
92 ResourceWidth getResourceWidth() const { return m_resourceWidth; } 92 ResourceWidth getResourceWidth() const { return m_resourceWidth; }
93 void setResourceWidth(ResourceWidth); 93 void setResourceWidth(ResourceWidth);
94 94
95 ClientHintsPreferences& clientHintsPreferences() { 95 ClientHintsPreferences& clientHintsPreferences() {
96 return m_clientHintPreferences; 96 return m_clientHintPreferences;
97 } 97 }
98 98
99 bool forPreload() const { return m_forPreload; } 99 bool isSpeculativePreload() const { return m_speculativePreload; }
100 void setForPreload(bool forPreload, double discoveryTime = 0); 100 void setSpeculativePreload(bool speculativePreload, double discoveryTime = 0);
101 101
102 double preloadDiscoveryTime() { return m_preloadDiscoveryTime; } 102 double preloadDiscoveryTime() { return m_preloadDiscoveryTime; }
103 103
104 bool isLinkPreload() { return m_linkPreload; } 104 bool isLinkPreload() const { return m_linkPreload; }
105 void setLinkPreload(bool isLinkPreload) { m_linkPreload = isLinkPreload; } 105 void setLinkPreload(bool isLinkPreload) { m_linkPreload = isLinkPreload; }
106 106
107 void setContentSecurityCheck( 107 void setContentSecurityCheck(
108 ContentSecurityPolicyDisposition contentSecurityPolicyOption) { 108 ContentSecurityPolicyDisposition contentSecurityPolicyOption) {
109 m_options.contentSecurityPolicyOption = contentSecurityPolicyOption; 109 m_options.contentSecurityPolicyOption = contentSecurityPolicyOption;
110 } 110 }
111 void setCrossOriginAccessControl(SecurityOrigin*, CrossOriginAttributeValue); 111 void setCrossOriginAccessControl(SecurityOrigin*, CrossOriginAttributeValue);
112 OriginRestriction getOriginRestriction() const { return m_originRestriction; } 112 OriginRestriction getOriginRestriction() const { return m_originRestriction; }
113 void setOriginRestriction(OriginRestriction restriction) { 113 void setOriginRestriction(OriginRestriction restriction) {
114 m_originRestriction = restriction; 114 m_originRestriction = restriction;
(...skipping 30 matching lines...) Expand all
145 // Configures the request to load an image placeholder if the request is 145 // Configures the request to load an image placeholder if the request is
146 // eligible (e.g. the url's protocol is HTTP, etc.). If this request is 146 // eligible (e.g. the url's protocol is HTTP, etc.). If this request is
147 // non-eligible, this method doesn't modify the ResourceRequest. Calling this 147 // non-eligible, this method doesn't modify the ResourceRequest. Calling this
148 // method sets m_placeholderImageRequestType to the appropriate value. 148 // method sets m_placeholderImageRequestType to the appropriate value.
149 void setAllowImagePlaceholder(); 149 void setAllowImagePlaceholder();
150 150
151 private: 151 private:
152 ResourceRequest m_resourceRequest; 152 ResourceRequest m_resourceRequest;
153 String m_charset; 153 String m_charset;
154 ResourceLoaderOptions m_options; 154 ResourceLoaderOptions m_options;
155 bool m_forPreload; 155 bool m_speculativePreload;
156 bool m_linkPreload; 156 bool m_linkPreload;
157 double m_preloadDiscoveryTime; 157 double m_preloadDiscoveryTime;
158 DeferOption m_defer; 158 DeferOption m_defer;
159 OriginRestriction m_originRestriction; 159 OriginRestriction m_originRestriction;
160 ResourceWidth m_resourceWidth; 160 ResourceWidth m_resourceWidth;
161 ClientHintsPreferences m_clientHintPreferences; 161 ClientHintsPreferences m_clientHintPreferences;
162 PlaceholderImageRequestType m_placeholderImageRequestType; 162 PlaceholderImageRequestType m_placeholderImageRequestType;
163 }; 163 };
164 164
165 } // namespace blink 165 } // namespace blink
166 166
167 #endif 167 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698