Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1117)

Side by Side Diff: third_party/WebKit/Source/core/fetch/MemoryCache.cpp

Issue 2110683005: Revert of [WeakMemoryCache] Remove Resource from MemoryCache just before destructed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/fetch/MemoryCache.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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->template registerWeakMembers<MemoryCacheEntry, &MemoryCacheEntry::c learResourceWeak>(this); 82 visitor->trace(m_resourceWeak);
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)
90 {
91 if (!m_resourceWeak || ThreadHeap::isHeapObjectAlive(m_resourceWeak))
92 return;
93 memoryCache()->remove(m_resourceWeak.get());
94 m_resourceWeak.clear();
95 }
96
97 void MemoryCacheEntry::dispose() 89 void MemoryCacheEntry::dispose()
98 { 90 {
99 m_resource.clear(); 91 m_resource.clear();
100 m_resourceWeak.clear(); 92 m_resourceWeak.clear();
101 } 93 }
102 94
103 Resource* MemoryCacheEntry::resource() 95 Resource* MemoryCacheEntry::resource()
104 { 96 {
105 if (RuntimeEnabledFeatures::weakMemoryCacheEnabled()) 97 if (RuntimeEnabledFeatures::weakMemoryCacheEnabled())
106 return m_resourceWeak.get(); 98 return m_resourceWeak.get();
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
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()); 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());
824 816
825 current = current->m_previousInAllResourcesList; 817 current = current->m_previousInAllResourcesList;
826 } 818 }
827 } 819 }
828 } 820 }
829 821
830 #endif // MEMORY_CACHE_STATS 822 #endif // MEMORY_CACHE_STATS
831 823
832 } // namespace blink 824 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/MemoryCache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698