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

Side by Side Diff: third_party/WebKit/Source/core/loader/LinkLoader.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: ASSERT_UNUSED 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) 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 , m_linkLoadingErrorTimer(this, &LinkLoader::linkLoadingErrorTimerFired) 77 , m_linkLoadingErrorTimer(this, &LinkLoader::linkLoadingErrorTimerFired)
78 { 78 {
79 } 79 }
80 80
81 LinkLoader::~LinkLoader() 81 LinkLoader::~LinkLoader()
82 { 82 {
83 } 83 }
84 84
85 void LinkLoader::linkLoadTimerFired(TimerBase* timer) 85 void LinkLoader::linkLoadTimerFired(TimerBase* timer)
86 { 86 {
87 ASSERT_UNUSED(timer, timer == &m_linkLoadTimer); 87 ALLOW_UNUSED_LOCAL(timer);
yhirano 2016/09/12 04:33:14 ditto as Resource::cancelTimerFired.
hiroshige 2016/09/13 08:43:21 Done.
88 DCHECK(timer == &m_linkLoadTimer);
yhirano 2016/09/12 04:33:13 DCHECK_EQ
hiroshige 2016/09/13 08:43:21 Done.
88 m_client->linkLoaded(); 89 m_client->linkLoaded();
89 } 90 }
90 91
91 void LinkLoader::linkLoadingErrorTimerFired(TimerBase* timer) 92 void LinkLoader::linkLoadingErrorTimerFired(TimerBase* timer)
92 { 93 {
93 ASSERT_UNUSED(timer, timer == &m_linkLoadingErrorTimer); 94 ALLOW_UNUSED_LOCAL(timer);
yhirano 2016/09/12 04:33:13 ditto as Resource::cancelTimerFired.
hiroshige 2016/09/13 08:43:21 Done.
95 DCHECK(timer == &m_linkLoadingErrorTimer);
yhirano 2016/09/12 04:33:13 DCHECK_EQ
hiroshige 2016/09/13 08:43:21 Done.
94 m_client->linkLoadingErrored(); 96 m_client->linkLoadingErrored();
95 } 97 }
96 98
97 void LinkLoader::triggerEvents(const Resource* resource) 99 void LinkLoader::triggerEvents(const Resource* resource)
98 { 100 {
99 if (resource->errorOccurred()) 101 if (resource->errorOccurred())
100 m_linkLoadingErrorTimer.startOneShot(0, BLINK_FROM_HERE); 102 m_linkLoadingErrorTimer.startOneShot(0, BLINK_FROM_HERE);
101 else 103 else
102 m_linkLoadTimer.startOneShot(0, BLINK_FROM_HERE); 104 m_linkLoadTimer.startOneShot(0, BLINK_FROM_HERE);
103 } 105 }
104 106
105 void LinkLoader::notifyFinished(Resource* resource) 107 void LinkLoader::notifyFinished(Resource* resource)
106 { 108 {
107 ASSERT(this->resource() == resource); 109 DCHECK(this->resource() == resource);
yhirano 2016/09/12 04:33:13 DCHECK_EQ
hiroshige 2016/09/13 08:43:21 Done.
108 110
109 triggerEvents(resource); 111 triggerEvents(resource);
110 clearResource(); 112 clearResource();
111 } 113 }
112 114
113 void LinkLoader::didStartPrerender() 115 void LinkLoader::didStartPrerender()
114 { 116 {
115 m_client->didStartLinkPrerender(); 117 m_client->didStartLinkPrerender();
116 } 118 }
117 119
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 document.addConsoleMessage(ConsoleMessage::create(OtherMessageSo urce, DebugMessageLevel, 168 document.addConsoleMessage(ConsoleMessage::create(OtherMessageSo urce, DebugMessageLevel,
167 String("Preconnect CORS setting is ") + String((crossOrigin == CrossOriginAttributeAnonymous) ? "anonymous" : "use-credentials"))); 169 String("Preconnect CORS setting is ") + String((crossOrigin == CrossOriginAttributeAnonymous) ? "anonymous" : "use-credentials")));
168 } 170 }
169 } 171 }
170 networkHintsInterface.preconnectHost(href, crossOrigin); 172 networkHintsInterface.preconnectHost(href, crossOrigin);
171 } 173 }
172 } 174 }
173 175
174 bool LinkLoader::getResourceTypeFromAsAttribute(const String& as, Resource::Type & type) 176 bool LinkLoader::getResourceTypeFromAsAttribute(const String& as, Resource::Type & type)
175 { 177 {
176 ASSERT(as.lower() == as); 178 DCHECK(as.lower() == as);
yhirano 2016/09/12 04:33:13 DCHECK_EQ
hiroshige 2016/09/13 08:43:21 Done.
177 if (as == "image") { 179 if (as == "image") {
178 type = Resource::Image; 180 type = Resource::Image;
179 } else if (as == "script") { 181 } else if (as == "script") {
180 type = Resource::Script; 182 type = Resource::Script;
181 } else if (as == "style") { 183 } else if (as == "style") {
182 type = Resource::CSSStyleSheet; 184 type = Resource::CSSStyleSheet;
183 } else if (as == "media") { 185 } else if (as == "media") {
184 type = Resource::Media; 186 type = Resource::Media;
185 } else if (as == "font") { 187 } else if (as == "font") {
186 type = Resource::Font; 188 type = Resource::Font;
(...skipping 23 matching lines...) Expand all
210 break; 212 break;
211 case Resource::Font: 213 case Resource::Font:
212 m_linkPreloadResourceClient = LinkPreloadFontResourceClient::create(this , toFontResource(resource)); 214 m_linkPreloadResourceClient = LinkPreloadFontResourceClient::create(this , toFontResource(resource));
213 break; 215 break;
214 case Resource::Media: 216 case Resource::Media:
215 case Resource::TextTrack: 217 case Resource::TextTrack:
216 case Resource::Raw: 218 case Resource::Raw:
217 m_linkPreloadResourceClient = LinkPreloadRawResourceClient::create(this, toRawResource(resource)); 219 m_linkPreloadResourceClient = LinkPreloadRawResourceClient::create(this, toRawResource(resource));
218 break; 220 break;
219 default: 221 default:
220 ASSERT_NOT_REACHED(); 222 NOTREACHED();
221 } 223 }
222 } 224 }
223 225
224 static bool isSupportedType(Resource::Type resourceType, const String& mimeType) 226 static bool isSupportedType(Resource::Type resourceType, const String& mimeType)
225 { 227 {
226 if (mimeType.isEmpty()) 228 if (mimeType.isEmpty())
227 return true; 229 return true;
228 switch (resourceType) { 230 switch (resourceType) {
229 case Resource::Image: 231 case Resource::Image:
230 return MIMETypeRegistry::isSupportedImagePrefixedMIMEType(mimeType); 232 return MIMETypeRegistry::isSupportedImagePrefixedMIMEType(mimeType);
231 case Resource::Script: 233 case Resource::Script:
232 return MIMETypeRegistry::isSupportedJavaScriptMIMEType(mimeType); 234 return MIMETypeRegistry::isSupportedJavaScriptMIMEType(mimeType);
233 case Resource::CSSStyleSheet: 235 case Resource::CSSStyleSheet:
234 return MIMETypeRegistry::isSupportedStyleSheetMIMEType(mimeType); 236 return MIMETypeRegistry::isSupportedStyleSheetMIMEType(mimeType);
235 case Resource::Font: 237 case Resource::Font:
236 return MIMETypeRegistry::isSupportedFontMIMEType(mimeType); 238 return MIMETypeRegistry::isSupportedFontMIMEType(mimeType);
237 case Resource::Media: 239 case Resource::Media:
238 return MIMETypeRegistry::isSupportedMediaSourceMIMEType(mimeType, String ()); 240 return MIMETypeRegistry::isSupportedMediaSourceMIMEType(mimeType, String ());
239 case Resource::TextTrack: 241 case Resource::TextTrack:
240 return MIMETypeRegistry::isSupportedTextTrackMIMEType(mimeType); 242 return MIMETypeRegistry::isSupportedTextTrackMIMEType(mimeType);
241 case Resource::Raw: 243 case Resource::Raw:
242 return true; 244 return true;
243 default: 245 default:
244 ASSERT_NOT_REACHED(); 246 NOTREACHED();
245 } 247 }
246 return false; 248 return false;
247 } 249 }
248 250
249 static Resource* preloadIfNeeded(const LinkRelAttribute& relAttribute, const KUR L& href, Document& document, const String& as, const String& mimeType, 251 static Resource* preloadIfNeeded(const LinkRelAttribute& relAttribute, const KUR L& href, Document& document, const String& as, const String& mimeType,
250 const String& media, CrossOriginAttributeValue crossOrigin, LinkCaller calle r, bool& errorOccurred, ViewportDescription* viewportDescription) 252 const String& media, CrossOriginAttributeValue crossOrigin, LinkCaller calle r, bool& errorOccurred, ViewportDescription* viewportDescription)
251 { 253 {
252 if (!document.loader() || !relAttribute.isLinkPreload()) 254 if (!document.loader() || !relAttribute.isLinkPreload())
253 return nullptr; 255 return nullptr;
254 256
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 DEFINE_TRACE(LinkLoader) 394 DEFINE_TRACE(LinkLoader)
393 { 395 {
394 visitor->trace(m_client); 396 visitor->trace(m_client);
395 visitor->trace(m_prerender); 397 visitor->trace(m_prerender);
396 visitor->trace(m_linkPreloadResourceClient); 398 visitor->trace(m_linkPreloadResourceClient);
397 ResourceOwner<Resource, ResourceClient>::trace(visitor); 399 ResourceOwner<Resource, ResourceClient>::trace(visitor);
398 PrerenderClient::trace(visitor); 400 PrerenderClient::trace(visitor);
399 } 401 }
400 402
401 } // namespace blink 403 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698