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

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

Issue 2742933002: Refactor determineRequestContext() to remove a mutableResourceRequest() call (Closed)
Patch Set: Created 3 years, 9 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 return nullptr; 310 return nullptr;
311 } 311 }
312 312
313 if (!isSupportedType(resourceType.value(), mimeType)) { 313 if (!isSupportedType(resourceType.value(), mimeType)) {
314 document.addConsoleMessage(ConsoleMessage::create( 314 document.addConsoleMessage(ConsoleMessage::create(
315 OtherMessageSource, WarningMessageLevel, 315 OtherMessageSource, WarningMessageLevel,
316 String("<link rel=preload> has an unsupported `type` value"))); 316 String("<link rel=preload> has an unsupported `type` value")));
317 return nullptr; 317 return nullptr;
318 } 318 }
319 ResourceRequest resourceRequest(document.completeURL(href)); 319 ResourceRequest resourceRequest(document.completeURL(href));
320 ResourceFetcher::determineRequestContext(resourceRequest, 320 resourceRequest.setRequestContext(
321 resourceType.value(), false); 321 ResourceFetcher::determineRequestContext(resourceType.value(), false));
322 322
323 if (referrerPolicy != ReferrerPolicyDefault) { 323 if (referrerPolicy != ReferrerPolicyDefault) {
324 resourceRequest.setHTTPReferrer(SecurityPolicy::generateReferrer( 324 resourceRequest.setHTTPReferrer(SecurityPolicy::generateReferrer(
325 referrerPolicy, href, document.outgoingReferrer())); 325 referrerPolicy, href, document.outgoingReferrer()));
326 } 326 }
327 327
328 FetchRequest linkRequest(resourceRequest, FetchInitiatorTypeNames::link, 328 FetchRequest linkRequest(resourceRequest, FetchInitiatorTypeNames::link,
329 document.encodingName()); 329 document.encodingName());
330 330
331 if (crossOrigin != CrossOriginAttributeNotSet) { 331 if (crossOrigin != CrossOriginAttributeNotSet) {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 487
488 DEFINE_TRACE(LinkLoader) { 488 DEFINE_TRACE(LinkLoader) {
489 visitor->trace(m_client); 489 visitor->trace(m_client);
490 visitor->trace(m_prerender); 490 visitor->trace(m_prerender);
491 visitor->trace(m_linkPreloadResourceClient); 491 visitor->trace(m_linkPreloadResourceClient);
492 ResourceOwner<Resource, ResourceClient>::trace(visitor); 492 ResourceOwner<Resource, ResourceClient>::trace(visitor);
493 PrerenderClient::trace(visitor); 493 PrerenderClient::trace(visitor);
494 } 494 }
495 495
496 } // namespace blink 496 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698