| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. |
| 3 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #include "config.h" | 27 #include "config.h" |
| 28 #include "platform/network/ResourceRequest.h" | 28 #include "platform/network/ResourceRequest.h" |
| 29 | 29 |
| 30 namespace WebCore { | 30 namespace WebCore { |
| 31 | 31 |
| 32 double ResourceRequest::s_defaultTimeoutInterval = INT_MAX; | 32 double ResourceRequest::s_defaultTimeoutInterval = INT_MAX; |
| 33 | 33 |
| 34 |
| 35 ResourceRequest ResourceRequest::createMainResourceRequest(const KURL& url, bool
isMainFrame) |
| 36 { |
| 37 ResourceRequest request = ResourceRequest(url); |
| 38 request.setTargetTypeForMainResource(isMainFrame); |
| 39 return request; |
| 40 } |
| 41 |
| 42 ResourceRequest ResourceRequest::createMainResourceRequest( |
| 43 const KURL& url, bool isMainFrame, const Referrer& referrer, |
| 44 ResourceRequestCachePolicy cachePolicy) |
| 45 { |
| 46 ResourceRequest request = ResourceRequest(url, referrer, cachePolicy); |
| 47 request.setTargetTypeForMainResource(isMainFrame); |
| 48 return request; |
| 49 } |
| 50 |
| 34 PassOwnPtr<ResourceRequest> ResourceRequest::adopt(PassOwnPtr<CrossThreadResourc
eRequestData> data) | 51 PassOwnPtr<ResourceRequest> ResourceRequest::adopt(PassOwnPtr<CrossThreadResourc
eRequestData> data) |
| 35 { | 52 { |
| 36 OwnPtr<ResourceRequest> request = adoptPtr(new ResourceRequest()); | 53 OwnPtr<ResourceRequest> request = adoptPtr(new ResourceRequest()); |
| 37 request->setURL(data->m_url); | 54 request->setURL(data->m_url); |
| 38 request->setCachePolicy(data->m_cachePolicy); | 55 request->setCachePolicy(data->m_cachePolicy); |
| 39 request->setTimeoutInterval(data->m_timeoutInterval); | 56 request->setTimeoutInterval(data->m_timeoutInterval); |
| 40 request->setFirstPartyForCookies(data->m_firstPartyForCookies); | 57 request->setFirstPartyForCookies(data->m_firstPartyForCookies); |
| 41 request->setHTTPMethod(AtomicString(data->m_httpMethod)); | 58 request->setHTTPMethod(AtomicString(data->m_httpMethod)); |
| 42 request->setPriority(data->m_priority, data->m_intraPriorityValue); | 59 request->setPriority(data->m_priority, data->m_intraPriorityValue); |
| 43 | 60 |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 DEFINE_STATIC_LOCAL(const AtomicString, cacheControlHeader, ("cache-control"
, AtomicString::ConstructFromLiteral)); | 330 DEFINE_STATIC_LOCAL(const AtomicString, cacheControlHeader, ("cache-control"
, AtomicString::ConstructFromLiteral)); |
| 314 return cacheControlHeader; | 331 return cacheControlHeader; |
| 315 } | 332 } |
| 316 | 333 |
| 317 static const AtomicString& pragmaHeaderString() | 334 static const AtomicString& pragmaHeaderString() |
| 318 { | 335 { |
| 319 DEFINE_STATIC_LOCAL(const AtomicString, pragmaHeader, ("pragma", AtomicStrin
g::ConstructFromLiteral)); | 336 DEFINE_STATIC_LOCAL(const AtomicString, pragmaHeader, ("pragma", AtomicStrin
g::ConstructFromLiteral)); |
| 320 return pragmaHeader; | 337 return pragmaHeader; |
| 321 } | 338 } |
| 322 | 339 |
| 340 void ResourceRequest::setTargetTypeForMainResource(bool isMainFrame) |
| 341 { |
| 342 m_targetType = isMainFrame ? TargetIsMainFrame : TargetIsSubframe; |
| 343 } |
| 344 |
| 323 const CacheControlHeader& ResourceRequest::cacheControlHeader() const | 345 const CacheControlHeader& ResourceRequest::cacheControlHeader() const |
| 324 { | 346 { |
| 325 if (!m_cacheControlHeaderCache.parsed) | 347 if (!m_cacheControlHeaderCache.parsed) |
| 326 m_cacheControlHeaderCache = parseCacheControlDirectives(m_httpHeaderFiel
ds.get(cacheControlHeaderString()), m_httpHeaderFields.get(pragmaHeaderString())
); | 348 m_cacheControlHeaderCache = parseCacheControlDirectives(m_httpHeaderFiel
ds.get(cacheControlHeaderString()), m_httpHeaderFields.get(pragmaHeaderString())
); |
| 327 return m_cacheControlHeaderCache; | 349 return m_cacheControlHeaderCache; |
| 328 } | 350 } |
| 329 | 351 |
| 330 bool ResourceRequest::cacheControlContainsNoCache() const | 352 bool ResourceRequest::cacheControlContainsNoCache() const |
| 331 { | 353 { |
| 332 return cacheControlHeader().containsNoCache; | 354 return cacheControlHeader().containsNoCache; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 // This is used by the loader to control the number of issued parallel load requ
ests. | 399 // This is used by the loader to control the number of issued parallel load requ
ests. |
| 378 unsigned initializeMaximumHTTPConnectionCountPerHost() | 400 unsigned initializeMaximumHTTPConnectionCountPerHost() |
| 379 { | 401 { |
| 380 // The chromium network stack already handles limiting the number of | 402 // The chromium network stack already handles limiting the number of |
| 381 // parallel requests per host, so there's no need to do it here. Therefore, | 403 // parallel requests per host, so there's no need to do it here. Therefore, |
| 382 // this is set to a high value that should never be hit in practice. | 404 // this is set to a high value that should never be hit in practice. |
| 383 return 10000; | 405 return 10000; |
| 384 } | 406 } |
| 385 | 407 |
| 386 } | 408 } |
| OLD | NEW |