| 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" | |
| 34 #include <wtf/Deque.h> | 33 #include <wtf/Deque.h> |
| 35 #include <wtf/HashMap.h> | 34 #include <wtf/HashMap.h> |
| 36 #include <wtf/HashSet.h> | 35 #include <wtf/HashSet.h> |
| 37 #include <wtf/ListHashSet.h> | 36 #include <wtf/ListHashSet.h> |
| 38 #include <wtf/text/StringHash.h> | 37 #include <wtf/text/StringHash.h> |
| 39 | 38 |
| 40 namespace WebCore { | 39 namespace WebCore { |
| 41 | 40 |
| 42 class CachedCSSStyleSheet; | 41 class CachedCSSStyleSheet; |
| 43 class CachedFont; | 42 class CachedFont; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 CachedResource* revalidateResource(CachedResource*, ResourceLoadPriority pri
ority); | 110 CachedResource* revalidateResource(CachedResource*, ResourceLoadPriority pri
ority); |
| 112 CachedResource* loadResource(CachedResource::Type, ResourceRequest&, const S
tring& charset, ResourceLoadPriority); | 111 CachedResource* loadResource(CachedResource::Type, ResourceRequest&, const S
tring& charset, ResourceLoadPriority); |
| 113 void requestPreload(CachedResource::Type, ResourceRequest& url, const String
& charset); | 112 void requestPreload(CachedResource::Type, ResourceRequest& url, const String
& charset); |
| 114 | 113 |
| 115 enum RevalidationPolicy { Use, Revalidate, Reload, Load }; | 114 enum RevalidationPolicy { Use, Revalidate, Reload, Load }; |
| 116 RevalidationPolicy determineRevalidationPolicy(CachedResource::Type, Resourc
eRequest&, bool forPreload, CachedResource* existingResource) const; | 115 RevalidationPolicy determineRevalidationPolicy(CachedResource::Type, Resourc
eRequest&, bool forPreload, CachedResource* existingResource) const; |
| 117 | 116 |
| 118 void notifyLoadedFromMemoryCache(CachedResource*); | 117 void notifyLoadedFromMemoryCache(CachedResource*); |
| 119 bool canRequest(CachedResource::Type, const KURL&, bool forPreload = false); | 118 bool canRequest(CachedResource::Type, const KURL&, bool forPreload = false); |
| 120 | 119 |
| 121 void garbageCollectDocumentResourcesTimerFired(Timer<CachedResourceLoader>*)
; | |
| 122 void performPostLoadActions(); | 120 void performPostLoadActions(); |
| 123 | 121 |
| 124 HashSet<String> m_validatedURLs; | 122 HashSet<String> m_validatedURLs; |
| 125 mutable DocumentResourceMap m_documentResources; | 123 mutable DocumentResourceMap m_documentResources; |
| 126 Document* m_document; | 124 Document* m_document; |
| 127 | 125 |
| 128 int m_requestCount; | 126 int m_requestCount; |
| 129 | 127 |
| 130 OwnPtr<ListHashSet<CachedResource*> > m_preloads; | 128 OwnPtr<ListHashSet<CachedResource*> > m_preloads; |
| 131 struct PendingPreload { | 129 struct PendingPreload { |
| 132 CachedResource::Type m_type; | 130 CachedResource::Type m_type; |
| 133 ResourceRequest m_request; | 131 ResourceRequest m_request; |
| 134 String m_charset; | 132 String m_charset; |
| 135 }; | 133 }; |
| 136 Deque<PendingPreload> m_pendingPreloads; | 134 Deque<PendingPreload> m_pendingPreloads; |
| 137 | 135 |
| 138 Timer<CachedResourceLoader> m_garbageCollectDocumentResourcesTimer; | |
| 139 | |
| 140 //29 bits left | 136 //29 bits left |
| 141 bool m_autoLoadImages : 1; | 137 bool m_autoLoadImages : 1; |
| 142 bool m_loadFinishing : 1; | 138 bool m_loadFinishing : 1; |
| 143 bool m_allowStaleResources : 1; | 139 bool m_allowStaleResources : 1; |
| 144 }; | 140 }; |
| 145 | 141 |
| 146 class ResourceCacheValidationSuppressor { | 142 class ResourceCacheValidationSuppressor { |
| 147 WTF_MAKE_NONCOPYABLE(ResourceCacheValidationSuppressor); | 143 WTF_MAKE_NONCOPYABLE(ResourceCacheValidationSuppressor); |
| 148 WTF_MAKE_FAST_ALLOCATED; | 144 WTF_MAKE_FAST_ALLOCATED; |
| 149 public: | 145 public: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 162 m_loader->m_allowStaleResources = m_previousState; | 158 m_loader->m_allowStaleResources = m_previousState; |
| 163 } | 159 } |
| 164 private: | 160 private: |
| 165 CachedResourceLoader* m_loader; | 161 CachedResourceLoader* m_loader; |
| 166 bool m_previousState; | 162 bool m_previousState; |
| 167 }; | 163 }; |
| 168 | 164 |
| 169 } // namespace WebCore | 165 } // namespace WebCore |
| 170 | 166 |
| 171 #endif | 167 #endif |
| OLD | NEW |