| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 UpdateForAccess, | 70 UpdateForAccess, |
| 71 UpdateForPropertyChange | 71 UpdateForPropertyChange |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 // MemoryCacheEntry class is used only in MemoryCache class, but we don't make | 74 // MemoryCacheEntry class is used only in MemoryCache class, but we don't make |
| 75 // MemoryCacheEntry class an inner class of MemoryCache because of dependency | 75 // MemoryCacheEntry class an inner class of MemoryCache because of dependency |
| 76 // from MemoryCacheLRUList. | 76 // from MemoryCacheLRUList. |
| 77 class MemoryCacheEntry final { | 77 class MemoryCacheEntry final { |
| 78 public: | 78 public: |
| 79 static PassOwnPtr<MemoryCacheEntry> create(Resource* resource) { return adop
tPtr(new MemoryCacheEntry(resource)); } | 79 static PassOwnPtr<MemoryCacheEntry> create(Resource* resource) { return adop
tPtr(new MemoryCacheEntry(resource)); } |
| 80 void trace(Visitor*); | |
| 81 | 80 |
| 82 ResourcePtr<Resource> m_resource; | 81 ResourcePtr<Resource> m_resource; |
| 83 bool m_inLiveDecodedResourcesList; | 82 bool m_inLiveDecodedResourcesList; |
| 84 unsigned m_accessCount; | 83 unsigned m_accessCount; |
| 85 MemoryCacheLiveResourcePriority m_liveResourcePriority; | 84 MemoryCacheLiveResourcePriority m_liveResourcePriority; |
| 86 double m_lastDecodedAccessTime; // Used as a thrash guard | 85 double m_lastDecodedAccessTime; // Used as a thrash guard |
| 87 | 86 |
| 88 RawPtr<MemoryCacheEntry> m_previousInLiveResourcesList; | 87 RawPtr<MemoryCacheEntry> m_previousInLiveResourcesList; |
| 89 RawPtr<MemoryCacheEntry> m_nextInLiveResourcesList; | 88 RawPtr<MemoryCacheEntry> m_nextInLiveResourcesList; |
| 90 RawPtr<MemoryCacheEntry> m_previousInAllResourcesList; | 89 RawPtr<MemoryCacheEntry> m_previousInAllResourcesList; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 108 // MemoryCacheLRUList is used only in MemoryCache class, but we don't make | 107 // MemoryCacheLRUList is used only in MemoryCache class, but we don't make |
| 109 // MemoryCacheLRUList an inner struct of MemoryCache because we can't define | 108 // MemoryCacheLRUList an inner struct of MemoryCache because we can't define |
| 110 // VectorTraits for inner structs. | 109 // VectorTraits for inner structs. |
| 111 struct MemoryCacheLRUList final { | 110 struct MemoryCacheLRUList final { |
| 112 ALLOW_ONLY_INLINE_ALLOCATION(); | 111 ALLOW_ONLY_INLINE_ALLOCATION(); |
| 113 public: | 112 public: |
| 114 RawPtr<MemoryCacheEntry> m_head; | 113 RawPtr<MemoryCacheEntry> m_head; |
| 115 RawPtr<MemoryCacheEntry> m_tail; | 114 RawPtr<MemoryCacheEntry> m_tail; |
| 116 | 115 |
| 117 MemoryCacheLRUList() : m_head(nullptr), m_tail(nullptr) { } | 116 MemoryCacheLRUList() : m_head(nullptr), m_tail(nullptr) { } |
| 118 void trace(Visitor*); | |
| 119 }; | 117 }; |
| 120 | 118 |
| 121 } | 119 } |
| 122 | 120 |
| 123 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::MemoryCacheLRUList); | 121 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::MemoryCacheLRUList); |
| 124 | 122 |
| 125 namespace blink { | 123 namespace blink { |
| 126 | 124 |
| 127 class MemoryCache final { | 125 class MemoryCache final { |
| 128 WTF_MAKE_NONCOPYABLE(MemoryCache); WTF_MAKE_FAST_ALLOCATED; | 126 WTF_MAKE_NONCOPYABLE(MemoryCache); WTF_MAKE_FAST_ALLOCATED; |
| 129 public: | 127 public: |
| 130 static PassOwnPtr<MemoryCache> create(); | 128 static PassOwnPtr<MemoryCache> create(); |
| 131 ~MemoryCache(); | 129 ~MemoryCache(); |
| 132 void trace(Visitor*); | |
| 133 | 130 |
| 134 struct TypeStatistic { | 131 struct TypeStatistic { |
| 135 int count; | 132 int count; |
| 136 int size; | 133 int size; |
| 137 int liveSize; | 134 int liveSize; |
| 138 int decodedSize; | 135 int decodedSize; |
| 139 int encodedSize; | 136 int encodedSize; |
| 140 int encodedSizeDuplicatedInDataURLs; | 137 int encodedSizeDuplicatedInDataURLs; |
| 141 int purgeableSize; | 138 int purgeableSize; |
| 142 int purgedSize; | 139 int purgedSize; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 // Returns the global cache. | 283 // Returns the global cache. |
| 287 MemoryCache* memoryCache(); | 284 MemoryCache* memoryCache(); |
| 288 | 285 |
| 289 // Sets the global cache, used to swap in a test instance. Returns the old | 286 // Sets the global cache, used to swap in a test instance. Returns the old |
| 290 // MemoryCache object. | 287 // MemoryCache object. |
| 291 PassOwnPtr<MemoryCache> replaceMemoryCacheForTesting(PassOwnPtr<MemoryCache>); | 288 PassOwnPtr<MemoryCache> replaceMemoryCacheForTesting(PassOwnPtr<MemoryCache>); |
| 292 | 289 |
| 293 } | 290 } |
| 294 | 291 |
| 295 #endif | 292 #endif |
| OLD | NEW |