| 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) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
rights reserved. | 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
rights reserved. |
| 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ | 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ |
| 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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 ASSERT(memoryCache()->contains(resource)); | 533 ASSERT(memoryCache()->contains(resource)); |
| 534 ASSERT(resource->isLoaded()); | 534 ASSERT(resource->isLoaded()); |
| 535 ASSERT(resource->canUseCacheValidator()); | 535 ASSERT(resource->canUseCacheValidator()); |
| 536 ASSERT(!resource->isCacheValidator()); | 536 ASSERT(!resource->isCacheValidator()); |
| 537 ASSERT(!context().isControlledByServiceWorker()); | 537 ASSERT(!context().isControlledByServiceWorker()); |
| 538 | 538 |
| 539 ResourceRequest revalidatingRequest(resource->resourceRequest()); | 539 ResourceRequest revalidatingRequest(resource->resourceRequest()); |
| 540 revalidatingRequest.clearHTTPReferrer(); | 540 revalidatingRequest.clearHTTPReferrer(); |
| 541 initializeResourceRequest(revalidatingRequest, resource->getType(), request.
defer()); | 541 initializeResourceRequest(revalidatingRequest, resource->getType(), request.
defer()); |
| 542 | 542 |
| 543 const AtomicString& lastModified = resource->response().httpHeaderField(HTTP
Names::Last_Modified); | 543 // TODO(toyoshim): Figure out if following code is really needed and |
| 544 const AtomicString& eTag = resource->response().httpHeaderField(HTTPNames::E
Tag); | 544 // how this code works with Stale-While-Revalidate field trial. |
| 545 if (!lastModified.isEmpty() || !eTag.isEmpty()) { | |
| 546 ASSERT(context().getCachePolicy() != CachePolicyReload); | |
| 547 if (context().getCachePolicy() == CachePolicyRevalidate) | |
| 548 revalidatingRequest.setHTTPHeaderField(HTTPNames::Cache_Control, "ma
x-age=0"); | |
| 549 } | |
| 550 if (!lastModified.isEmpty()) | |
| 551 revalidatingRequest.setHTTPHeaderField(HTTPNames::If_Modified_Since, las
tModified); | |
| 552 if (!eTag.isEmpty()) | |
| 553 revalidatingRequest.setHTTPHeaderField(HTTPNames::If_None_Match, eTag); | |
| 554 | |
| 555 double stalenessLifetime = resource->stalenessLifetime(); | 545 double stalenessLifetime = resource->stalenessLifetime(); |
| 556 if (std::isfinite(stalenessLifetime) && stalenessLifetime > 0) { | 546 if (std::isfinite(stalenessLifetime) && stalenessLifetime > 0) { |
| 557 revalidatingRequest.setHTTPHeaderField(HTTPNames::Resource_Freshness, At
omicString(String::format("max-age=%.0lf,stale-while-revalidate=%.0lf,age=%.0lf"
, resource->freshnessLifetime(), stalenessLifetime, resource->currentAge()))); | 547 revalidatingRequest.setHTTPHeaderField(HTTPNames::Resource_Freshness, At
omicString(String::format("max-age=%.0lf,stale-while-revalidate=%.0lf,age=%.0lf"
, resource->freshnessLifetime(), stalenessLifetime, resource->currentAge()))); |
| 558 } | 548 } |
| 559 | 549 |
| 560 resource->setRevalidatingRequest(revalidatingRequest); | 550 resource->setRevalidatingRequest(revalidatingRequest); |
| 561 } | 551 } |
| 562 | 552 |
| 563 Resource* ResourceFetcher::createResourceForLoading(FetchRequest& request, const
String& charset, const ResourceFactory& factory) | 553 Resource* ResourceFetcher::createResourceForLoading(FetchRequest& request, const
String& charset, const ResourceFactory& factory) |
| 564 { | 554 { |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 visitor->trace(m_context); | 1213 visitor->trace(m_context); |
| 1224 visitor->trace(m_archive); | 1214 visitor->trace(m_archive); |
| 1225 visitor->trace(m_loaders); | 1215 visitor->trace(m_loaders); |
| 1226 visitor->trace(m_nonBlockingLoaders); | 1216 visitor->trace(m_nonBlockingLoaders); |
| 1227 visitor->trace(m_documentResources); | 1217 visitor->trace(m_documentResources); |
| 1228 visitor->trace(m_preloads); | 1218 visitor->trace(m_preloads); |
| 1229 visitor->trace(m_resourceTimingInfoMap); | 1219 visitor->trace(m_resourceTimingInfoMap); |
| 1230 } | 1220 } |
| 1231 | 1221 |
| 1232 } // namespace blink | 1222 } // namespace blink |
| OLD | NEW |