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

Side by Side Diff: third_party/WebKit/Source/core/loader/CrossOriginPreflightResultCache.cpp

Issue 2327643003: Replace ASSERT*() with DCHECK*() in core/fetch/ and core/loader/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 3 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) 2008, 2009 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008, 2009 Apple 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 if (!allowsCrossOriginMethod(method, ignoredExplanation)) 141 if (!allowsCrossOriginMethod(method, ignoredExplanation))
142 return false; 142 return false;
143 if (!allowsCrossOriginHeaders(requestHeaders, ignoredExplanation)) 143 if (!allowsCrossOriginHeaders(requestHeaders, ignoredExplanation))
144 return false; 144 return false;
145 return true; 145 return true;
146 } 146 }
147 147
148 CrossOriginPreflightResultCache& CrossOriginPreflightResultCache::shared() 148 CrossOriginPreflightResultCache& CrossOriginPreflightResultCache::shared()
149 { 149 {
150 DEFINE_STATIC_LOCAL(CrossOriginPreflightResultCache, cache, ()); 150 DEFINE_STATIC_LOCAL(CrossOriginPreflightResultCache, cache, ());
151 ASSERT(isMainThread()); 151 DCHECK(isMainThread());
152 return cache; 152 return cache;
153 } 153 }
154 154
155 void CrossOriginPreflightResultCache::appendEntry(const String& origin, const KU RL& url, std::unique_ptr<CrossOriginPreflightResultCacheItem> preflightResult) 155 void CrossOriginPreflightResultCache::appendEntry(const String& origin, const KU RL& url, std::unique_ptr<CrossOriginPreflightResultCacheItem> preflightResult)
156 { 156 {
157 ASSERT(isMainThread()); 157 DCHECK(isMainThread());
158 m_preflightHashMap.set(std::make_pair(origin, url), std::move(preflightResul t)); 158 m_preflightHashMap.set(std::make_pair(origin, url), std::move(preflightResul t));
159 } 159 }
160 160
161 bool CrossOriginPreflightResultCache::canSkipPreflight(const String& origin, con st KURL& url, StoredCredentials includeCredentials, const String& method, const HTTPHeaderMap& requestHeaders) 161 bool CrossOriginPreflightResultCache::canSkipPreflight(const String& origin, con st KURL& url, StoredCredentials includeCredentials, const String& method, const HTTPHeaderMap& requestHeaders)
162 { 162 {
163 ASSERT(isMainThread()); 163 DCHECK(isMainThread());
164 CrossOriginPreflightResultHashMap::iterator cacheIt = m_preflightHashMap.fin d(std::make_pair(origin, url)); 164 CrossOriginPreflightResultHashMap::iterator cacheIt = m_preflightHashMap.fin d(std::make_pair(origin, url));
165 if (cacheIt == m_preflightHashMap.end()) 165 if (cacheIt == m_preflightHashMap.end())
166 return false; 166 return false;
167 167
168 if (cacheIt->value->allowsRequest(includeCredentials, method, requestHeaders )) 168 if (cacheIt->value->allowsRequest(includeCredentials, method, requestHeaders ))
169 return true; 169 return true;
170 170
171 m_preflightHashMap.remove(cacheIt); 171 m_preflightHashMap.remove(cacheIt);
172 return false; 172 return false;
173 } 173 }
174 174
175 } // namespace blink 175 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698