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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 if (request.forPreload()) { | 391 if (request.forPreload()) { |
392 DEFINE_RESOURCE_HISTOGRAM("Preload."); | 392 DEFINE_RESOURCE_HISTOGRAM("Preload."); |
393 } else { | 393 } else { |
394 DEFINE_RESOURCE_HISTOGRAM(""); | 394 DEFINE_RESOURCE_HISTOGRAM(""); |
395 } | 395 } |
396 | 396 |
397 // Aims to count Resource only referenced from MemoryCache (i.e. what | 397 // Aims to count Resource only referenced from MemoryCache (i.e. what |
398 // would be dead if MemoryCache holds weak references to Resource). | 398 // would be dead if MemoryCache holds weak references to Resource). |
399 // Currently we check references to Resource from ResourceClient and | 399 // Currently we check references to Resource from ResourceClient and |
400 // |m_preloads| only, because they are major sources of references. | 400 // |m_preloads| only, because they are major sources of references. |
401 if (resource && !resource->hasClientsOrObservers() && (!m_preloads || !m_pre
loads->contains(resource))) { | 401 if (resource && !resource->isAlive() && (!m_preloads || !m_preloads->contain
s(resource))) { |
402 DEFINE_RESOURCE_HISTOGRAM("Dead."); | 402 DEFINE_RESOURCE_HISTOGRAM("Dead."); |
403 } | 403 } |
404 } | 404 } |
405 | 405 |
406 Resource* ResourceFetcher::requestResource(FetchRequest& request, const Resource
Factory& factory, const SubstituteData& substituteData) | 406 Resource* ResourceFetcher::requestResource(FetchRequest& request, const Resource
Factory& factory, const SubstituteData& substituteData) |
407 { | 407 { |
408 ASSERT(request.options().synchronousPolicy == RequestAsynchronously || facto
ry.type() == Resource::Raw || factory.type() == Resource::XSLStyleSheet); | 408 ASSERT(request.options().synchronousPolicy == RequestAsynchronously || facto
ry.type() == Resource::Raw || factory.type() == Resource::XSLStyleSheet); |
409 | 409 |
410 context().populateRequestData(request.mutableResourceRequest()); | 410 context().populateRequestData(request.mutableResourceRequest()); |
411 if (request.resourceRequest().httpHeaderField("Upgrade-Insecure-Requests") !
= AtomicString("1")) | 411 if (request.resourceRequest().httpHeaderField("Upgrade-Insecure-Requests") !
= AtomicString("1")) |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 break; | 479 break; |
480 } | 480 } |
481 | 481 |
482 if (!resource) | 482 if (!resource) |
483 return nullptr; | 483 return nullptr; |
484 if (resource->getType() != factory.type()) { | 484 if (resource->getType() != factory.type()) { |
485 ASSERT(request.forPreload()); | 485 ASSERT(request.forPreload()); |
486 return nullptr; | 486 return nullptr; |
487 } | 487 } |
488 | 488 |
489 if (!resource->hasClientsOrObservers()) | 489 if (!resource->isAlive()) |
490 m_deadStatsRecorder.update(policy); | 490 m_deadStatsRecorder.update(policy); |
491 | 491 |
492 if (policy != Use) | 492 if (policy != Use) |
493 resource->setIdentifier(identifier); | 493 resource->setIdentifier(identifier); |
494 | 494 |
495 if (!request.forPreload() || policy != Use) { | 495 if (!request.forPreload() || policy != Use) { |
496 // When issuing another request for a resource that is already in-flight
make | 496 // When issuing another request for a resource that is already in-flight
make |
497 // sure to not demote the priority of the in-flight request. If the new
request | 497 // sure to not demote the priority of the in-flight request. If the new
request |
498 // isn't at the same priority as the in-flight request, only allow promo
tions. | 498 // isn't at the same priority as the in-flight request, only allow promo
tions. |
499 // This can happen when a visible image's priority is increased and then
another | 499 // This can happen when a visible image's priority is increased and then
another |
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1314 visitor->trace(m_context); | 1314 visitor->trace(m_context); |
1315 visitor->trace(m_archive); | 1315 visitor->trace(m_archive); |
1316 visitor->trace(m_loaders); | 1316 visitor->trace(m_loaders); |
1317 visitor->trace(m_nonBlockingLoaders); | 1317 visitor->trace(m_nonBlockingLoaders); |
1318 visitor->trace(m_documentResources); | 1318 visitor->trace(m_documentResources); |
1319 visitor->trace(m_preloads); | 1319 visitor->trace(m_preloads); |
1320 visitor->trace(m_resourceTimingInfoMap); | 1320 visitor->trace(m_resourceTimingInfoMap); |
1321 } | 1321 } |
1322 | 1322 |
1323 } // namespace blink | 1323 } // namespace blink |
OLD | NEW |