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

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

Issue 2843013002: Revert of Don't lower priority for scripts inserted by doc.write (Closed)
Patch Set: 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 21 matching lines...) Expand all
32 #include "platform/weborigin/Suborigin.h" 32 #include "platform/weborigin/Suborigin.h"
33 33
34 namespace blink { 34 namespace blink {
35 35
36 FetchParameters::FetchParameters(const ResourceRequest& resource_request, 36 FetchParameters::FetchParameters(const ResourceRequest& resource_request,
37 const AtomicString& initiator, 37 const AtomicString& initiator,
38 const String& charset) 38 const String& charset)
39 : resource_request_(resource_request), 39 : resource_request_(resource_request),
40 charset_(charset), 40 charset_(charset),
41 options_(ResourceFetcher::DefaultResourceOptions()), 41 options_(ResourceFetcher::DefaultResourceOptions()),
42 speculative_preload_type_(SpeculativePreloadType::kNotSpeculative), 42 speculative_preload_(false),
43 preload_discovery_time_(0.0), 43 preload_discovery_time_(0.0),
44 defer_(kNoDefer), 44 defer_(kNoDefer),
45 origin_restriction_(kUseDefaultOriginRestrictionForType), 45 origin_restriction_(kUseDefaultOriginRestrictionForType),
46 placeholder_image_request_type_(kDisallowPlaceholder) { 46 placeholder_image_request_type_(kDisallowPlaceholder) {
47 options_.initiator_info.name = initiator; 47 options_.initiator_info.name = initiator;
48 } 48 }
49 49
50 FetchParameters::FetchParameters(const ResourceRequest& resource_request, 50 FetchParameters::FetchParameters(const ResourceRequest& resource_request,
51 const AtomicString& initiator, 51 const AtomicString& initiator,
52 const ResourceLoaderOptions& options) 52 const ResourceLoaderOptions& options)
53 : resource_request_(resource_request), 53 : resource_request_(resource_request),
54 options_(options), 54 options_(options),
55 speculative_preload_type_(SpeculativePreloadType::kNotSpeculative), 55 speculative_preload_(false),
56 preload_discovery_time_(0.0), 56 preload_discovery_time_(0.0),
57 defer_(kNoDefer), 57 defer_(kNoDefer),
58 origin_restriction_(kUseDefaultOriginRestrictionForType), 58 origin_restriction_(kUseDefaultOriginRestrictionForType),
59 placeholder_image_request_type_( 59 placeholder_image_request_type_(
60 PlaceholderImageRequestType::kDisallowPlaceholder) { 60 PlaceholderImageRequestType::kDisallowPlaceholder) {
61 options_.initiator_info.name = initiator; 61 options_.initiator_info.name = initiator;
62 } 62 }
63 63
64 FetchParameters::FetchParameters(const ResourceRequest& resource_request, 64 FetchParameters::FetchParameters(const ResourceRequest& resource_request,
65 const FetchInitiatorInfo& initiator) 65 const FetchInitiatorInfo& initiator)
66 : resource_request_(resource_request), 66 : resource_request_(resource_request),
67 options_(ResourceFetcher::DefaultResourceOptions()), 67 options_(ResourceFetcher::DefaultResourceOptions()),
68 speculative_preload_type_(SpeculativePreloadType::kNotSpeculative), 68 speculative_preload_(false),
69 preload_discovery_time_(0.0), 69 preload_discovery_time_(0.0),
70 defer_(kNoDefer), 70 defer_(kNoDefer),
71 origin_restriction_(kUseDefaultOriginRestrictionForType), 71 origin_restriction_(kUseDefaultOriginRestrictionForType),
72 placeholder_image_request_type_( 72 placeholder_image_request_type_(
73 PlaceholderImageRequestType::kDisallowPlaceholder) { 73 PlaceholderImageRequestType::kDisallowPlaceholder) {
74 options_.initiator_info = initiator; 74 options_.initiator_info = initiator;
75 } 75 }
76 76
77 FetchParameters::~FetchParameters() {} 77 FetchParameters::~FetchParameters() {}
78 78
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 resource_request_.SetHTTPOrigin(origin); 122 resource_request_.SetHTTPOrigin(origin);
123 } 123 }
124 124
125 void FetchParameters::SetResourceWidth(ResourceWidth resource_width) { 125 void FetchParameters::SetResourceWidth(ResourceWidth resource_width) {
126 if (resource_width.is_set) { 126 if (resource_width.is_set) {
127 resource_width_.width = resource_width.width; 127 resource_width_.width = resource_width.width;
128 resource_width_.is_set = true; 128 resource_width_.is_set = true;
129 } 129 }
130 } 130 }
131 131
132 void FetchParameters::SetSpeculativePreloadType( 132 void FetchParameters::SetSpeculativePreload(bool speculative_preload,
133 SpeculativePreloadType speculative_preload_type, 133 double discovery_time) {
134 double discovery_time) { 134 speculative_preload_ = speculative_preload;
135 speculative_preload_type_ = speculative_preload_type;
136 preload_discovery_time_ = discovery_time; 135 preload_discovery_time_ = discovery_time;
137 } 136 }
138 137
139 void FetchParameters::MakeSynchronous() { 138 void FetchParameters::MakeSynchronous() {
140 // Synchronous requests should always be max priority, lest they hang the 139 // Synchronous requests should always be max priority, lest they hang the
141 // renderer. 140 // renderer.
142 resource_request_.SetPriority(kResourceLoadPriorityHighest); 141 resource_request_.SetPriority(kResourceLoadPriorityHighest);
143 resource_request_.SetTimeoutInterval(10); 142 resource_request_.SetTimeoutInterval(10);
144 options_.synchronous_policy = kRequestSynchronously; 143 options_.synchronous_policy = kRequestSynchronously;
145 } 144 }
(...skipping 13 matching lines...) Expand all
159 // the dimensions for larger images. 158 // the dimensions for larger images.
160 // TODO(sclittle): Calculate the optimal value for this number. 159 // TODO(sclittle): Calculate the optimal value for this number.
161 resource_request_.SetHTTPHeaderField("range", "bytes=0-2047"); 160 resource_request_.SetHTTPHeaderField("range", "bytes=0-2047");
162 161
163 // TODO(sclittle): Indicate somehow (e.g. through a new request bit) to the 162 // TODO(sclittle): Indicate somehow (e.g. through a new request bit) to the
164 // embedder that it should return the full resource if the entire resource is 163 // embedder that it should return the full resource if the entire resource is
165 // fresh in the cache. 164 // fresh in the cache.
166 } 165 }
167 166
168 } // namespace blink 167 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698