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

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

Issue 2826213003: Don't lower priority for scripts inserted by doc.write (Closed)
Patch Set: Fixed duplicate URLs in Layout test Created 3 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
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 29 matching lines...) Expand all
40 class SecurityOrigin; 40 class SecurityOrigin;
41 41
42 // A FetchParameters is a "parameter object" for 42 // A FetchParameters is a "parameter object" for
43 // ResourceFetcher::requestResource to avoid the method having too many 43 // ResourceFetcher::requestResource to avoid the method having too many
44 // arguments. 44 // arguments.
45 class PLATFORM_EXPORT FetchParameters { 45 class PLATFORM_EXPORT FetchParameters {
46 STACK_ALLOCATED(); 46 STACK_ALLOCATED();
47 47
48 public: 48 public:
49 enum DeferOption { kNoDefer, kLazyLoad, kIdleLoad }; 49 enum DeferOption { kNoDefer, kLazyLoad, kIdleLoad };
50 enum class SpeculativePreloadType {
51 kNotSpeculative,
52 kInDocument, // The request was discovered in the main document
53 kInserted // The request was discovered in a document.write()
54 };
50 enum OriginRestriction { 55 enum OriginRestriction {
51 kUseDefaultOriginRestrictionForType, 56 kUseDefaultOriginRestrictionForType,
52 kRestrictToSameOrigin, 57 kRestrictToSameOrigin,
53 kNoOriginRestriction 58 kNoOriginRestriction
54 }; 59 };
55 enum PlaceholderImageRequestType { 60 enum PlaceholderImageRequestType {
56 kDisallowPlaceholder = 0, // The requested image must not be a placeholder. 61 kDisallowPlaceholder = 0, // The requested image must not be a placeholder.
57 kAllowPlaceholder, // The image is allowed to be a placeholder. 62 kAllowPlaceholder, // The image is allowed to be a placeholder.
58 }; 63 };
59 // TODO(toyoshim): Consider to define an enum for preload options, and use it 64 // TODO(toyoshim): Consider to define an enum for preload options, and use it
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 DeferOption Defer() const { return defer_; } 101 DeferOption Defer() const { return defer_; }
97 void SetDefer(DeferOption defer) { defer_ = defer; } 102 void SetDefer(DeferOption defer) { defer_ = defer; }
98 103
99 ResourceWidth GetResourceWidth() const { return resource_width_; } 104 ResourceWidth GetResourceWidth() const { return resource_width_; }
100 void SetResourceWidth(ResourceWidth); 105 void SetResourceWidth(ResourceWidth);
101 106
102 ClientHintsPreferences& GetClientHintsPreferences() { 107 ClientHintsPreferences& GetClientHintsPreferences() {
103 return client_hint_preferences_; 108 return client_hint_preferences_;
104 } 109 }
105 110
106 bool IsSpeculativePreload() const { return speculative_preload_; } 111 bool IsSpeculativePreload() const {
107 void SetSpeculativePreload(bool speculative_preload, 112 return speculative_preload_type_ != SpeculativePreloadType::kNotSpeculative;
108 double discovery_time = 0); 113 }
114 SpeculativePreloadType GetSpeculativePreloadType() const {
115 return speculative_preload_type_;
116 }
117 void SetSpeculativePreloadType(SpeculativePreloadType,
118 double discovery_time = 0);
109 119
110 double PreloadDiscoveryTime() { return preload_discovery_time_; } 120 double PreloadDiscoveryTime() { return preload_discovery_time_; }
111 121
112 bool IsLinkPreload() const { return options_.initiator_info.is_link_preload; } 122 bool IsLinkPreload() const { return options_.initiator_info.is_link_preload; }
113 void SetLinkPreload(bool is_link_preload) { 123 void SetLinkPreload(bool is_link_preload) {
114 options_.initiator_info.is_link_preload = is_link_preload; 124 options_.initiator_info.is_link_preload = is_link_preload;
115 } 125 }
116 126
117 void SetContentSecurityCheck( 127 void SetContentSecurityCheck(
118 ContentSecurityPolicyDisposition content_security_policy_option) { 128 ContentSecurityPolicyDisposition content_security_policy_option) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // Configures the request to load an image placeholder if the request is 165 // Configures the request to load an image placeholder if the request is
156 // eligible (e.g. the url's protocol is HTTP, etc.). If this request is 166 // eligible (e.g. the url's protocol is HTTP, etc.). If this request is
157 // non-eligible, this method doesn't modify the ResourceRequest. Calling this 167 // non-eligible, this method doesn't modify the ResourceRequest. Calling this
158 // method sets m_placeholderImageRequestType to the appropriate value. 168 // method sets m_placeholderImageRequestType to the appropriate value.
159 void SetAllowImagePlaceholder(); 169 void SetAllowImagePlaceholder();
160 170
161 private: 171 private:
162 ResourceRequest resource_request_; 172 ResourceRequest resource_request_;
163 String charset_; 173 String charset_;
164 ResourceLoaderOptions options_; 174 ResourceLoaderOptions options_;
165 bool speculative_preload_; 175 SpeculativePreloadType speculative_preload_type_;
166 double preload_discovery_time_; 176 double preload_discovery_time_;
167 DeferOption defer_; 177 DeferOption defer_;
168 OriginRestriction origin_restriction_; 178 OriginRestriction origin_restriction_;
169 ResourceWidth resource_width_; 179 ResourceWidth resource_width_;
170 ClientHintsPreferences client_hint_preferences_; 180 ClientHintsPreferences client_hint_preferences_;
171 PlaceholderImageRequestType placeholder_image_request_type_; 181 PlaceholderImageRequestType placeholder_image_request_type_;
172 }; 182 };
173 183
174 } // namespace blink 184 } // namespace blink
175 185
176 #endif 186 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698