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

Side by Side Diff: third_party/WebKit/Source/platform/network/HTTPParsers.cpp

Issue 1844223002: Literal AtomicString construction can rely on strlen optimization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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) 2006 Alexey Proskuryakov (ap@webkit.org) 2 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
3 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
4 * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 4 * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
5 * Copyright (C) 2009 Google Inc. All rights reserved. 5 * Copyright (C) 2009 Google Inc. All rights reserved.
6 * Copyright (C) 2011 Apple Inc. All Rights Reserved. 6 * Copyright (C) 2011 Apple Inc. All Rights Reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 } 633 }
634 } 634 }
635 635
636 CacheControlHeader parseCacheControlDirectives(const AtomicString& cacheControlV alue, const AtomicString& pragmaValue) 636 CacheControlHeader parseCacheControlDirectives(const AtomicString& cacheControlV alue, const AtomicString& pragmaValue)
637 { 637 {
638 CacheControlHeader cacheControlHeader; 638 CacheControlHeader cacheControlHeader;
639 cacheControlHeader.parsed = true; 639 cacheControlHeader.parsed = true;
640 cacheControlHeader.maxAge = std::numeric_limits<double>::quiet_NaN(); 640 cacheControlHeader.maxAge = std::numeric_limits<double>::quiet_NaN();
641 cacheControlHeader.staleWhileRevalidate = std::numeric_limits<double>::quiet _NaN(); 641 cacheControlHeader.staleWhileRevalidate = std::numeric_limits<double>::quiet _NaN();
642 642
643 DEFINE_STATIC_LOCAL(const AtomicString, noCacheDirective, ("no-cache", Atomi cString::ConstructFromLiteral)); 643 DEFINE_STATIC_LOCAL(const AtomicString, noCacheDirective, ("no-cache"));
644 DEFINE_STATIC_LOCAL(const AtomicString, noStoreDirective, ("no-store", Atomi cString::ConstructFromLiteral)); 644 DEFINE_STATIC_LOCAL(const AtomicString, noStoreDirective, ("no-store"));
645 DEFINE_STATIC_LOCAL(const AtomicString, mustRevalidateDirective, ("must-reva lidate", AtomicString::ConstructFromLiteral)); 645 DEFINE_STATIC_LOCAL(const AtomicString, mustRevalidateDirective, ("must-reva lidate"));
646 DEFINE_STATIC_LOCAL(const AtomicString, maxAgeDirective, ("max-age", AtomicS tring::ConstructFromLiteral)); 646 DEFINE_STATIC_LOCAL(const AtomicString, maxAgeDirective, ("max-age"));
647 DEFINE_STATIC_LOCAL(const AtomicString, staleWhileRevalidateDirective, ("sta le-while-revalidate", AtomicString::ConstructFromLiteral)); 647 DEFINE_STATIC_LOCAL(const AtomicString, staleWhileRevalidateDirective, ("sta le-while-revalidate"));
648 648
649 if (!cacheControlValue.isEmpty()) { 649 if (!cacheControlValue.isEmpty()) {
650 Vector<std::pair<String, String>> directives; 650 Vector<std::pair<String, String>> directives;
651 parseCacheHeader(cacheControlValue, directives); 651 parseCacheHeader(cacheControlValue, directives);
652 652
653 size_t directivesSize = directives.size(); 653 size_t directivesSize = directives.size();
654 for (size_t i = 0; i < directivesSize; ++i) { 654 for (size_t i = 0; i < directivesSize; ++i) {
655 // RFC2616 14.9.1: A no-cache directive with a value is only meaning ful for proxy caches. 655 // RFC2616 14.9.1: A no-cache directive with a value is only meaning ful for proxy caches.
656 // It should be ignored by a browser level cache. 656 // It should be ignored by a browser level cache.
657 if (equalIgnoringCase(directives[i].first, noCacheDirective) && dire ctives[i].second.isEmpty()) { 657 if (equalIgnoringCase(directives[i].first, noCacheDirective) && dire ctives[i].second.isEmpty()) {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 return false; 749 return false;
750 } 750 }
751 751
752 position++; 752 position++;
753 } 753 }
754 754
755 return true; 755 return true;
756 } 756 }
757 757
758 } // namespace blink 758 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698