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

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

Issue 1310643003: Make classes and structures in core/events and core/fetch fast-allocated. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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
(...skipping 11 matching lines...) Expand all
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 "core/fetch/ResourcePtr.h" 30 #include "core/fetch/ResourcePtr.h"
31 #include "public/platform/WebThread.h" 31 #include "public/platform/WebThread.h"
32 #include "wtf/Allocator.h"
32 #include "wtf/HashMap.h" 33 #include "wtf/HashMap.h"
33 #include "wtf/Noncopyable.h" 34 #include "wtf/Noncopyable.h"
34 #include "wtf/Vector.h" 35 #include "wtf/Vector.h"
35 #include "wtf/text/StringHash.h" 36 #include "wtf/text/StringHash.h"
36 #include "wtf/text/WTFString.h" 37 #include "wtf/text/WTFString.h"
37 38
38 namespace blink { 39 namespace blink {
39 40
40 class Resource; 41 class Resource;
41 class KURL; 42 class KURL;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 namespace blink { 131 namespace blink {
131 132
132 class CORE_EXPORT MemoryCache final : public GarbageCollectedFinalized<MemoryCac he>, public WebThread::TaskObserver { 133 class CORE_EXPORT MemoryCache final : public GarbageCollectedFinalized<MemoryCac he>, public WebThread::TaskObserver {
133 WTF_MAKE_NONCOPYABLE(MemoryCache); 134 WTF_MAKE_NONCOPYABLE(MemoryCache);
134 public: 135 public:
135 static MemoryCache* create(); 136 static MemoryCache* create();
136 ~MemoryCache(); 137 ~MemoryCache();
137 DECLARE_TRACE(); 138 DECLARE_TRACE();
138 139
139 struct TypeStatistic { 140 struct TypeStatistic {
141 STACK_ALLOCATED();
140 size_t count; 142 size_t count;
141 size_t size; 143 size_t size;
142 size_t liveSize; 144 size_t liveSize;
143 size_t decodedSize; 145 size_t decodedSize;
144 size_t encodedSize; 146 size_t encodedSize;
145 size_t encodedSizeDuplicatedInDataURLs; 147 size_t encodedSizeDuplicatedInDataURLs;
146 size_t purgeableSize; 148 size_t purgeableSize;
147 size_t purgedSize; 149 size_t purgedSize;
148 150
149 TypeStatistic() 151 TypeStatistic()
150 : count(0) 152 : count(0)
151 , size(0) 153 , size(0)
152 , liveSize(0) 154 , liveSize(0)
153 , decodedSize(0) 155 , decodedSize(0)
154 , encodedSize(0) 156 , encodedSize(0)
155 , encodedSizeDuplicatedInDataURLs(0) 157 , encodedSizeDuplicatedInDataURLs(0)
156 , purgeableSize(0) 158 , purgeableSize(0)
157 , purgedSize(0) 159 , purgedSize(0)
158 { 160 {
159 } 161 }
160 162
161 void addResource(Resource*); 163 void addResource(Resource*);
162 }; 164 };
163 165
164 struct Statistics { 166 struct Statistics {
167 STACK_ALLOCATED();
165 TypeStatistic images; 168 TypeStatistic images;
166 TypeStatistic cssStyleSheets; 169 TypeStatistic cssStyleSheets;
167 TypeStatistic scripts; 170 TypeStatistic scripts;
168 TypeStatistic xslStyleSheets; 171 TypeStatistic xslStyleSheets;
169 TypeStatistic fonts; 172 TypeStatistic fonts;
170 TypeStatistic other; 173 TypeStatistic other;
171 }; 174 };
172 175
173 Resource* resourceForURL(const KURL&); 176 Resource* resourceForURL(const KURL&);
174 Resource* resourceForURL(const KURL&, const String& cacheIdentifier); 177 Resource* resourceForURL(const KURL&, const String& cacheIdentifier);
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 // Returns the global cache. 325 // Returns the global cache.
323 CORE_EXPORT MemoryCache* memoryCache(); 326 CORE_EXPORT MemoryCache* memoryCache();
324 327
325 // Sets the global cache, used to swap in a test instance. Returns the old 328 // Sets the global cache, used to swap in a test instance. Returns the old
326 // MemoryCache object. 329 // MemoryCache object.
327 CORE_EXPORT MemoryCache* replaceMemoryCacheForTesting(MemoryCache*); 330 CORE_EXPORT MemoryCache* replaceMemoryCacheForTesting(MemoryCache*);
328 331
329 } 332 }
330 333
331 #endif 334 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698