OLD | NEW |
---|---|
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 rights reserved. | 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. |
6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ | 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ |
7 | 7 |
8 This library is free software; you can redistribute it and/or | 8 This library is free software; you can redistribute it and/or |
9 modify it under the terms of the GNU Library General Public | 9 modify it under the terms of the GNU Library General Public |
10 License as published by the Free Software Foundation; either | 10 License as published by the Free Software Foundation; either |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
372 resource->setIdentifier(createUniqueIdentifier()); | 372 resource->setIdentifier(createUniqueIdentifier()); |
373 resource->setCacheIdentifier(cacheIdentifier); | 373 resource->setCacheIdentifier(cacheIdentifier); |
374 resource->finish(); | 374 resource->finish(); |
375 | 375 |
376 if (!substituteData.isValid()) | 376 if (!substituteData.isValid()) |
377 memoryCache()->add(resource); | 377 memoryCache()->add(resource); |
378 | 378 |
379 return resource; | 379 return resource; |
380 } | 380 } |
381 | 381 |
382 Resource* ResourceFetcher::resourceForBlockedRequest(const FetchRequest& request , const ResourceFactory& factory, bool needsSynchronousCacheHit) | |
383 { | |
384 Resource* resource = factory.create(request.resourceRequest(), request.optio ns(), request.charset()); | |
385 resource->setNeedsSynchronousCacheHit(needsSynchronousCacheHit); | |
Nate Chapin
2016/08/09 22:43:23
Is there a case where needsSynchronousCacheHit is
engedy
2016/08/17 16:41:56
Looking through the clients that use `needsSynchro
Nate Chapin
2016/08/17 20:05:05
SubstituteData is very trusted and gets to short c
engedy
2016/09/21 21:04:01
What do you think about adding a DCHECK?
Nate Chapin
2016/09/21 23:23:41
Works for me.
| |
386 resource->error(ResourceError::cancelledDueToAccessCheckError(request.url()) ); | |
387 return resource; | |
388 } | |
389 | |
382 void ResourceFetcher::moveCachedNonBlockingResourceToBlocking(Resource* resource , const FetchRequest& request) | 390 void ResourceFetcher::moveCachedNonBlockingResourceToBlocking(Resource* resource , const FetchRequest& request) |
383 { | 391 { |
384 // TODO(yoav): Test that non-blocking resources (video/audio/track) continue to not-block even after being preloaded and discovered. | 392 // TODO(yoav): Test that non-blocking resources (video/audio/track) continue to not-block even after being preloaded and discovered. |
385 if (resource && resource->loader() && resource->isLoadEventBlockingResourceT ype() && resource->isLinkPreload() && !request.forPreload()) { | 393 if (resource && resource->loader() && resource->isLoadEventBlockingResourceT ype() && resource->isLinkPreload() && !request.forPreload()) { |
386 m_nonBlockingLoaders.remove(resource->loader()); | 394 m_nonBlockingLoaders.remove(resource->loader()); |
387 m_loaders.add(resource->loader()); | 395 m_loaders.add(resource->loader()); |
388 } | 396 } |
389 } | 397 } |
390 | 398 |
391 void ResourceFetcher::updateMemoryCacheStats(Resource* resource, RevalidationPol icy policy, const FetchRequest& request, const ResourceFactory& factory, bool i sStaticData) const | 399 void ResourceFetcher::updateMemoryCacheStats(Resource* resource, RevalidationPol icy policy, const FetchRequest& request, const ResourceFactory& factory, bool i sStaticData) const |
(...skipping 24 matching lines...) Expand all Loading... | |
416 if (request.resourceRequest().httpHeaderField("Upgrade-Insecure-Requests") ! = AtomicString("1")) | 424 if (request.resourceRequest().httpHeaderField("Upgrade-Insecure-Requests") ! = AtomicString("1")) |
417 context().upgradeInsecureRequest(request.mutableResourceRequest()); | 425 context().upgradeInsecureRequest(request.mutableResourceRequest()); |
418 context().addClientHintsIfNecessary(request); | 426 context().addClientHintsIfNecessary(request); |
419 context().addCSPHeaderIfNecessary(factory.type(), request); | 427 context().addCSPHeaderIfNecessary(factory.type(), request); |
420 | 428 |
421 TRACE_EVENT1("blink", "ResourceFetcher::requestResource", "url", urlForTrace Event(request.url())); | 429 TRACE_EVENT1("blink", "ResourceFetcher::requestResource", "url", urlForTrace Event(request.url())); |
422 | 430 |
423 if (!request.url().isValid()) | 431 if (!request.url().isValid()) |
424 return nullptr; | 432 return nullptr; |
425 | 433 |
426 if (!context().canRequest(factory.type(), request.resourceRequest(), MemoryC ache::removeFragmentIdentifierIfNeeded(request.url()), request.options(), reques t.forPreload(), request.getOriginRestriction())) | 434 if (!context().canRequest(factory.type(), request.resourceRequest(), MemoryC ache::removeFragmentIdentifierIfNeeded(request.url()), request.options(), reques t.forPreload(), request.getOriginRestriction())) { |
Nate Chapin
2016/08/09 22:43:23
Is it possible to move this check later, so that w
engedy
2016/08/17 16:41:56
It is possible, but unless I misunderstood your su
Nate Chapin
2016/08/17 20:05:05
Hrm, I guess the hard case here is for the Resourc
| |
427 return nullptr; | 435 return resourceForBlockedRequest(request, factory, substituteData.forceS ynchronousLoad()); |
436 } | |
428 | 437 |
429 unsigned long identifier = createUniqueIdentifier(); | 438 unsigned long identifier = createUniqueIdentifier(); |
430 request.mutableResourceRequest().setPriority(computeLoadPriority(factory.typ e(), request, ResourcePriority::NotVisible)); | 439 request.mutableResourceRequest().setPriority(computeLoadPriority(factory.typ e(), request, ResourcePriority::NotVisible)); |
431 initializeResourceRequest(request.mutableResourceRequest(), factory.type(), request.defer()); | 440 initializeResourceRequest(request.mutableResourceRequest(), factory.type(), request.defer()); |
432 context().willStartLoadingResource(identifier, request.mutableResourceReques t(), factory.type()); | 441 context().willStartLoadingResource(identifier, request.mutableResourceReques t(), factory.type()); |
433 if (!request.url().isValid()) | 442 if (!request.url().isValid()) |
434 return nullptr; | 443 return nullptr; |
435 | 444 |
436 if (!request.forPreload()) { | 445 if (!request.forPreload()) { |
437 V8DOMActivityLogger* activityLogger = nullptr; | 446 V8DOMActivityLogger* activityLogger = nullptr; |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1314 visitor->trace(m_context); | 1323 visitor->trace(m_context); |
1315 visitor->trace(m_archive); | 1324 visitor->trace(m_archive); |
1316 visitor->trace(m_loaders); | 1325 visitor->trace(m_loaders); |
1317 visitor->trace(m_nonBlockingLoaders); | 1326 visitor->trace(m_nonBlockingLoaders); |
1318 visitor->trace(m_documentResources); | 1327 visitor->trace(m_documentResources); |
1319 visitor->trace(m_preloads); | 1328 visitor->trace(m_preloads); |
1320 visitor->trace(m_resourceTimingInfoMap); | 1329 visitor->trace(m_resourceTimingInfoMap); |
1321 } | 1330 } |
1322 | 1331 |
1323 } // namespace blink | 1332 } // namespace blink |
OLD | NEW |