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

Side by Side Diff: third_party/WebKit/Source/core/fetch/RawResource.cpp

Issue 2142513003: Use initializer_lists for static WTF::HashSets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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) 2011 Google Inc. All Rights Reserved. 2 * Copyright (C) 2011 Google Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 198
199 void RawResource::setDefersLoading(bool defers) 199 void RawResource::setDefersLoading(bool defers)
200 { 200 {
201 if (m_loader) 201 if (m_loader)
202 m_loader->setDefersLoading(defers); 202 m_loader->setDefersLoading(defers);
203 } 203 }
204 204
205 static bool shouldIgnoreHeaderForCacheReuse(AtomicString headerName) 205 static bool shouldIgnoreHeaderForCacheReuse(AtomicString headerName)
206 { 206 {
207 // FIXME: This list of headers that don't affect cache policy almost certain ly isn't complete. 207 // FIXME: This list of headers that don't affect cache policy almost certain ly isn't complete.
208 DEFINE_STATIC_LOCAL(HashSet<AtomicString>, m_headers, ()); 208 DEFINE_STATIC_LOCAL(HashSet<AtomicString>, headers, ({
209 if (m_headers.isEmpty()) { 209 "Cache-Control",
210 m_headers.add("Cache-Control"); 210 "If-Modified-Since",
211 m_headers.add("If-Modified-Since"); 211 "If-None-Match",
212 m_headers.add("If-None-Match"); 212 "Origin",
213 m_headers.add("Origin"); 213 "Pragma",
214 m_headers.add("Pragma"); 214 "Purpose",
215 m_headers.add("Purpose"); 215 "Referer",
216 m_headers.add("Referer"); 216 "User-Agent",
217 m_headers.add("User-Agent"); 217 HTTPNames::X_DevTools_Emulate_Network_Conditions_Client_Id,
218 m_headers.add(HTTPNames::X_DevTools_Emulate_Network_Conditions_Client_Id ); 218 }));
219 } 219 return headers.contains(headerName);
220 return m_headers.contains(headerName);
221 } 220 }
222 221
223 static bool isCacheableHTTPMethod(const AtomicString& method) 222 static bool isCacheableHTTPMethod(const AtomicString& method)
224 { 223 {
225 // Per http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.10, 224 // Per http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.10,
226 // these methods always invalidate the cache entry. 225 // these methods always invalidate the cache entry.
227 return method != "POST" && method != "PUT" && method != "DELETE"; 226 return method != "POST" && method != "PUT" && method != "DELETE";
228 } 227 }
229 228
230 bool RawResource::canReuse(const ResourceRequest& newRequest) const 229 bool RawResource::canReuse(const ResourceRequest& newRequest) const
(...skipping 28 matching lines...) Expand all
259 for (const auto& header : oldHeaders) { 258 for (const auto& header : oldHeaders) {
260 AtomicString headerName = header.key; 259 AtomicString headerName = header.key;
261 if (!shouldIgnoreHeaderForCacheReuse(headerName) && header.value != newH eaders.get(headerName)) 260 if (!shouldIgnoreHeaderForCacheReuse(headerName) && header.value != newH eaders.get(headerName))
262 return false; 261 return false;
263 } 262 }
264 263
265 return true; 264 return true;
266 } 265 }
267 266
268 } // namespace blink 267 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/FetchUtils.cpp ('k') | third_party/WebKit/Source/core/html/RelList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698