OLD | NEW |
---|---|
1 /* | 1 /* |
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) |
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) | 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) |
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) | 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) |
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. | 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. |
7 | 7 |
8 This library is free software; you can redistribute it and/or | 8 This library is free software; you can redistribute it and/or |
9 modify it under the terms of the GNU Library General Public | 9 modify it under the terms of the GNU Library General Public |
10 License as published by the Free Software Foundation; either | 10 License as published by the Free Software Foundation; either |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
194 DEFINE_TRACE(Resource) | 194 DEFINE_TRACE(Resource) |
195 { | 195 { |
196 visitor->trace(m_loader); | 196 visitor->trace(m_loader); |
197 #if ENABLE(OILPAN) | 197 #if ENABLE(OILPAN) |
198 visitor->trace(m_cacheHandler); | 198 visitor->trace(m_cacheHandler); |
199 #endif | 199 #endif |
200 } | 200 } |
201 | 201 |
202 void Resource::load(ResourceFetcher* fetcher, const ResourceLoaderOptions& optio ns) | 202 void Resource::load(ResourceFetcher* fetcher, const ResourceLoaderOptions& optio ns) |
203 { | 203 { |
204 RELEASE_ASSERT(m_options.synchronousPolicy == RequestSynchronously || !m_loa der); | |
204 m_options = options; | 205 m_options = options; |
205 m_loading = true; | 206 m_loading = true; |
207 m_status = Pending; | |
206 | 208 |
207 ResourceRequest request(m_revalidatingRequest.isNull() ? m_resourceRequest : m_revalidatingRequest); | 209 ResourceRequest& request(m_revalidatingRequest.isNull() ? |
210 (m_redirectChain.size() ? m_redirectChain.last().m_request : m_resourceR equest) : | |
hiroshige
2016/03/09 02:01:55
this can be lastResourceRequest().
Nate Chapin
2016/03/09 22:35:54
Removed the codepath that chould lead to a non-nul
| |
211 m_revalidatingRequest); | |
212 | |
208 if (!accept().isEmpty()) | 213 if (!accept().isEmpty()) |
209 request.setHTTPAccept(accept()); | 214 request.setHTTPAccept(accept()); |
210 | 215 |
211 // FIXME: It's unfortunate that the cache layer and below get to know anythi ng about fragment identifiers. | 216 // FIXME: It's unfortunate that the cache layer and below get to know anythi ng about fragment identifiers. |
212 // We should look into removing the expectation of that knowledge from the p latform network stacks. | 217 // We should look into removing the expectation of that knowledge from the p latform network stacks. |
218 KURL urlWithoutFragment = request.url(); | |
213 if (!m_fragmentIdentifierForRequest.isNull()) { | 219 if (!m_fragmentIdentifierForRequest.isNull()) { |
214 KURL url = request.url(); | 220 KURL url = request.url(); |
215 url.setFragmentIdentifier(m_fragmentIdentifierForRequest); | 221 url.setFragmentIdentifier(m_fragmentIdentifierForRequest); |
216 request.setURL(url); | 222 request.setURL(url); |
217 m_fragmentIdentifierForRequest = String(); | 223 m_fragmentIdentifierForRequest = String(); |
218 } | 224 } |
219 m_status = Pending; | 225 |
hiroshige
2016/03/09 02:01:56
Should we do |if (m_loader) m_loader->cancel();|,
Nate Chapin
2016/03/09 22:35:54
I changed ResourceFetcher to not attempt reuse of
| |
220 if (m_loader) { | 226 m_loader = ResourceLoader::create(fetcher, this); |
221 ASSERT(m_revalidatingRequest.isNull()); | 227 m_loader->start(request); |
222 RELEASE_ASSERT(m_options.synchronousPolicy == RequestSynchronously); | 228 // If the request reference is null (i.e., a synchronous revalidation will |
223 m_loader->changeToSynchronous(); | 229 // null the request), don't make the request non-null by settingr the url. |
Nate Chapin
2016/03/09 00:38:20
I don't remember why I originally chose to do it t
|
hiroshige
2016/03/09 02:01:55
nit: s/settingr/setting/.
Nate Chapin
2016/03/09 22:35:54
Done.
|
224 return; | 230 if (!request.isNull()) |
225 } | 231 request.setURL(urlWithoutFragment); |
226 m_loader = ResourceLoader::create(fetcher, this, request, options); | |
227 m_loader->start(); | |
228 } | 232 } |
229 | 233 |
230 void Resource::checkNotify() | 234 void Resource::checkNotify() |
231 { | 235 { |
232 if (isLoading()) | 236 if (isLoading()) |
233 return; | 237 return; |
234 | 238 |
235 ResourceClientWalker<ResourceClient> w(m_clients); | 239 ResourceClientWalker<ResourceClient> w(m_clients); |
236 while (ResourceClient* c = w.next()) | 240 while (ResourceClient* c = w.next()) |
237 c->notifyFinished(this); | 241 c->notifyFinished(this); |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
828 } | 832 } |
829 | 833 |
830 m_resourceRequest = m_revalidatingRequest; | 834 m_resourceRequest = m_revalidatingRequest; |
831 m_revalidatingRequest = ResourceRequest(); | 835 m_revalidatingRequest = ResourceRequest(); |
832 } | 836 } |
833 | 837 |
834 void Resource::revalidationFailed() | 838 void Resource::revalidationFailed() |
835 { | 839 { |
836 m_resourceRequest = m_revalidatingRequest; | 840 m_resourceRequest = m_revalidatingRequest; |
837 m_revalidatingRequest = ResourceRequest(); | 841 m_revalidatingRequest = ResourceRequest(); |
842 m_redirectChain.clear(); | |
Nate Chapin
2016/03/09 00:38:20
If we're going to reuse a partial redirect chain,
| |
838 m_data.clear(); | 843 m_data.clear(); |
839 m_cachedMetadata.clear(); | 844 m_cachedMetadata.clear(); |
840 destroyDecodedDataForFailedRevalidation(); | 845 destroyDecodedDataForFailedRevalidation(); |
841 } | 846 } |
842 | 847 |
843 bool Resource::canReuseRedirectChain() | 848 bool Resource::canReuseRedirectChain() |
844 { | 849 { |
845 for (auto& redirect : m_redirectChain) { | 850 for (auto& redirect : m_redirectChain) { |
846 if (!canUseResponse(redirect.m_redirectResponse, m_responseTimestamp)) | 851 if (!canUseResponse(redirect.m_redirectResponse, m_responseTimestamp)) |
847 return false; | 852 return false; |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1101 case Resource::Media: | 1106 case Resource::Media: |
1102 return "Media"; | 1107 return "Media"; |
1103 case Resource::Manifest: | 1108 case Resource::Manifest: |
1104 return "Manifest"; | 1109 return "Manifest"; |
1105 } | 1110 } |
1106 ASSERT_NOT_REACHED(); | 1111 ASSERT_NOT_REACHED(); |
1107 return "Unknown"; | 1112 return "Unknown"; |
1108 } | 1113 } |
1109 | 1114 |
1110 } // namespace blink | 1115 } // namespace blink |
OLD | NEW |