Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp

Issue 2767853003: Remove stale-while-revalidate from blink (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 rights reserved. 6 rights reserved.
7 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 7 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
8 8
9 This library is free software; you can redistribute it and/or 9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public 10 modify it under the terms of the GNU Library General Public
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 "max-age=0"); 692 "max-age=0");
693 } 693 }
694 } 694 }
695 if (!lastModified.isEmpty()) { 695 if (!lastModified.isEmpty()) {
696 revalidatingRequest.setHTTPHeaderField(HTTPNames::If_Modified_Since, 696 revalidatingRequest.setHTTPHeaderField(HTTPNames::If_Modified_Since,
697 lastModified); 697 lastModified);
698 } 698 }
699 if (!eTag.isEmpty()) 699 if (!eTag.isEmpty())
700 revalidatingRequest.setHTTPHeaderField(HTTPNames::If_None_Match, eTag); 700 revalidatingRequest.setHTTPHeaderField(HTTPNames::If_None_Match, eTag);
701 701
702 double stalenessLifetime = resource->stalenessLifetime();
703 if (std::isfinite(stalenessLifetime) && stalenessLifetime > 0) {
704 revalidatingRequest.setHTTPHeaderField(
705 HTTPNames::Resource_Freshness,
706 AtomicString(String::format(
707 "max-age=%.0lf,stale-while-revalidate=%.0lf,age=%.0lf",
708 resource->freshnessLifetime(), stalenessLifetime,
709 resource->currentAge())));
710 }
711
712 resource->setRevalidatingRequest(revalidatingRequest); 702 resource->setRevalidatingRequest(revalidatingRequest);
713 } 703 }
714 704
715 Resource* ResourceFetcher::createResourceForLoading( 705 Resource* ResourceFetcher::createResourceForLoading(
716 FetchRequest& request, 706 FetchRequest& request,
717 const String& charset, 707 const String& charset,
718 const ResourceFactory& factory) { 708 const ResourceFactory& factory) {
719 const String cacheIdentifier = getCacheIdentifier(); 709 const String cacheIdentifier = getCacheIdentifier();
720 DCHECK(!memoryCache()->resourceForURL(request.resourceRequest().url(), 710 DCHECK(!memoryCache()->resourceForURL(request.resourceRequest().url(),
721 cacheIdentifier)); 711 cacheIdentifier));
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
1553 visitor->trace(m_context); 1543 visitor->trace(m_context);
1554 visitor->trace(m_archive); 1544 visitor->trace(m_archive);
1555 visitor->trace(m_loaders); 1545 visitor->trace(m_loaders);
1556 visitor->trace(m_nonBlockingLoaders); 1546 visitor->trace(m_nonBlockingLoaders);
1557 visitor->trace(m_documentResources); 1547 visitor->trace(m_documentResources);
1558 visitor->trace(m_preloads); 1548 visitor->trace(m_preloads);
1559 visitor->trace(m_resourceTimingInfoMap); 1549 visitor->trace(m_resourceTimingInfoMap);
1560 } 1550 }
1561 1551
1562 } // namespace blink 1552 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698