| 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 FetchRequest::FetchRequest(const ResourceRequest& resourceRequest, | 36 FetchRequest::FetchRequest(const ResourceRequest& resourceRequest, |
| 37 const AtomicString& initiator, | 37 const AtomicString& initiator, |
| 38 const String& charset) | 38 const String& charset) |
| 39 : m_resourceRequest(resourceRequest), | 39 : m_resourceRequest(resourceRequest), |
| 40 m_charset(charset), | 40 m_charset(charset), |
| 41 m_options(ResourceFetcher::defaultResourceOptions()), | 41 m_options(ResourceFetcher::defaultResourceOptions()), |
| 42 m_speculativePreload(false), | |
| 43 m_linkPreload(false), | |
| 44 m_preloadDiscoveryTime(0.0), | |
| 45 m_defer(NoDefer), | 42 m_defer(NoDefer), |
| 46 m_originRestriction(UseDefaultOriginRestrictionForType), | 43 m_originRestriction(UseDefaultOriginRestrictionForType), |
| 47 m_placeholderImageRequestType(DisallowPlaceholder) { | 44 m_placeholderImageRequestType(DisallowPlaceholder) { |
| 48 m_options.initiatorInfo.name = initiator; | 45 m_options.initiatorInfo.name = initiator; |
| 49 } | 46 } |
| 50 | 47 |
| 51 FetchRequest::FetchRequest(const ResourceRequest& resourceRequest, | 48 FetchRequest::FetchRequest(const ResourceRequest& resourceRequest, |
| 52 const AtomicString& initiator, | 49 const AtomicString& initiator, |
| 53 const ResourceLoaderOptions& options) | 50 const ResourceLoaderOptions& options) |
| 54 : m_resourceRequest(resourceRequest), | 51 : m_resourceRequest(resourceRequest), |
| 55 m_options(options), | 52 m_options(options), |
| 56 m_speculativePreload(false), | |
| 57 m_linkPreload(false), | |
| 58 m_preloadDiscoveryTime(0.0), | |
| 59 m_defer(NoDefer), | 53 m_defer(NoDefer), |
| 60 m_originRestriction(UseDefaultOriginRestrictionForType), | 54 m_originRestriction(UseDefaultOriginRestrictionForType), |
| 61 m_placeholderImageRequestType( | 55 m_placeholderImageRequestType( |
| 62 PlaceholderImageRequestType::DisallowPlaceholder) { | 56 PlaceholderImageRequestType::DisallowPlaceholder) { |
| 63 m_options.initiatorInfo.name = initiator; | 57 m_options.initiatorInfo.name = initiator; |
| 64 } | 58 } |
| 65 | 59 |
| 66 FetchRequest::FetchRequest(const ResourceRequest& resourceRequest, | 60 FetchRequest::FetchRequest(const ResourceRequest& resourceRequest, |
| 67 const FetchInitiatorInfo& initiator) | 61 const FetchInitiatorInfo& initiator) |
| 68 : m_resourceRequest(resourceRequest), | 62 : m_resourceRequest(resourceRequest), |
| 69 m_options(ResourceFetcher::defaultResourceOptions()), | 63 m_options(ResourceFetcher::defaultResourceOptions()), |
| 70 m_speculativePreload(false), | |
| 71 m_linkPreload(false), | |
| 72 m_preloadDiscoveryTime(0.0), | |
| 73 m_defer(NoDefer), | 64 m_defer(NoDefer), |
| 74 m_originRestriction(UseDefaultOriginRestrictionForType), | 65 m_originRestriction(UseDefaultOriginRestrictionForType), |
| 75 m_placeholderImageRequestType( | 66 m_placeholderImageRequestType( |
| 76 PlaceholderImageRequestType::DisallowPlaceholder) { | 67 PlaceholderImageRequestType::DisallowPlaceholder) { |
| 77 m_options.initiatorInfo = initiator; | 68 m_options.initiatorInfo = initiator; |
| 78 } | 69 } |
| 79 | 70 |
| 80 FetchRequest::~FetchRequest() {} | 71 FetchRequest::~FetchRequest() {} |
| 81 | 72 |
| 82 void FetchRequest::setCrossOriginAccessControl( | 73 void FetchRequest::setCrossOriginAccessControl( |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 m_resourceRequest.setHTTPOrigin(origin); | 116 m_resourceRequest.setHTTPOrigin(origin); |
| 126 } | 117 } |
| 127 | 118 |
| 128 void FetchRequest::setResourceWidth(ResourceWidth resourceWidth) { | 119 void FetchRequest::setResourceWidth(ResourceWidth resourceWidth) { |
| 129 if (resourceWidth.isSet) { | 120 if (resourceWidth.isSet) { |
| 130 m_resourceWidth.width = resourceWidth.width; | 121 m_resourceWidth.width = resourceWidth.width; |
| 131 m_resourceWidth.isSet = true; | 122 m_resourceWidth.isSet = true; |
| 132 } | 123 } |
| 133 } | 124 } |
| 134 | 125 |
| 135 void FetchRequest::setSpeculativePreload(bool speculativePreload, | |
| 136 double discoveryTime) { | |
| 137 m_speculativePreload = speculativePreload; | |
| 138 m_preloadDiscoveryTime = discoveryTime; | |
| 139 } | |
| 140 | |
| 141 void FetchRequest::makeSynchronous() { | 126 void FetchRequest::makeSynchronous() { |
| 142 // Synchronous requests should always be max priority, lest they hang the | 127 // Synchronous requests should always be max priority, lest they hang the |
| 143 // renderer. | 128 // renderer. |
| 144 m_resourceRequest.setPriority(ResourceLoadPriorityHighest); | 129 m_resourceRequest.setPriority(ResourceLoadPriorityHighest); |
| 145 m_resourceRequest.setTimeoutInterval(10); | 130 m_resourceRequest.setTimeoutInterval(10); |
| 146 m_options.synchronousPolicy = RequestSynchronously; | 131 m_options.synchronousPolicy = RequestSynchronously; |
| 147 } | 132 } |
| 148 | 133 |
| 149 void FetchRequest::setAllowImagePlaceholder() { | 134 void FetchRequest::setAllowImagePlaceholder() { |
| 150 DCHECK_EQ(DisallowPlaceholder, m_placeholderImageRequestType); | 135 DCHECK_EQ(DisallowPlaceholder, m_placeholderImageRequestType); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 161 // the dimensions for larger images. | 146 // the dimensions for larger images. |
| 162 // TODO(sclittle): Calculate the optimal value for this number. | 147 // TODO(sclittle): Calculate the optimal value for this number. |
| 163 m_resourceRequest.setHTTPHeaderField("range", "bytes=0-2047"); | 148 m_resourceRequest.setHTTPHeaderField("range", "bytes=0-2047"); |
| 164 | 149 |
| 165 // TODO(sclittle): Indicate somehow (e.g. through a new request bit) to the | 150 // TODO(sclittle): Indicate somehow (e.g. through a new request bit) to the |
| 166 // embedder that it should return the full resource if the entire resource is | 151 // embedder that it should return the full resource if the entire resource is |
| 167 // fresh in the cache. | 152 // fresh in the cache. |
| 168 } | 153 } |
| 169 | 154 |
| 170 } // namespace blink | 155 } // namespace blink |
| OLD | NEW |