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

Side by Side Diff: Source/core/fetch/MemoryCache.h

Issue 631223002: Replace FINAL and OVERRIDE with their C++11 counterparts in Source/core/[fetch|fileapi] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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 | « Source/core/fetch/ImageResourceClient.h ('k') | Source/core/fetch/MemoryCacheTest.cpp » ('j') | 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) 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 }; 65 };
66 66
67 enum UpdateReason { 67 enum UpdateReason {
68 UpdateForAccess, 68 UpdateForAccess,
69 UpdateForPropertyChange 69 UpdateForPropertyChange
70 }; 70 };
71 71
72 // MemoryCacheEntry class is used only in MemoryCache class, but we don't make 72 // MemoryCacheEntry class is used only in MemoryCache class, but we don't make
73 // MemoryCacheEntry class an inner class of MemoryCache because of dependency 73 // MemoryCacheEntry class an inner class of MemoryCache because of dependency
74 // from MemoryCacheLRUList. 74 // from MemoryCacheLRUList.
75 class MemoryCacheEntry FINAL : public NoBaseWillBeGarbageCollectedFinalized<Memo ryCacheEntry> { 75 class MemoryCacheEntry final : public NoBaseWillBeGarbageCollectedFinalized<Memo ryCacheEntry> {
76 public: 76 public:
77 static PassOwnPtrWillBeRawPtr<MemoryCacheEntry> create(Resource* resource) { return adoptPtrWillBeNoop(new MemoryCacheEntry(resource)); } 77 static PassOwnPtrWillBeRawPtr<MemoryCacheEntry> create(Resource* resource) { return adoptPtrWillBeNoop(new MemoryCacheEntry(resource)); }
78 void trace(Visitor*); 78 void trace(Visitor*);
79 79
80 ResourcePtr<Resource> m_resource; 80 ResourcePtr<Resource> m_resource;
81 bool m_inLiveDecodedResourcesList; 81 bool m_inLiveDecodedResourcesList;
82 unsigned m_accessCount; 82 unsigned m_accessCount;
83 MemoryCacheLiveResourcePriority m_liveResourcePriority; 83 MemoryCacheLiveResourcePriority m_liveResourcePriority;
84 double m_lastDecodedAccessTime; // Used as a thrash guard 84 double m_lastDecodedAccessTime; // Used as a thrash guard
85 85
(...skipping 13 matching lines...) Expand all
99 , m_nextInLiveResourcesList(nullptr) 99 , m_nextInLiveResourcesList(nullptr)
100 , m_previousInAllResourcesList(nullptr) 100 , m_previousInAllResourcesList(nullptr)
101 , m_nextInAllResourcesList(nullptr) 101 , m_nextInAllResourcesList(nullptr)
102 { 102 {
103 } 103 }
104 }; 104 };
105 105
106 // MemoryCacheLRUList is used only in MemoryCache class, but we don't make 106 // MemoryCacheLRUList is used only in MemoryCache class, but we don't make
107 // MemoryCacheLRUList an inner struct of MemoryCache because we can't define 107 // MemoryCacheLRUList an inner struct of MemoryCache because we can't define
108 // VectorTraits for inner structs. 108 // VectorTraits for inner structs.
109 struct MemoryCacheLRUList FINAL { 109 struct MemoryCacheLRUList final {
110 ALLOW_ONLY_INLINE_ALLOCATION(); 110 ALLOW_ONLY_INLINE_ALLOCATION();
111 public: 111 public:
112 RawPtrWillBeMember<MemoryCacheEntry> m_head; 112 RawPtrWillBeMember<MemoryCacheEntry> m_head;
113 RawPtrWillBeMember<MemoryCacheEntry> m_tail; 113 RawPtrWillBeMember<MemoryCacheEntry> m_tail;
114 114
115 MemoryCacheLRUList() : m_head(nullptr), m_tail(nullptr) { } 115 MemoryCacheLRUList() : m_head(nullptr), m_tail(nullptr) { }
116 void trace(Visitor*); 116 void trace(Visitor*);
117 }; 117 };
118 118
119 } 119 }
120 120
121 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::MemoryCacheLRUList); 121 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::MemoryCacheLRUList);
122 122
123 namespace blink { 123 namespace blink {
124 124
125 class MemoryCache FINAL : public NoBaseWillBeGarbageCollectedFinalized<MemoryCac he>, public WebThread::TaskObserver { 125 class MemoryCache final : public NoBaseWillBeGarbageCollectedFinalized<MemoryCac he>, public WebThread::TaskObserver {
126 WTF_MAKE_NONCOPYABLE(MemoryCache); WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; 126 WTF_MAKE_NONCOPYABLE(MemoryCache); WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
127 public: 127 public:
128 static PassOwnPtrWillBeRawPtr<MemoryCache> create(); 128 static PassOwnPtrWillBeRawPtr<MemoryCache> create();
129 ~MemoryCache(); 129 ~MemoryCache();
130 void trace(Visitor*); 130 void trace(Visitor*);
131 131
132 struct TypeStatistic { 132 struct TypeStatistic {
133 int count; 133 int count;
134 int size; 134 int size;
135 int liveSize; 135 int liveSize;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 size_t minDeadCapacity() const { return m_minDeadCapacity; } 205 size_t minDeadCapacity() const { return m_minDeadCapacity; }
206 size_t maxDeadCapacity() const { return m_maxDeadCapacity; } 206 size_t maxDeadCapacity() const { return m_maxDeadCapacity; }
207 size_t capacity() const { return m_capacity; } 207 size_t capacity() const { return m_capacity; }
208 size_t liveSize() const { return m_liveSize; } 208 size_t liveSize() const { return m_liveSize; }
209 size_t deadSize() const { return m_deadSize; } 209 size_t deadSize() const { return m_deadSize; }
210 210
211 // Exposed for testing 211 // Exposed for testing
212 MemoryCacheLiveResourcePriority priority(Resource*) const; 212 MemoryCacheLiveResourcePriority priority(Resource*) const;
213 213
214 // TaskObserver implementation 214 // TaskObserver implementation
215 virtual void willProcessTask() OVERRIDE; 215 virtual void willProcessTask() override;
216 virtual void didProcessTask() OVERRIDE; 216 virtual void didProcessTask() override;
217 217
218 private: 218 private:
219 MemoryCache(); 219 MemoryCache();
220 220
221 MemoryCacheLRUList* lruListFor(unsigned accessCount, size_t); 221 MemoryCacheLRUList* lruListFor(unsigned accessCount, size_t);
222 222
223 #ifdef MEMORY_CACHE_STATS 223 #ifdef MEMORY_CACHE_STATS
224 void dumpStats(Timer<MemoryCache>*); 224 void dumpStats(Timer<MemoryCache>*);
225 void dumpLRULists(bool includeLive) const; 225 void dumpLRULists(bool includeLive) const;
226 #endif 226 #endif
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 // Returns the global cache. 293 // Returns the global cache.
294 MemoryCache* memoryCache(); 294 MemoryCache* memoryCache();
295 295
296 // Sets the global cache, used to swap in a test instance. Returns the old 296 // Sets the global cache, used to swap in a test instance. Returns the old
297 // MemoryCache object. 297 // MemoryCache object.
298 PassOwnPtrWillBeRawPtr<MemoryCache> replaceMemoryCacheForTesting(PassOwnPtrWillB eRawPtr<MemoryCache>); 298 PassOwnPtrWillBeRawPtr<MemoryCache> replaceMemoryCacheForTesting(PassOwnPtrWillB eRawPtr<MemoryCache>);
299 299
300 } 300 }
301 301
302 #endif 302 #endif
OLDNEW
« no previous file with comments | « Source/core/fetch/ImageResourceClient.h ('k') | Source/core/fetch/MemoryCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698