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 |
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 | 21 This class provides all functionality needed for loading images, style |
22 sheets and html | 22 sheets and html |
23 pages from the web. It has a memory cache for these objects. | 23 pages from the web. It has a memory cache for these objects. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef MemoryCache_h | 26 #ifndef MemoryCache_h |
27 #define MemoryCache_h | 27 #define MemoryCache_h |
28 | 28 |
29 #include "core/CoreExport.h" | |
30 #include "core/fetch/Resource.h" | |
31 #include "platform/MemoryCoordinator.h" | 29 #include "platform/MemoryCoordinator.h" |
| 30 #include "platform/PlatformExport.h" |
32 #include "platform/instrumentation/tracing/MemoryCacheDumpProvider.h" | 31 #include "platform/instrumentation/tracing/MemoryCacheDumpProvider.h" |
| 32 #include "platform/loader/fetch/Resource.h" |
33 #include "public/platform/WebThread.h" | 33 #include "public/platform/WebThread.h" |
34 #include "wtf/Allocator.h" | 34 #include "wtf/Allocator.h" |
35 #include "wtf/HashMap.h" | 35 #include "wtf/HashMap.h" |
36 #include "wtf/Noncopyable.h" | 36 #include "wtf/Noncopyable.h" |
37 #include "wtf/Vector.h" | 37 #include "wtf/Vector.h" |
38 #include "wtf/text/StringHash.h" | 38 #include "wtf/text/StringHash.h" |
39 #include "wtf/text/WTFString.h" | 39 #include "wtf/text/WTFString.h" |
40 | 40 |
41 namespace blink { | 41 namespace blink { |
42 | 42 |
(...skipping 20 matching lines...) Expand all Loading... |
63 | 63 |
64 void clearResourceWeak(Visitor*); | 64 void clearResourceWeak(Visitor*); |
65 | 65 |
66 WeakMember<Resource> m_resource; | 66 WeakMember<Resource> m_resource; |
67 }; | 67 }; |
68 | 68 |
69 WILL_NOT_BE_EAGERLY_TRACED_CLASS(MemoryCacheEntry); | 69 WILL_NOT_BE_EAGERLY_TRACED_CLASS(MemoryCacheEntry); |
70 | 70 |
71 // This cache holds subresources used by Web pages: images, scripts, | 71 // This cache holds subresources used by Web pages: images, scripts, |
72 // stylesheets, etc. | 72 // stylesheets, etc. |
73 class CORE_EXPORT MemoryCache final | 73 class PLATFORM_EXPORT MemoryCache final |
74 : public GarbageCollectedFinalized<MemoryCache>, | 74 : public GarbageCollectedFinalized<MemoryCache>, |
75 public WebThread::TaskObserver, | 75 public WebThread::TaskObserver, |
76 public MemoryCacheDumpClient, | 76 public MemoryCacheDumpClient, |
77 public MemoryCoordinatorClient { | 77 public MemoryCoordinatorClient { |
78 USING_GARBAGE_COLLECTED_MIXIN(MemoryCache); | 78 USING_GARBAGE_COLLECTED_MIXIN(MemoryCache); |
79 WTF_MAKE_NONCOPYABLE(MemoryCache); | 79 WTF_MAKE_NONCOPYABLE(MemoryCache); |
80 | 80 |
81 public: | 81 public: |
82 static MemoryCache* create(); | 82 static MemoryCache* create(); |
83 ~MemoryCache(); | 83 ~MemoryCache(); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 size_t m_capacity; | 202 size_t m_capacity; |
203 double m_delayBeforeLiveDecodedPrune; | 203 double m_delayBeforeLiveDecodedPrune; |
204 | 204 |
205 // The number of bytes currently consumed by resources in the cache. | 205 // The number of bytes currently consumed by resources in the cache. |
206 size_t m_size; | 206 size_t m_size; |
207 | 207 |
208 friend class MemoryCacheTest; | 208 friend class MemoryCacheTest; |
209 }; | 209 }; |
210 | 210 |
211 // Returns the global cache. | 211 // Returns the global cache. |
212 CORE_EXPORT MemoryCache* memoryCache(); | 212 PLATFORM_EXPORT MemoryCache* memoryCache(); |
213 | 213 |
214 // Sets the global cache, used to swap in a test instance. Returns the old | 214 // Sets the global cache, used to swap in a test instance. Returns the old |
215 // MemoryCache object. | 215 // MemoryCache object. |
216 CORE_EXPORT MemoryCache* replaceMemoryCacheForTesting(MemoryCache*); | 216 PLATFORM_EXPORT MemoryCache* replaceMemoryCacheForTesting(MemoryCache*); |
217 | 217 |
218 } // namespace blink | 218 } // namespace blink |
219 | 219 |
220 #endif | 220 #endif |
OLD | NEW |