| OLD | NEW |
| 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 Loading... |
| 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_(false), | 42 speculative_preload_type_(SpeculativePreloadType::kNotSpeculative), |
| 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_(false), | 55 speculative_preload_type_(SpeculativePreloadType::kNotSpeculative), |
| 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_(false), | 68 speculative_preload_type_(SpeculativePreloadType::kNotSpeculative), |
| 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 Loading... |
| 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::SetSpeculativePreload(bool speculative_preload, | 132 void FetchParameters::SetSpeculativePreloadType( |
| 133 double discovery_time) { | 133 SpeculativePreloadType speculative_preload_type, |
| 134 speculative_preload_ = speculative_preload; | 134 double discovery_time) { |
| 135 speculative_preload_type_ = speculative_preload_type; |
| 135 preload_discovery_time_ = discovery_time; | 136 preload_discovery_time_ = discovery_time; |
| 136 } | 137 } |
| 137 | 138 |
| 138 void FetchParameters::MakeSynchronous() { | 139 void FetchParameters::MakeSynchronous() { |
| 139 // Synchronous requests should always be max priority, lest they hang the | 140 // Synchronous requests should always be max priority, lest they hang the |
| 140 // renderer. | 141 // renderer. |
| 141 resource_request_.SetPriority(kResourceLoadPriorityHighest); | 142 resource_request_.SetPriority(kResourceLoadPriorityHighest); |
| 142 resource_request_.SetTimeoutInterval(10); | 143 resource_request_.SetTimeoutInterval(10); |
| 143 options_.synchronous_policy = kRequestSynchronously; | 144 options_.synchronous_policy = kRequestSynchronously; |
| 144 } | 145 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 158 // the dimensions for larger images. | 159 // the dimensions for larger images. |
| 159 // TODO(sclittle): Calculate the optimal value for this number. | 160 // TODO(sclittle): Calculate the optimal value for this number. |
| 160 resource_request_.SetHTTPHeaderField("range", "bytes=0-2047"); | 161 resource_request_.SetHTTPHeaderField("range", "bytes=0-2047"); |
| 161 | 162 |
| 162 // TODO(sclittle): Indicate somehow (e.g. through a new request bit) to the | 163 // TODO(sclittle): Indicate somehow (e.g. through a new request bit) to the |
| 163 // embedder that it should return the full resource if the entire resource is | 164 // embedder that it should return the full resource if the entire resource is |
| 164 // fresh in the cache. | 165 // fresh in the cache. |
| 165 } | 166 } |
| 166 | 167 |
| 167 } // namespace blink | 168 } // namespace blink |
| OLD | NEW |