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) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 4 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
5 | 5 |
6 This library is free software; you can redistribute it and/or | 6 This library is free software; you can redistribute it and/or |
7 modify it under the terms of the GNU Library General Public | 7 modify it under the terms of the GNU Library General Public |
8 License as published by the Free Software Foundation; either | 8 License as published by the Free Software Foundation; either |
9 version 2 of the License, or (at your option) any later version. | 9 version 2 of the License, or (at your option) any later version. |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 bool m_inLiveDecodedResourcesList; | 79 bool m_inLiveDecodedResourcesList; |
80 unsigned m_accessCount; | 80 unsigned m_accessCount; |
81 double m_lastDecodedAccessTime; // Used as a thrash guard | 81 double m_lastDecodedAccessTime; // Used as a thrash guard |
82 | 82 |
83 Member<MemoryCacheEntry> m_previousInLiveResourcesList; | 83 Member<MemoryCacheEntry> m_previousInLiveResourcesList; |
84 Member<MemoryCacheEntry> m_nextInLiveResourcesList; | 84 Member<MemoryCacheEntry> m_nextInLiveResourcesList; |
85 Member<MemoryCacheEntry> m_previousInAllResourcesList; | 85 Member<MemoryCacheEntry> m_previousInAllResourcesList; |
86 Member<MemoryCacheEntry> m_nextInAllResourcesList; | 86 Member<MemoryCacheEntry> m_nextInAllResourcesList; |
87 | 87 |
88 private: | 88 private: |
89 explicit MemoryCacheEntry(Resource* resource) | 89 explicit MemoryCacheEntry(Resource*); |
90 : m_inLiveDecodedResourcesList(false) | |
91 , m_accessCount(0) | |
92 , m_lastDecodedAccessTime(0.0) | |
93 , m_previousInLiveResourcesList(nullptr) | |
94 , m_nextInLiveResourcesList(nullptr) | |
95 , m_previousInAllResourcesList(nullptr) | |
96 , m_nextInAllResourcesList(nullptr) | |
97 , m_resource(resource) | |
98 { | |
99 } | |
100 | 90 |
| 91 // Only one of |m_resource| or |m_resourceWeak| is used, based on |
| 92 // RuntimeEnabledFeatures::weakMemoryCacheEnabled(). |
| 93 // TODO(hiroshige): this switching mechanism is added for a field trial |
| 94 // for Weak MemoryCache (https://crbug.com/603462) and should be reverted |
| 95 // at least before going stable. |
101 Member<Resource> m_resource; | 96 Member<Resource> m_resource; |
| 97 WeakMember<Resource> m_resourceWeak; |
102 }; | 98 }; |
103 | 99 |
104 WILL_NOT_BE_EAGERLY_TRACED_CLASS(MemoryCacheEntry); | 100 WILL_NOT_BE_EAGERLY_TRACED_CLASS(MemoryCacheEntry); |
105 | 101 |
106 // MemoryCacheLRUList is used only in MemoryCache class, but we don't make | 102 // MemoryCacheLRUList is used only in MemoryCache class, but we don't make |
107 // MemoryCacheLRUList an inner struct of MemoryCache because we can't define | 103 // MemoryCacheLRUList an inner struct of MemoryCache because we can't define |
108 // VectorTraits for inner structs. | 104 // VectorTraits for inner structs. |
109 struct MemoryCacheLRUList final { | 105 struct MemoryCacheLRUList final { |
110 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 106 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
111 public: | 107 public: |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 // Returns the global cache. | 305 // Returns the global cache. |
310 CORE_EXPORT MemoryCache* memoryCache(); | 306 CORE_EXPORT MemoryCache* memoryCache(); |
311 | 307 |
312 // Sets the global cache, used to swap in a test instance. Returns the old | 308 // Sets the global cache, used to swap in a test instance. Returns the old |
313 // MemoryCache object. | 309 // MemoryCache object. |
314 CORE_EXPORT MemoryCache* replaceMemoryCacheForTesting(MemoryCache*); | 310 CORE_EXPORT MemoryCache* replaceMemoryCacheForTesting(MemoryCache*); |
315 | 311 |
316 } // namespace blink | 312 } // namespace blink |
317 | 313 |
318 #endif | 314 #endif |
OLD | NEW |