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 Apple Computer, Inc. | 4 Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. |
5 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ | 5 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ |
6 | 6 |
7 This library is free software; you can redistribute it and/or | 7 This library is free software; you can redistribute it and/or |
8 modify it under the terms of the GNU Library General Public | 8 modify it under the terms of the GNU Library General Public |
9 License as published by the Free Software Foundation; either | 9 License as published by the Free Software Foundation; either |
10 version 2 of the License, or (at your option) any later version. | 10 version 2 of the License, or (at your option) any later version. |
(...skipping 12 matching lines...) Expand all Loading... |
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 CachedResourceLoader_h | 26 #ifndef CachedResourceLoader_h |
27 #define CachedResourceLoader_h | 27 #define CachedResourceLoader_h |
28 | 28 |
29 #include "CachedResource.h" | 29 #include "CachedResource.h" |
30 #include "CachedResourceHandle.h" | 30 #include "CachedResourceHandle.h" |
31 #include "CachePolicy.h" | 31 #include "CachePolicy.h" |
32 #include "ResourceLoadPriority.h" | 32 #include "ResourceLoadPriority.h" |
| 33 #include "Timer.h" |
33 #include <wtf/Deque.h> | 34 #include <wtf/Deque.h> |
34 #include <wtf/HashMap.h> | 35 #include <wtf/HashMap.h> |
35 #include <wtf/HashSet.h> | 36 #include <wtf/HashSet.h> |
36 #include <wtf/ListHashSet.h> | 37 #include <wtf/ListHashSet.h> |
37 #include <wtf/text/StringHash.h> | 38 #include <wtf/text/StringHash.h> |
38 | 39 |
39 namespace WebCore { | 40 namespace WebCore { |
40 | 41 |
41 class CachedCSSStyleSheet; | 42 class CachedCSSStyleSheet; |
42 class CachedFont; | 43 class CachedFont; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 CachedResource* revalidateResource(CachedResource*, ResourceLoadPriority pri
ority); | 111 CachedResource* revalidateResource(CachedResource*, ResourceLoadPriority pri
ority); |
111 CachedResource* loadResource(CachedResource::Type, ResourceRequest&, const S
tring& charset, ResourceLoadPriority); | 112 CachedResource* loadResource(CachedResource::Type, ResourceRequest&, const S
tring& charset, ResourceLoadPriority); |
112 void requestPreload(CachedResource::Type, ResourceRequest& url, const String
& charset); | 113 void requestPreload(CachedResource::Type, ResourceRequest& url, const String
& charset); |
113 | 114 |
114 enum RevalidationPolicy { Use, Revalidate, Reload, Load }; | 115 enum RevalidationPolicy { Use, Revalidate, Reload, Load }; |
115 RevalidationPolicy determineRevalidationPolicy(CachedResource::Type, Resourc
eRequest&, bool forPreload, CachedResource* existingResource) const; | 116 RevalidationPolicy determineRevalidationPolicy(CachedResource::Type, Resourc
eRequest&, bool forPreload, CachedResource* existingResource) const; |
116 | 117 |
117 void notifyLoadedFromMemoryCache(CachedResource*); | 118 void notifyLoadedFromMemoryCache(CachedResource*); |
118 bool canRequest(CachedResource::Type, const KURL&, bool forPreload = false); | 119 bool canRequest(CachedResource::Type, const KURL&, bool forPreload = false); |
119 | 120 |
| 121 void garbageCollectDocumentResourcesTimerFired(Timer<CachedResourceLoader>*)
; |
120 void performPostLoadActions(); | 122 void performPostLoadActions(); |
121 | 123 |
122 HashSet<String> m_validatedURLs; | 124 HashSet<String> m_validatedURLs; |
123 mutable DocumentResourceMap m_documentResources; | 125 mutable DocumentResourceMap m_documentResources; |
124 Document* m_document; | 126 Document* m_document; |
125 | 127 |
126 int m_requestCount; | 128 int m_requestCount; |
127 | 129 |
128 OwnPtr<ListHashSet<CachedResource*> > m_preloads; | 130 OwnPtr<ListHashSet<CachedResource*> > m_preloads; |
129 struct PendingPreload { | 131 struct PendingPreload { |
130 CachedResource::Type m_type; | 132 CachedResource::Type m_type; |
131 ResourceRequest m_request; | 133 ResourceRequest m_request; |
132 String m_charset; | 134 String m_charset; |
133 }; | 135 }; |
134 Deque<PendingPreload> m_pendingPreloads; | 136 Deque<PendingPreload> m_pendingPreloads; |
135 | 137 |
| 138 Timer<CachedResourceLoader> m_garbageCollectDocumentResourcesTimer; |
| 139 |
136 //29 bits left | 140 //29 bits left |
137 bool m_autoLoadImages : 1; | 141 bool m_autoLoadImages : 1; |
138 bool m_loadFinishing : 1; | 142 bool m_loadFinishing : 1; |
139 bool m_allowStaleResources : 1; | 143 bool m_allowStaleResources : 1; |
140 }; | 144 }; |
141 | 145 |
142 class ResourceCacheValidationSuppressor { | 146 class ResourceCacheValidationSuppressor { |
143 WTF_MAKE_NONCOPYABLE(ResourceCacheValidationSuppressor); | 147 WTF_MAKE_NONCOPYABLE(ResourceCacheValidationSuppressor); |
144 WTF_MAKE_FAST_ALLOCATED; | 148 WTF_MAKE_FAST_ALLOCATED; |
145 public: | 149 public: |
(...skipping 12 matching lines...) Expand all Loading... |
158 m_loader->m_allowStaleResources = m_previousState; | 162 m_loader->m_allowStaleResources = m_previousState; |
159 } | 163 } |
160 private: | 164 private: |
161 CachedResourceLoader* m_loader; | 165 CachedResourceLoader* m_loader; |
162 bool m_previousState; | 166 bool m_previousState; |
163 }; | 167 }; |
164 | 168 |
165 } // namespace WebCore | 169 } // namespace WebCore |
166 | 170 |
167 #endif | 171 #endif |
OLD | NEW |