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

Side by Side Diff: third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp

Issue 2676163002: Refactor the forPreload flag to mean speculative preload. (Closed)
Patch Set: Review comments Created 3 years, 10 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) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 rights reserved. 6 rights reserved.
7 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 7 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
8 8
9 This library is free software; you can redistribute it and/or 9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public 10 modify it under the terms of the GNU Library General Public
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 return ResourceLoadPriorityUnresolved; 150 return ResourceLoadPriorityUnresolved;
151 } 151 }
152 152
153 } // namespace 153 } // namespace
154 154
155 ResourceLoadPriority ResourceFetcher::computeLoadPriority( 155 ResourceLoadPriority ResourceFetcher::computeLoadPriority(
156 Resource::Type type, 156 Resource::Type type,
157 const ResourceRequest& resourceRequest, 157 const ResourceRequest& resourceRequest,
158 ResourcePriority::VisibilityStatus visibility, 158 ResourcePriority::VisibilityStatus visibility,
159 FetchRequest::DeferOption deferOption, 159 FetchRequest::DeferOption deferOption,
160 bool forPreload) { 160 bool speculativePreload) {
161 ResourceLoadPriority priority = typeToPriority(type); 161 ResourceLoadPriority priority = typeToPriority(type);
162 162
163 // Visible resources (images in practice) get a boost to High priority. 163 // Visible resources (images in practice) get a boost to High priority.
164 if (visibility == ResourcePriority::Visible) 164 if (visibility == ResourcePriority::Visible)
165 priority = ResourceLoadPriorityHigh; 165 priority = ResourceLoadPriorityHigh;
166 166
167 // Resources before the first image are considered "early" in the document and 167 // Resources before the first image are considered "early" in the document and
168 // resources after the first image are "late" in the document. Important to 168 // resources after the first image are "late" in the document. Important to
169 // note that this is based on when the preload scanner discovers a resource 169 // note that this is based on when the preload scanner discovers a resource
170 // for the most part so the main parser may not have reached the image element 170 // for the most part so the main parser may not have reached the image element
171 // yet. 171 // yet.
172 if (type == Resource::Image) 172 if (type == Resource::Image)
173 m_imageFetched = true; 173 m_imageFetched = true;
174 174
175 if (FetchRequest::IdleLoad == deferOption) { 175 if (FetchRequest::IdleLoad == deferOption) {
176 priority = ResourceLoadPriorityVeryLow; 176 priority = ResourceLoadPriorityVeryLow;
177 } else if (type == Resource::Script) { 177 } else if (type == Resource::Script) {
178 // Special handling for scripts. 178 // Special handling for scripts.
179 // Default/Parser-Blocking/Preload early in document: High (set in 179 // Default/Parser-Blocking/Preload early in document: High (set in
180 // typeToPriority) 180 // typeToPriority)
181 // Async/Defer: Low Priority (applies to both preload and parser-inserted) 181 // Async/Defer: Low Priority (applies to both preload and parser-inserted)
182 // Preload late in document: Medium 182 // Preload late in document: Medium
183 if (FetchRequest::LazyLoad == deferOption) 183 if (FetchRequest::LazyLoad == deferOption) {
184 priority = ResourceLoadPriorityLow; 184 priority = ResourceLoadPriorityLow;
185 else if (forPreload && m_imageFetched) 185 } else if (speculativePreload && m_imageFetched) {
186 // TODO(yoav): It is not clear why this applies only to preloaded scripts.
Charlie Harrison 2017/02/06 19:54:16 I did some blaming to trace this logic. It stems f
Yoav Weiss 2017/02/06 23:15:49 Changed to a comment stating the above
186 priority = ResourceLoadPriorityMedium; 187 priority = ResourceLoadPriorityMedium;
188 }
187 } else if (FetchRequest::LazyLoad == deferOption) { 189 } else if (FetchRequest::LazyLoad == deferOption) {
188 priority = ResourceLoadPriorityVeryLow; 190 priority = ResourceLoadPriorityVeryLow;
189 } 191 }
190 192
191 // A manually set priority acts as a floor. This is used to ensure that 193 // A manually set priority acts as a floor. This is used to ensure that
192 // synchronous requests are always given the highest possible priority, as 194 // synchronous requests are always given the highest possible priority, as
193 // well as to ensure that there isn't priority churn if images move in and out 195 // well as to ensure that there isn't priority churn if images move in and out
194 // of the viewport, or is displayed more than once, both in and out of the 196 // of the viewport, or is displayed more than once, both in and out of the
195 // viewport. 197 // viewport.
196 return std::max(context().modifyPriorityForExperiments(priority), 198 return std::max(context().modifyPriorityForExperiments(priority),
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 return resource.get(); 271 return resource.get();
270 } 272 }
271 273
272 bool ResourceFetcher::isControlledByServiceWorker() const { 274 bool ResourceFetcher::isControlledByServiceWorker() const {
273 return context().isControlledByServiceWorker(); 275 return context().isControlledByServiceWorker();
274 } 276 }
275 277
276 bool ResourceFetcher::resourceNeedsLoad(Resource* resource, 278 bool ResourceFetcher::resourceNeedsLoad(Resource* resource,
277 const FetchRequest& request, 279 const FetchRequest& request,
278 RevalidationPolicy policy) { 280 RevalidationPolicy policy) {
279 // Defer a font load until it is actually needed unless this is a preload. 281 // Defer a font load until it is actually needed unless this is a link
280 if (resource->getType() == Resource::Font && !request.forPreload()) 282 // preload.
283 if (resource->getType() == Resource::Font && !request.isLinkPreload())
281 return false; 284 return false;
282 if (resource->isImage() && shouldDeferImageLoad(resource->url())) 285 if (resource->isImage() && shouldDeferImageLoad(resource->url()))
283 return false; 286 return false;
284 return policy != Use || resource->stillNeedsLoad(); 287 return policy != Use || resource->stillNeedsLoad();
285 } 288 }
286 289
287 // Limit the number of URLs in m_validatedURLs to avoid memory bloat. 290 // Limit the number of URLs in m_validatedURLs to avoid memory bloat.
288 // http://crbug.com/52411 291 // http://crbug.com/52411
289 static const int kMaxValidatedURLsSize = 10000; 292 static const int kMaxValidatedURLsSize = 10000;
290 293
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 const FetchRequest& request, 411 const FetchRequest& request,
409 const ResourceFactory& factory, 412 const ResourceFactory& factory,
410 ResourceRequestBlockedReason blockedReason) { 413 ResourceRequestBlockedReason blockedReason) {
411 Resource* resource = factory.create(request.resourceRequest(), 414 Resource* resource = factory.create(request.resourceRequest(),
412 request.options(), request.charset()); 415 request.options(), request.charset());
413 resource->error(ResourceError::cancelledDueToAccessCheckError(request.url(), 416 resource->error(ResourceError::cancelledDueToAccessCheckError(request.url(),
414 blockedReason)); 417 blockedReason));
415 return resource; 418 return resource;
416 } 419 }
417 420
418 void ResourceFetcher::moveCachedNonBlockingResourceToBlocking( 421 void ResourceFetcher::makePreloadedResourceBlockOnloadIfNeeded(
419 Resource* resource, 422 Resource* resource,
420 const FetchRequest& request) { 423 const FetchRequest& request) {
421 // TODO(yoav): Test that non-blocking resources (video/audio/track) continue 424 // TODO(yoav): Test that non-blocking resources (video/audio/track) continue
422 // to not-block even after being preloaded and discovered. 425 // to not-block even after being preloaded and discovered.
423 if (resource && resource->loader() && 426 if (resource && resource->loader() &&
424 resource->isLoadEventBlockingResourceType() && 427 resource->isLoadEventBlockingResourceType() &&
425 m_nonBlockingLoaders.contains(resource->loader()) && 428 resource->isLinkPreload() && !request.isLinkPreload() &&
426 resource->isLinkPreload() && !request.forPreload()) { 429 m_nonBlockingLoaders.contains(resource->loader())) {
427 m_nonBlockingLoaders.remove(resource->loader()); 430 m_nonBlockingLoaders.remove(resource->loader());
428 m_loaders.insert(resource->loader()); 431 m_loaders.insert(resource->loader());
429 } 432 }
430 } 433 }
431 434
432 void ResourceFetcher::updateMemoryCacheStats(Resource* resource, 435 void ResourceFetcher::updateMemoryCacheStats(Resource* resource,
433 RevalidationPolicy policy, 436 RevalidationPolicy policy,
434 const FetchRequest& request, 437 const FetchRequest& request,
435 const ResourceFactory& factory, 438 const ResourceFactory& factory,
436 bool isStaticData) const { 439 bool isStaticData) const {
437 if (isStaticData) 440 if (isStaticData)
438 return; 441 return;
439 442
440 if (request.forPreload()) { 443 if (request.speculativePreload() || request.isLinkPreload()) {
Charlie Harrison 2017/02/06 19:54:16 nit: seeing these together brings out the inconsis
Yoav Weiss 2017/02/06 23:15:49 changed
441 DEFINE_RESOURCE_HISTOGRAM("Preload."); 444 DEFINE_RESOURCE_HISTOGRAM("Preload.");
442 } else { 445 } else {
443 DEFINE_RESOURCE_HISTOGRAM(""); 446 DEFINE_RESOURCE_HISTOGRAM("");
444 } 447 }
445 448
446 // Aims to count Resource only referenced from MemoryCache (i.e. what would be 449 // Aims to count Resource only referenced from MemoryCache (i.e. what would be
447 // dead if MemoryCache holds weak references to Resource). Currently we check 450 // dead if MemoryCache holds weak references to Resource). Currently we check
448 // references to Resource from ResourceClient and |m_preloads| only, because 451 // references to Resource from ResourceClient and |m_preloads| only, because
449 // they are major sources of references. 452 // they are major sources of references.
450 if (resource && !resource->isAlive() && 453 if (resource && !resource->isAlive() &&
(...skipping 16 matching lines...) Expand all
467 470
468 context().populateResourceRequest( 471 context().populateResourceRequest(
469 factory.type(), request.clientHintsPreferences(), 472 factory.type(), request.clientHintsPreferences(),
470 request.getResourceWidth(), resourceRequest); 473 request.getResourceWidth(), resourceRequest);
471 474
472 if (!request.url().isValid()) 475 if (!request.url().isValid())
473 return Abort; 476 return Abort;
474 477
475 resourceRequest.setPriority(computeLoadPriority( 478 resourceRequest.setPriority(computeLoadPriority(
476 factory.type(), request.resourceRequest(), ResourcePriority::NotVisible, 479 factory.type(), request.resourceRequest(), ResourcePriority::NotVisible,
477 request.defer(), request.forPreload())); 480 request.defer(), request.speculativePreload()));
478 initializeResourceRequest(resourceRequest, factory.type(), request.defer()); 481 initializeResourceRequest(resourceRequest, factory.type(), request.defer());
479 network_instrumentation::resourcePrioritySet(identifier, 482 network_instrumentation::resourcePrioritySet(identifier,
480 resourceRequest.priority()); 483 resourceRequest.priority());
481 484
482 blockedReason = context().canRequest( 485 blockedReason = context().canRequest(
483 factory.type(), resourceRequest, 486 factory.type(), resourceRequest,
484 MemoryCache::removeFragmentIdentifierIfNeeded(request.url()), 487 MemoryCache::removeFragmentIdentifierIfNeeded(request.url()),
485 request.options(), request.forPreload(), request.getOriginRestriction()); 488 request.options(), request.speculativePreload()
489 ? FetchContext::ReportingPolicy::SuppressReporting
490 : FetchContext::ReportingPolicy::Report,
491 request.getOriginRestriction());
486 if (blockedReason != ResourceRequestBlockedReason::None) { 492 if (blockedReason != ResourceRequestBlockedReason::None) {
487 DCHECK(!substituteData.forceSynchronousLoad()); 493 DCHECK(!substituteData.forceSynchronousLoad());
488 return Block; 494 return Block;
489 } 495 }
490 496
491 context().willStartLoadingResource( 497 context().willStartLoadingResource(
492 identifier, resourceRequest, factory.type(), 498 identifier, resourceRequest, factory.type(),
493 request.options().initiatorInfo.name, request.forPreload()); 499 request.options().initiatorInfo.name,
500 (request.speculativePreload()
501 ? FetchContext::LoggingPolicy::SuppressLogging
502 : FetchContext::LoggingPolicy::Log));
494 if (!request.url().isValid()) 503 if (!request.url().isValid())
495 return Abort; 504 return Abort;
496 505
497 resourceRequest.setAllowStoredCredentials( 506 resourceRequest.setAllowStoredCredentials(
498 request.options().allowCredentials == AllowStoredCredentials); 507 request.options().allowCredentials == AllowStoredCredentials);
499 return Continue; 508 return Continue;
500 } 509 }
501 510
502 Resource* ResourceFetcher::requestResource( 511 Resource* ResourceFetcher::requestResource(
503 FetchRequest& request, 512 FetchRequest& request,
(...skipping 28 matching lines...) Expand all
532 // to be decoded only on demand. These data URLs are allowed to be 541 // to be decoded only on demand. These data URLs are allowed to be
533 // processed using the normal ResourceFetcher machinery. 542 // processed using the normal ResourceFetcher machinery.
534 if (!resource && !isDataUrl && m_archive) 543 if (!resource && !isDataUrl && m_archive)
535 return nullptr; 544 return nullptr;
536 } 545 }
537 if (!resource) { 546 if (!resource) {
538 resource = 547 resource =
539 memoryCache()->resourceForURL(request.url(), getCacheIdentifier()); 548 memoryCache()->resourceForURL(request.url(), getCacheIdentifier());
540 } 549 }
541 550
542 // See if we can use an existing resource from the cache. If so, we need to 551 // If we got a preloaded resource from the cache for a non-preload request,
543 // move it to be load blocking. 552 // we may need to make it block the onload event.
544 moveCachedNonBlockingResourceToBlocking(resource, request); 553 makePreloadedResourceBlockOnloadIfNeeded(resource, request);
545 554
546 const RevalidationPolicy policy = determineRevalidationPolicy( 555 const RevalidationPolicy policy = determineRevalidationPolicy(
547 factory.type(), request, resource, isStaticData); 556 factory.type(), request, resource, isStaticData);
548 TRACE_EVENT_INSTANT1("blink", "ResourceFetcher::determineRevalidationPolicy", 557 TRACE_EVENT_INSTANT1("blink", "ResourceFetcher::determineRevalidationPolicy",
549 TRACE_EVENT_SCOPE_THREAD, "revalidationPolicy", policy); 558 TRACE_EVENT_SCOPE_THREAD, "revalidationPolicy", policy);
550 559
551 updateMemoryCacheStats(resource, policy, request, factory, isStaticData); 560 updateMemoryCacheStats(resource, policy, request, factory, isStaticData);
552 561
553 switch (policy) { 562 switch (policy) {
554 case Reload: 563 case Reload:
555 memoryCache()->remove(resource); 564 memoryCache()->remove(resource);
556 // Fall through 565 // Fall through
557 case Load: 566 case Load:
558 resource = createResourceForLoading(request, request.charset(), factory); 567 resource = createResourceForLoading(request, request.charset(), factory);
559 break; 568 break;
560 case Revalidate: 569 case Revalidate:
561 initializeRevalidation(resourceRequest, resource); 570 initializeRevalidation(resourceRequest, resource);
562 break; 571 break;
563 case Use: 572 case Use:
564 if (resource->isLinkPreload() && !request.isLinkPreload()) 573 if (resource->isLinkPreload() && !request.isLinkPreload())
565 resource->setLinkPreload(false); 574 resource->setLinkPreload(false);
566 break; 575 break;
567 } 576 }
568 if (!resource) 577 if (!resource)
569 return nullptr; 578 return nullptr;
570 if (resource->getType() != factory.type()) { 579 if (resource->getType() != factory.type()) {
571 DCHECK(request.forPreload()); 580 DCHECK(request.speculativePreload() || request.isLinkPreload());
581 // TODO(yoav): What's the scenario where this can actually happen?
Charlie Harrison 2017/02/06 19:54:16 I can't think/see of any and this code is decently
Yoav Weiss 2017/02/06 23:15:49 I'll do that in a followup
572 return nullptr; 582 return nullptr;
573 } 583 }
574 584
575 if (!resource->isAlive()) 585 if (!resource->isAlive())
576 m_deadStatsRecorder.update(policy); 586 m_deadStatsRecorder.update(policy);
577 587
578 if (policy != Use) 588 if (policy != Use)
579 resource->setIdentifier(identifier); 589 resource->setIdentifier(identifier);
580 590
581 if (!request.forPreload() || policy != Use) { 591 // TODO(yoav): It is not clear why preloads are exempt from this check. Can we
Charlie Harrison 2017/02/06 19:54:16 This logic is very old [1], and priority calculati
Yoav Weiss 2017/02/06 23:15:49 sure
592 // remove the exemption?
593 if (!request.speculativePreload() || policy != Use) {
582 // When issuing another request for a resource that is already in-flight 594 // When issuing another request for a resource that is already in-flight
583 // make sure to not demote the priority of the in-flight request. If the new 595 // make sure to not demote the priority of the in-flight request. If the new
584 // request isn't at the same priority as the in-flight request, only allow 596 // request isn't at the same priority as the in-flight request, only allow
585 // promotions. This can happen when a visible image's priority is increased 597 // promotions. This can happen when a visible image's priority is increased
586 // and then another reference to the image is parsed (which would be at a 598 // and then another reference to the image is parsed (which would be at a
587 // lower priority). 599 // lower priority).
588 if (resourceRequest.priority() > resource->resourceRequest().priority()) 600 if (resourceRequest.priority() > resource->resourceRequest().priority())
589 resource->didChangePriority(resourceRequest.priority(), 0); 601 resource->didChangePriority(resourceRequest.priority(), 0);
602 // TODO(yoav): I'd expect the stated scenario to not go here, as its policy
603 // would be Use.
590 } 604 }
591 605
592 // If only the fragment identifiers differ, it is the same resource. 606 // If only the fragment identifiers differ, it is the same resource.
593 DCHECK(equalIgnoringFragmentIdentifier(resource->url(), request.url())); 607 DCHECK(equalIgnoringFragmentIdentifier(resource->url(), request.url()));
594 requestLoadStarted( 608 requestLoadStarted(
595 identifier, resource, request, 609 identifier, resource, request,
596 policy == Use ? ResourceLoadingFromCache : ResourceLoadingFromNetwork, 610 policy == Use ? ResourceLoadingFromCache : ResourceLoadingFromNetwork,
597 isStaticData); 611 isStaticData);
598 m_documentResources.set( 612 m_documentResources.set(
599 MemoryCache::removeFragmentIdentifierIfNeeded(request.url()), resource); 613 MemoryCache::removeFragmentIdentifierIfNeeded(request.url()), resource);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 const String cacheIdentifier = getCacheIdentifier(); 715 const String cacheIdentifier = getCacheIdentifier();
702 DCHECK(!memoryCache()->resourceForURL(request.resourceRequest().url(), 716 DCHECK(!memoryCache()->resourceForURL(request.resourceRequest().url(),
703 cacheIdentifier)); 717 cacheIdentifier));
704 718
705 RESOURCE_LOADING_DVLOG(1) << "Loading Resource for " 719 RESOURCE_LOADING_DVLOG(1) << "Loading Resource for "
706 << request.resourceRequest().url().elidedString(); 720 << request.resourceRequest().url().elidedString();
707 721
708 Resource* resource = 722 Resource* resource =
709 factory.create(request.resourceRequest(), request.options(), charset); 723 factory.create(request.resourceRequest(), request.options(), charset);
710 resource->setLinkPreload(request.isLinkPreload()); 724 resource->setLinkPreload(request.isLinkPreload());
711 if (request.forPreload()) { 725 if (request.speculativePreload()) {
712 resource->setPreloadDiscoveryTime(request.preloadDiscoveryTime()); 726 resource->setPreloadDiscoveryTime(request.preloadDiscoveryTime());
713 } 727 }
714 resource->setCacheIdentifier(cacheIdentifier); 728 resource->setCacheIdentifier(cacheIdentifier);
715 729
716 // - Don't add main resource to cache to prevent reuse. 730 // - Don't add main resource to cache to prevent reuse.
717 // - Don't add the resource if its body will not be stored. 731 // - Don't add the resource if its body will not be stored.
718 if (factory.type() != Resource::MainResource && 732 if (factory.type() != Resource::MainResource &&
719 request.options().dataBufferingPolicy != DoNotBufferData) { 733 request.options().dataBufferingPolicy != DoNotBufferData) {
720 memoryCache()->add(resource); 734 memoryCache()->add(resource);
721 } 735 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 if (existingResource->mustRefetchDueToIntegrityMetadata(fetchRequest)) { 818 if (existingResource->mustRefetchDueToIntegrityMetadata(fetchRequest)) {
805 RecordSriResourceIntegrityMismatchEvent(RefetchDueToIntegrityMismatch); 819 RecordSriResourceIntegrityMismatchEvent(RefetchDueToIntegrityMismatch);
806 return Reload; 820 return Reload;
807 } 821 }
808 822
809 // Service Worker's CORS fallback message must not be cached. 823 // Service Worker's CORS fallback message must not be cached.
810 if (existingResource->response().wasFallbackRequiredByServiceWorker()) 824 if (existingResource->response().wasFallbackRequiredByServiceWorker())
811 return Reload; 825 return Reload;
812 826
813 // We already have a preload going for this URL. 827 // We already have a preload going for this URL.
814 if (fetchRequest.forPreload() && existingResource->isPreloaded()) 828 if (fetchRequest.speculativePreload() && existingResource->isPreloaded())
815 return Use; 829 return Use;
816 830
817 // If the same URL has been loaded as a different type, we need to reload. 831 // If the same URL has been loaded as a different type, we need to reload.
818 if (existingResource->getType() != type) { 832 if (existingResource->getType() != type) {
819 // FIXME: If existingResource is a Preload and the new type is LinkPrefetch 833 // FIXME: If existingResource is a Preload and the new type is LinkPrefetch
820 // We really should discard the new prefetch since the preload has more 834 // We really should discard the new prefetch since the preload has more
821 // specific type information! crbug.com/379893 835 // specific type information! crbug.com/379893
822 // fast/dom/HTMLLinkElement/link-and-subresource-test hits this case. 836 // fast/dom/HTMLLinkElement/link-and-subresource-test hits this case.
823 RESOURCE_LOADING_DVLOG(1) << "ResourceFetcher::determineRevalidationPolicy " 837 RESOURCE_LOADING_DVLOG(1) << "ResourceFetcher::determineRevalidationPolicy "
824 "reloading due to type mismatch."; 838 "reloading due to type mismatch.";
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 const KURL& url, 1486 const KURL& url,
1473 WebURLRequest::RequestContext requestContext, 1487 WebURLRequest::RequestContext requestContext,
1474 const AtomicString& initiatorName) { 1488 const AtomicString& initiatorName) {
1475 if (cachedResource(url)) 1489 if (cachedResource(url))
1476 return; 1490 return;
1477 ResourceRequest resourceRequest(url); 1491 ResourceRequest resourceRequest(url);
1478 resourceRequest.setRequestContext(requestContext); 1492 resourceRequest.setRequestContext(requestContext);
1479 FetchRequest request(resourceRequest, initiatorName, resource->options()); 1493 FetchRequest request(resourceRequest, initiatorName, resource->options());
1480 context().canRequest(resource->getType(), resource->lastResourceRequest(), 1494 context().canRequest(resource->getType(), resource->lastResourceRequest(),
1481 resource->lastResourceRequest().url(), request.options(), 1495 resource->lastResourceRequest().url(), request.options(),
1482 false, request.getOriginRestriction()); 1496 FetchContext::ReportingPolicy::Report,
1497 request.getOriginRestriction());
1483 requestLoadStarted(resource->identifier(), resource, request, 1498 requestLoadStarted(resource->identifier(), resource, request,
1484 ResourceLoadingFromCache); 1499 ResourceLoadingFromCache);
1485 } 1500 }
1486 1501
1487 ResourceFetcher::DeadResourceStatsRecorder::DeadResourceStatsRecorder() 1502 ResourceFetcher::DeadResourceStatsRecorder::DeadResourceStatsRecorder()
1488 : m_useCount(0), m_revalidateCount(0), m_loadCount(0) {} 1503 : m_useCount(0), m_revalidateCount(0), m_loadCount(0) {}
1489 1504
1490 ResourceFetcher::DeadResourceStatsRecorder::~DeadResourceStatsRecorder() { 1505 ResourceFetcher::DeadResourceStatsRecorder::~DeadResourceStatsRecorder() {
1491 DEFINE_THREAD_SAFE_STATIC_LOCAL( 1506 DEFINE_THREAD_SAFE_STATIC_LOCAL(
1492 CustomCountHistogram, hitCountHistogram, 1507 CustomCountHistogram, hitCountHistogram,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1525 visitor->trace(m_context); 1540 visitor->trace(m_context);
1526 visitor->trace(m_archive); 1541 visitor->trace(m_archive);
1527 visitor->trace(m_loaders); 1542 visitor->trace(m_loaders);
1528 visitor->trace(m_nonBlockingLoaders); 1543 visitor->trace(m_nonBlockingLoaders);
1529 visitor->trace(m_documentResources); 1544 visitor->trace(m_documentResources);
1530 visitor->trace(m_preloads); 1545 visitor->trace(m_preloads);
1531 visitor->trace(m_resourceTimingInfoMap); 1546 visitor->trace(m_resourceTimingInfoMap);
1532 } 1547 }
1533 1548
1534 } // namespace blink 1549 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698