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

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: 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 // enum
61 // type. See https://crbug.com/675883. 62 // type. See https://crbug.com/675883.
Charlie Harrison 2017/02/05 18:39:11 Move this to previous line.
Yoav Weiss 2017/02/06 09:58:35 ok
62 63
63 struct ResourceWidth { 64 struct ResourceWidth {
64 DISALLOW_NEW(); 65 DISALLOW_NEW();
65 float width; 66 float width;
66 bool isSet; 67 bool isSet;
67 68
68 ResourceWidth() : width(0), isSet(false) {} 69 ResourceWidth() : width(0), isSet(false) {}
69 }; 70 };
70 71
71 FetchRequest(const ResourceRequest&, 72 FetchRequest(const ResourceRequest&,
(...skipping 17 matching lines...) Expand all
89 DeferOption defer() const { return m_defer; } 90 DeferOption defer() const { return m_defer; }
90 void setDefer(DeferOption defer) { m_defer = defer; } 91 void setDefer(DeferOption defer) { m_defer = defer; }
91 92
92 ResourceWidth getResourceWidth() const { return m_resourceWidth; } 93 ResourceWidth getResourceWidth() const { return m_resourceWidth; }
93 void setResourceWidth(ResourceWidth); 94 void setResourceWidth(ResourceWidth);
94 95
95 ClientHintsPreferences& clientHintsPreferences() { 96 ClientHintsPreferences& clientHintsPreferences() {
96 return m_clientHintPreferences; 97 return m_clientHintPreferences;
97 } 98 }
98 99
99 bool forPreload() const { return m_forPreload; } 100 bool speculativePreload() const { return m_speculativePreload; }
100 void setForPreload(bool forPreload, double discoveryTime = 0); 101 void setSpeculativePreload(bool speculativePreload, double discoveryTime = 0);
101 102
102 double preloadDiscoveryTime() { return m_preloadDiscoveryTime; } 103 double preloadDiscoveryTime() { return m_preloadDiscoveryTime; }
103 104
104 bool isLinkPreload() { return m_linkPreload; } 105 bool isLinkPreload() const { return m_linkPreload; }
105 void setLinkPreload(bool isLinkPreload) { m_linkPreload = isLinkPreload; } 106 void setLinkPreload(bool isLinkPreload) { m_linkPreload = isLinkPreload; }
106 107
107 void setContentSecurityCheck( 108 void setContentSecurityCheck(
108 ContentSecurityPolicyDisposition contentSecurityPolicyOption) { 109 ContentSecurityPolicyDisposition contentSecurityPolicyOption) {
109 m_options.contentSecurityPolicyOption = contentSecurityPolicyOption; 110 m_options.contentSecurityPolicyOption = contentSecurityPolicyOption;
110 } 111 }
111 void setCrossOriginAccessControl(SecurityOrigin*, CrossOriginAttributeValue); 112 void setCrossOriginAccessControl(SecurityOrigin*, CrossOriginAttributeValue);
112 OriginRestriction getOriginRestriction() const { return m_originRestriction; } 113 OriginRestriction getOriginRestriction() const { return m_originRestriction; }
113 void setOriginRestriction(OriginRestriction restriction) { 114 void setOriginRestriction(OriginRestriction restriction) {
114 m_originRestriction = restriction; 115 m_originRestriction = restriction;
(...skipping 30 matching lines...) Expand all
145 // Configures the request to load an image placeholder if the request is 146 // 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 147 // 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 148 // non-eligible, this method doesn't modify the ResourceRequest. Calling this
148 // method sets m_placeholderImageRequestType to the appropriate value. 149 // method sets m_placeholderImageRequestType to the appropriate value.
149 void setAllowImagePlaceholder(); 150 void setAllowImagePlaceholder();
150 151
151 private: 152 private:
152 ResourceRequest m_resourceRequest; 153 ResourceRequest m_resourceRequest;
153 String m_charset; 154 String m_charset;
154 ResourceLoaderOptions m_options; 155 ResourceLoaderOptions m_options;
155 bool m_forPreload; 156 bool m_speculativePreload;
156 bool m_linkPreload; 157 bool m_linkPreload;
157 double m_preloadDiscoveryTime; 158 double m_preloadDiscoveryTime;
158 DeferOption m_defer; 159 DeferOption m_defer;
159 OriginRestriction m_originRestriction; 160 OriginRestriction m_originRestriction;
160 ResourceWidth m_resourceWidth; 161 ResourceWidth m_resourceWidth;
161 ClientHintsPreferences m_clientHintPreferences; 162 ClientHintsPreferences m_clientHintPreferences;
162 PlaceholderImageRequestType m_placeholderImageRequestType; 163 PlaceholderImageRequestType m_placeholderImageRequestType;
163 }; 164 };
164 165
165 } // namespace blink 166 } // namespace blink
166 167
167 #endif 168 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698