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 Apple Inc. All rights reserved. | 5 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
6 | 6 |
7 This library is free software; you can redistribute it and/or | 7 This library is free software; you can redistribute it and/or |
8 modify it under the terms of the GNU Library General Public | 8 modify it under the terms of the GNU Library General Public |
9 License as published by the Free Software Foundation; either | 9 License as published by the Free Software Foundation; either |
10 version 2 of the License, or (at your option) any later version. | 10 version 2 of the License, or (at your option) any later version. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 { | 72 { |
73 if (RuntimeEnabledFeatures::weakMemoryCacheEnabled()) | 73 if (RuntimeEnabledFeatures::weakMemoryCacheEnabled()) |
74 m_resourceWeak = resource; | 74 m_resourceWeak = resource; |
75 else | 75 else |
76 m_resource = resource; | 76 m_resource = resource; |
77 } | 77 } |
78 | 78 |
79 DEFINE_TRACE(MemoryCacheEntry) | 79 DEFINE_TRACE(MemoryCacheEntry) |
80 { | 80 { |
81 visitor->trace(m_resource); | 81 visitor->trace(m_resource); |
82 visitor->trace(m_resourceWeak); | 82 visitor->template registerWeakMembers<MemoryCacheEntry, &MemoryCacheEntry::c learResourceWeak>(this); |
Nate Chapin
2016/06/20 21:54:17
I don't speak templates, and it stuns me that this
| |
83 visitor->trace(m_previousInLiveResourcesList); | 83 visitor->trace(m_previousInLiveResourcesList); |
84 visitor->trace(m_nextInLiveResourcesList); | 84 visitor->trace(m_nextInLiveResourcesList); |
85 visitor->trace(m_previousInAllResourcesList); | 85 visitor->trace(m_previousInAllResourcesList); |
86 visitor->trace(m_nextInAllResourcesList); | 86 visitor->trace(m_nextInAllResourcesList); |
87 } | 87 } |
88 | 88 |
89 void MemoryCacheEntry::clearResourceWeak(Visitor* visitor) | |
haraken
2016/06/15 08:21:05
This is not called when the MemoryCacheEntry is de
hiroshige
2016/06/15 11:53:41
It's OK (because MemoryCacheEntry is alive unless
| |
90 { | |
91 if (!m_resourceWeak || ThreadHeap::isHeapObjectAlive(m_resourceWeak)) | |
92 return; | |
93 memoryCache()->remove(m_resourceWeak.get()); | |
94 m_resourceWeak.clear(); | |
95 } | |
96 | |
89 void MemoryCacheEntry::dispose() | 97 void MemoryCacheEntry::dispose() |
90 { | 98 { |
91 m_resource.clear(); | 99 m_resource.clear(); |
92 m_resourceWeak.clear(); | 100 m_resourceWeak.clear(); |
93 } | 101 } |
94 | 102 |
95 Resource* MemoryCacheEntry::resource() | 103 Resource* MemoryCacheEntry::resource() |
96 { | 104 { |
97 if (RuntimeEnabledFeatures::weakMemoryCacheEnabled()) | 105 if (RuntimeEnabledFeatures::weakMemoryCacheEnabled()) |
98 return m_resourceWeak.get(); | 106 return m_resourceWeak.get(); |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
815 printf("(%.1fK, %.1fK, %uA, %dR, %d); ", currentResource->decode dSize() / 1024.0f, (currentResource->encodedSize() + currentResource->overheadSi ze()) / 1024.0f, current->m_accessCount, currentResource->hasClientsOrObservers( ), currentResource->isPurgeable()); | 823 printf("(%.1fK, %.1fK, %uA, %dR, %d); ", currentResource->decode dSize() / 1024.0f, (currentResource->encodedSize() + currentResource->overheadSi ze()) / 1024.0f, current->m_accessCount, currentResource->hasClientsOrObservers( ), currentResource->isPurgeable()); |
816 | 824 |
817 current = current->m_previousInAllResourcesList; | 825 current = current->m_previousInAllResourcesList; |
818 } | 826 } |
819 } | 827 } |
820 } | 828 } |
821 | 829 |
822 #endif // MEMORY_CACHE_STATS | 830 #endif // MEMORY_CACHE_STATS |
823 | 831 |
824 } // namespace blink | 832 } // namespace blink |
OLD | NEW |