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