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

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

Issue 2249913003: Remove blink::Resource::Type::LinkPrefetch and replace it by a flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameFetchContext.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 if (href.isEmpty() || !href.isValid()) 357 if (href.isEmpty() || !href.isValid())
358 released(); 358 released();
359 359
360 // FIXME(crbug.com/323096): Should take care of import. 360 // FIXME(crbug.com/323096): Should take care of import.
361 if (relAttribute.isLinkPrefetch() && href.isValid() && document.frame()) { 361 if (relAttribute.isLinkPrefetch() && href.isValid() && document.frame()) {
362 if (!m_client->shouldLoadLink()) 362 if (!m_client->shouldLoadLink())
363 return false; 363 return false;
364 UseCounter::count(document, UseCounter::LinkRelPrefetch); 364 UseCounter::count(document, UseCounter::LinkRelPrefetch);
365 365
366 FetchRequest linkRequest(ResourceRequest(document.completeURL(href)), Fe tchInitiatorTypeNames::link); 366 FetchRequest linkRequest(ResourceRequest(document.completeURL(href)), Fe tchInitiatorTypeNames::link);
367 linkRequest.setIsPrefetch(true);
367 if (crossOrigin != CrossOriginAttributeNotSet) 368 if (crossOrigin != CrossOriginAttributeNotSet)
368 linkRequest.setCrossOriginAccessControl(document.getSecurityOrigin() , crossOrigin); 369 linkRequest.setCrossOriginAccessControl(document.getSecurityOrigin() , crossOrigin);
369 setResource(LinkFetchResource::fetch(Resource::LinkPrefetch, linkRequest , document.fetcher())); 370 setResource(LinkFetchResource::fetch(Resource::MainResource, linkRequest , document.fetcher()));
370 } 371 }
371 372
372 if (const unsigned prerenderRelTypes = prerenderRelTypesFromRelAttribute(rel Attribute, document)) { 373 if (const unsigned prerenderRelTypes = prerenderRelTypesFromRelAttribute(rel Attribute, document)) {
373 if (!m_prerender) { 374 if (!m_prerender) {
374 m_prerender = PrerenderHandle::create(document, this, href, prerende rRelTypes); 375 m_prerender = PrerenderHandle::create(document, this, href, prerende rRelTypes);
375 } else if (m_prerender->url() != href) { 376 } else if (m_prerender->url() != href) {
376 m_prerender->cancel(); 377 m_prerender->cancel();
377 m_prerender = PrerenderHandle::create(document, this, href, prerende rRelTypes); 378 m_prerender = PrerenderHandle::create(document, this, href, prerende rRelTypes);
378 } 379 }
379 // TODO(gavinp): Handle changes to rel types of existing prerenders. 380 // TODO(gavinp): Handle changes to rel types of existing prerenders.
(...skipping 19 matching lines...) Expand all
399 DEFINE_TRACE(LinkLoader) 400 DEFINE_TRACE(LinkLoader)
400 { 401 {
401 visitor->trace(m_client); 402 visitor->trace(m_client);
402 visitor->trace(m_prerender); 403 visitor->trace(m_prerender);
403 visitor->trace(m_linkPreloadResourceClient); 404 visitor->trace(m_linkPreloadResourceClient);
404 ResourceOwner<Resource, ResourceClient>::trace(visitor); 405 ResourceOwner<Resource, ResourceClient>::trace(visitor);
405 PrerenderClient::trace(visitor); 406 PrerenderClient::trace(visitor);
406 } 407 }
407 408
408 } // namespace blink 409 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameFetchContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698