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

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

Issue 1999613002: Move WebCacheMemoryDumpProvider to platform (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix link error on win Created 4 years, 7 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
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
11 This library is distributed in the hope that it will be useful, 11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details. 14 Library General Public License for more details.
15 15
16 You should have received a copy of the GNU Library General Public License 16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to 17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA. 19 Boston, MA 02110-1301, USA.
20 20
21 This class provides all functionality needed for loading images, style sheet s and html 21 This class provides all functionality needed for loading images, style sheet s and html
22 pages from the web. It has a memory cache for these objects. 22 pages from the web. It has a memory cache for these objects.
23 */ 23 */
24 24
25 #ifndef MemoryCache_h 25 #ifndef MemoryCache_h
26 #define MemoryCache_h 26 #define MemoryCache_h
27 27
28 #include "core/CoreExport.h" 28 #include "core/CoreExport.h"
29 #include "core/fetch/Resource.h" 29 #include "core/fetch/Resource.h"
30 #include "public/platform/WebMemoryDumpProvider.h" 30 #include "platform/MemoryCacheDumpProvider.h"
31 #include "public/platform/WebThread.h" 31 #include "public/platform/WebThread.h"
32 #include "wtf/Allocator.h" 32 #include "wtf/Allocator.h"
33 #include "wtf/HashMap.h" 33 #include "wtf/HashMap.h"
34 #include "wtf/Noncopyable.h" 34 #include "wtf/Noncopyable.h"
35 #include "wtf/Vector.h" 35 #include "wtf/Vector.h"
36 #include "wtf/text/StringHash.h" 36 #include "wtf/text/StringHash.h"
37 #include "wtf/text/WTFString.h" 37 #include "wtf/text/WTFString.h"
38 38
39 namespace blink { 39 namespace blink {
40 40
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 MemoryCacheLRUList() : m_head(nullptr), m_tail(nullptr) { } 115 MemoryCacheLRUList() : m_head(nullptr), m_tail(nullptr) { }
116 DECLARE_TRACE(); 116 DECLARE_TRACE();
117 }; 117 };
118 118
119 } // namespace blink 119 } // namespace blink
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 CORE_EXPORT MemoryCache final : public GarbageCollectedFinalized<MemoryCac he>, public WebThread::TaskObserver { 125 class CORE_EXPORT MemoryCache final : public GarbageCollectedFinalized<MemoryCac he>, public WebThread::TaskObserver, public MemoryCacheDumpClient {
126 USING_GARBAGE_COLLECTED_MIXIN(MemoryCache);
126 WTF_MAKE_NONCOPYABLE(MemoryCache); 127 WTF_MAKE_NONCOPYABLE(MemoryCache);
127 public: 128 public:
128 static MemoryCache* create(); 129 static MemoryCache* create();
129 ~MemoryCache(); 130 ~MemoryCache();
130 DECLARE_TRACE(); 131 DECLARE_TRACE();
131 132
132 struct TypeStatistic { 133 struct TypeStatistic {
133 STACK_ALLOCATED(); 134 STACK_ALLOCATED();
134 size_t count; 135 size_t count;
135 size_t size; 136 size_t size;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 216
216 // TaskObserver implementation 217 // TaskObserver implementation
217 void willProcessTask() override; 218 void willProcessTask() override;
218 void didProcessTask() override; 219 void didProcessTask() override;
219 220
220 void pruneAll(); 221 void pruneAll();
221 222
222 void updateFramePaintTimestamp(); 223 void updateFramePaintTimestamp();
223 224
224 // Take memory usage snapshot for tracing. 225 // Take memory usage snapshot for tracing.
225 void onMemoryDump(WebMemoryDumpLevelOfDetail, WebProcessMemoryDump*); 226 bool onMemoryDump(WebMemoryDumpLevelOfDetail, WebProcessMemoryDump*) overrid e;
226 227
227 bool isInSameLRUListForTest(const Resource*, const Resource*); 228 bool isInSameLRUListForTest(const Resource*, const Resource*);
228 private: 229 private:
229 enum PruneStrategy { 230 enum PruneStrategy {
230 // Automatically decide how much to prune. 231 // Automatically decide how much to prune.
231 AutomaticPrune, 232 AutomaticPrune,
232 // Maximally prune resources. 233 // Maximally prune resources.
233 MaximalPrune 234 MaximalPrune
234 }; 235 };
235 236
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 // Returns the global cache. 309 // Returns the global cache.
309 CORE_EXPORT MemoryCache* memoryCache(); 310 CORE_EXPORT MemoryCache* memoryCache();
310 311
311 // Sets the global cache, used to swap in a test instance. Returns the old 312 // Sets the global cache, used to swap in a test instance. Returns the old
312 // MemoryCache object. 313 // MemoryCache object.
313 CORE_EXPORT MemoryCache* replaceMemoryCacheForTesting(MemoryCache*); 314 CORE_EXPORT MemoryCache* replaceMemoryCacheForTesting(MemoryCache*);
314 315
315 } // namespace blink 316 } // namespace blink
316 317
317 #endif 318 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('k') | third_party/WebKit/Source/core/fetch/MemoryCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698