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

Side by Side Diff: third_party/WebKit/Source/modules/cachestorage/Cache.cpp

Issue 2787003002: Fetch API: Stop lowercasing header names. (Closed)
Patch Set: Rebase for landing Created 3 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/cachestorage/Cache.h" 5 #include "modules/cachestorage/Cache.h"
6 6
7 #include "bindings/core/v8/CallbackPromiseAdapter.h" 7 #include "bindings/core/v8/CallbackPromiseAdapter.h"
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "bindings/core/v8/ScriptState.h" 10 #include "bindings/core/v8/ScriptState.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 } 198 }
199 DEFINE_THREAD_SAFE_STATIC_LOCAL( 199 DEFINE_THREAD_SAFE_STATIC_LOCAL(
200 EnumerationHistogram, response_type_histogram, 200 EnumerationHistogram, response_type_histogram,
201 new EnumerationHistogram("ServiceWorkerCache.Cache.AddResponseType", 201 new EnumerationHistogram("ServiceWorkerCache.Cache.AddResponseType",
202 static_cast<int>(ResponseType::kEnumMax))); 202 static_cast<int>(ResponseType::kEnumMax)));
203 response_type_histogram.Count(static_cast<int>(type)); 203 response_type_histogram.Count(static_cast<int>(type));
204 }; 204 };
205 205
206 bool VaryHeaderContainsAsterisk(const Response* response) { 206 bool VaryHeaderContainsAsterisk(const Response* response) {
207 const FetchHeaderList* headers = response->headers()->HeaderList(); 207 const FetchHeaderList* headers = response->headers()->HeaderList();
208 for (size_t i = 0; i < headers->size(); ++i) { 208 String varyHeader;
209 const FetchHeaderList::Header& header = headers->Entry(i); 209 if (headers->Get("vary", varyHeader)) {
210 if (header.first == "vary") { 210 Vector<String> fields;
211 Vector<String> fields; 211 varyHeader.Split(',', fields);
212 header.second.Split(',', fields); 212 return std::any_of(fields.begin(), fields.end(), [](const String& field) {
213 for (size_t j = 0; j < fields.size(); ++j) { 213 return field.StripWhiteSpace() == "*";
214 if (fields[j].StripWhiteSpace() == "*") 214 });
215 return true;
216 }
217 }
218 } 215 }
219 return false; 216 return false;
220 } 217 }
221 218
222 } // namespace 219 } // namespace
223 220
224 // TODO(nhiroki): Unfortunately, we have to go through V8 to wait for the fetch 221 // TODO(nhiroki): Unfortunately, we have to go through V8 to wait for the fetch
225 // promise. It should be better to achieve this only within C++ world. 222 // promise. It should be better to achieve this only within C++ world.
226 class Cache::FetchResolvedForAdd final : public ScriptFunction { 223 class Cache::FetchResolvedForAdd final : public ScriptFunction {
227 public: 224 public:
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 WTF::MakeUnique<CacheWithRequestsCallbacks>(resolver), web_request, 698 WTF::MakeUnique<CacheWithRequestsCallbacks>(resolver), web_request,
702 ToWebQueryParams(options)); 699 ToWebQueryParams(options));
703 return promise; 700 return promise;
704 } 701 }
705 702
706 WebServiceWorkerCache* Cache::WebCache() const { 703 WebServiceWorkerCache* Cache::WebCache() const {
707 return web_cache_.get(); 704 return web_cache_.get();
708 } 705 }
709 706
710 } // namespace blink 707 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/BUILD.gn ('k') | third_party/WebKit/Source/modules/fetch/FetchHeaderList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698