| 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) 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
rights reserved. | 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
rights reserved. |
| 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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 } | 440 } |
| 441 | 441 |
| 442 bool Resource::hasOneHandle() const | 442 bool Resource::hasOneHandle() const |
| 443 { | 443 { |
| 444 return hasRightHandleCountApartFromCache(1); | 444 return hasRightHandleCountApartFromCache(1); |
| 445 } | 445 } |
| 446 | 446 |
| 447 CachedMetadata* Resource::cachedMetadata(unsigned dataTypeID) const | 447 CachedMetadata* Resource::cachedMetadata(unsigned dataTypeID) const |
| 448 { | 448 { |
| 449 if (!m_cachedMetadata || m_cachedMetadata->dataTypeID() != dataTypeID) | 449 if (!m_cachedMetadata || m_cachedMetadata->dataTypeID() != dataTypeID) |
| 450 return 0; | 450 return nullptr; |
| 451 return m_cachedMetadata.get(); | 451 return m_cachedMetadata.get(); |
| 452 } | 452 } |
| 453 | 453 |
| 454 void Resource::clearLoader() | 454 void Resource::clearLoader() |
| 455 { | 455 { |
| 456 m_loader = nullptr; | 456 m_loader = nullptr; |
| 457 } | 457 } |
| 458 | 458 |
| 459 void Resource::addClient(ResourceClient* client) | 459 void Resource::addClient(ResourceClient* client) |
| 460 { | 460 { |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 { | 686 { |
| 687 ASSERT(m_resourceToRevalidate); | 687 ASSERT(m_resourceToRevalidate); |
| 688 ASSERT(memoryCache()->contains(m_resourceToRevalidate)); | 688 ASSERT(memoryCache()->contains(m_resourceToRevalidate)); |
| 689 ASSERT(!memoryCache()->contains(this)); | 689 ASSERT(!memoryCache()->contains(this)); |
| 690 | 690 |
| 691 WTF_LOG(ResourceLoading, "Resource %p switchClientsToRevalidatedResource %p"
, this, m_resourceToRevalidate.get()); | 691 WTF_LOG(ResourceLoading, "Resource %p switchClientsToRevalidatedResource %p"
, this, m_resourceToRevalidate.get()); |
| 692 | 692 |
| 693 m_resourceToRevalidate->m_identifier = m_identifier; | 693 m_resourceToRevalidate->m_identifier = m_identifier; |
| 694 | 694 |
| 695 m_switchingClientsToRevalidatedResource = true; | 695 m_switchingClientsToRevalidatedResource = true; |
| 696 for (const auto& handle : m_handlesToRevalidate) { | 696 for (ResourcePtrBase* handle : m_handlesToRevalidate) { |
| 697 handle->m_resource = m_resourceToRevalidate; | 697 handle->m_resource = m_resourceToRevalidate; |
| 698 m_resourceToRevalidate->registerHandle(handle); | 698 m_resourceToRevalidate->registerHandle(handle); |
| 699 --m_handleCount; | 699 --m_handleCount; |
| 700 } | 700 } |
| 701 ASSERT(!m_handleCount); | 701 ASSERT(!m_handleCount); |
| 702 m_handlesToRevalidate.clear(); | 702 m_handlesToRevalidate.clear(); |
| 703 | 703 |
| 704 Vector<ResourceClient*> clientsToMove; | 704 Vector<ResourceClient*> clientsToMove; |
| 705 for (const auto& clientHash : m_clients) { | 705 for (const auto& clientHashEntry : m_clients) { |
| 706 unsigned count = clientHash.value; | 706 unsigned count = clientHashEntry.value; |
| 707 while (count) { | 707 while (count--) |
| 708 clientsToMove.append(clientHash.key); | 708 clientsToMove.append(clientHashEntry.key); |
| 709 --count; | |
| 710 } | |
| 711 } | 709 } |
| 712 | 710 |
| 713 unsigned moveCount = clientsToMove.size(); | 711 unsigned moveCount = clientsToMove.size(); |
| 714 for (unsigned n = 0; n < moveCount; ++n) | 712 for (unsigned n = 0; n < moveCount; ++n) |
| 715 removeClient(clientsToMove[n]); | 713 removeClient(clientsToMove[n]); |
| 716 ASSERT(m_clients.isEmpty()); | 714 ASSERT(m_clients.isEmpty()); |
| 717 | 715 |
| 718 for (unsigned n = 0; n < moveCount; ++n) | 716 for (unsigned n = 0; n < moveCount; ++n) |
| 719 m_resourceToRevalidate->addClientToSet(clientsToMove[n]); | 717 m_resourceToRevalidate->addClientToSet(clientsToMove[n]); |
| 720 for (unsigned n = 0; n < moveCount; ++n) { | 718 for (unsigned n = 0; n < moveCount; ++n) { |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 } | 898 } |
| 901 | 899 |
| 902 bool Resource::ResourceCallback::isScheduled(Resource* resource) const | 900 bool Resource::ResourceCallback::isScheduled(Resource* resource) const |
| 903 { | 901 { |
| 904 return m_resourcesWithPendingClients.contains(resource); | 902 return m_resourcesWithPendingClients.contains(resource); |
| 905 } | 903 } |
| 906 | 904 |
| 907 void Resource::ResourceCallback::timerFired(Timer<ResourceCallback>*) | 905 void Resource::ResourceCallback::timerFired(Timer<ResourceCallback>*) |
| 908 { | 906 { |
| 909 Vector<ResourcePtr<Resource>> resources; | 907 Vector<ResourcePtr<Resource>> resources; |
| 910 for (const auto& resource : m_resourcesWithPendingClients) | 908 for (Resource* resource : m_resourcesWithPendingClients) |
| 911 resources.append(resource); | 909 resources.append(resource); |
| 912 m_resourcesWithPendingClients.clear(); | 910 m_resourcesWithPendingClients.clear(); |
| 913 | 911 |
| 914 for (const auto& resource : resources) { | 912 for (const auto& resource : resources) { |
| 915 resource->assertAlive(); | 913 resource->assertAlive(); |
| 916 resource->finishPendingClients(); | 914 resource->finishPendingClients(); |
| 917 resource->assertAlive(); | 915 resource->assertAlive(); |
| 918 } | 916 } |
| 919 | 917 |
| 920 for (const auto& resource : resources) | 918 for (const auto& resource : resources) |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 return "ImportResource"; | 1007 return "ImportResource"; |
| 1010 case Resource::Media: | 1008 case Resource::Media: |
| 1011 return "Media"; | 1009 return "Media"; |
| 1012 } | 1010 } |
| 1013 ASSERT_NOT_REACHED(); | 1011 ASSERT_NOT_REACHED(); |
| 1014 return "Unknown"; | 1012 return "Unknown"; |
| 1015 } | 1013 } |
| 1016 #endif // !LOG_DISABLED | 1014 #endif // !LOG_DISABLED |
| 1017 | 1015 |
| 1018 } | 1016 } |
| OLD | NEW |