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, 2009, 2010, 2011 Apple Inc. All
rights reserved. | 4 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
rights reserved. |
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 class CachedScript; | 49 class CachedScript; |
50 class CachedShader; | 50 class CachedShader; |
51 class CachedTextTrack; | 51 class CachedTextTrack; |
52 class CachedXSLStyleSheet; | 52 class CachedXSLStyleSheet; |
53 class Document; | 53 class Document; |
54 class DocumentLoader; | 54 class DocumentLoader; |
55 class Frame; | 55 class Frame; |
56 class FrameLoader; | 56 class FrameLoader; |
57 class ImageLoader; | 57 class ImageLoader; |
58 class KURL; | 58 class KURL; |
| 59 class ResourceTimingInfo; |
59 | 60 |
60 // The CachedResourceLoader provides a per-context interface to the MemoryCache | 61 // The CachedResourceLoader provides a per-context interface to the MemoryCache |
61 // and enforces a bunch of security checks and rules for resource revalidation. | 62 // and enforces a bunch of security checks and rules for resource revalidation. |
62 // Its lifetime is roughly per-DocumentLoader, in that it is generally created | 63 // Its lifetime is roughly per-DocumentLoader, in that it is generally created |
63 // in the DocumentLoader constructor and loses its ability to generate network | 64 // in the DocumentLoader constructor and loses its ability to generate network |
64 // requests when the DocumentLoader is destroyed. Documents also hold a | 65 // requests when the DocumentLoader is destroyed. Documents also hold a |
65 // RefPtr<CachedResourceLoader> for their lifetime (and will create one if they | 66 // RefPtr<CachedResourceLoader> for their lifetime (and will create one if they |
66 // are initialized without a Frame), so a Document can keep a CachedResourceLoad
er | 67 // are initialized without a Frame), so a Document can keep a CachedResourceLoad
er |
67 // alive past detach if scripts still reference the Document. | 68 // alive past detach if scripts still reference the Document. |
68 class CachedResourceLoader : public RefCounted<CachedResourceLoader>, public Res
ourceLoaderHost { | 69 class CachedResourceLoader : public RefCounted<CachedResourceLoader>, public Res
ourceLoaderHost { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 void preload(CachedResource::Type, CachedResourceRequest&, const String& cha
rset); | 126 void preload(CachedResource::Type, CachedResourceRequest&, const String& cha
rset); |
126 void checkForPendingPreloads(); | 127 void checkForPendingPreloads(); |
127 void printPreloadStats(); | 128 void printPreloadStats(); |
128 bool canRequest(CachedResource::Type, const KURL&, const ResourceLoaderOptio
ns&, bool forPreload = false); | 129 bool canRequest(CachedResource::Type, const KURL&, const ResourceLoaderOptio
ns&, bool forPreload = false); |
129 bool canAccess(CachedResource*); | 130 bool canAccess(CachedResource*); |
130 | 131 |
131 // ResourceLoaderHost | 132 // ResourceLoaderHost |
132 virtual void incrementRequestCount(const CachedResource*) OVERRIDE; | 133 virtual void incrementRequestCount(const CachedResource*) OVERRIDE; |
133 virtual void decrementRequestCount(const CachedResource*) OVERRIDE; | 134 virtual void decrementRequestCount(const CachedResource*) OVERRIDE; |
134 virtual void didLoadResource(CachedResource*) OVERRIDE; | 135 virtual void didLoadResource(CachedResource*) OVERRIDE; |
| 136 virtual void redirectReceived(CachedResource*, const ResourceResponse&) OVER
RIDE; |
135 virtual void didFinishLoading(const CachedResource*, double finishTime, cons
t ResourceLoaderOptions&) OVERRIDE; | 137 virtual void didFinishLoading(const CachedResource*, double finishTime, cons
t ResourceLoaderOptions&) OVERRIDE; |
136 virtual void didChangeLoadingPriority(const CachedResource*, ResourceLoadPri
ority) OVERRIDE; | 138 virtual void didChangeLoadingPriority(const CachedResource*, ResourceLoadPri
ority) OVERRIDE; |
137 virtual void didFailLoading(const CachedResource*, const ResourceError&, con
st ResourceLoaderOptions&) OVERRIDE; | 139 virtual void didFailLoading(const CachedResource*, const ResourceError&, con
st ResourceLoaderOptions&) OVERRIDE; |
138 virtual void willSendRequest(const CachedResource*, ResourceRequest&, const
ResourceResponse& redirectResponse, const ResourceLoaderOptions&) OVERRIDE; | 140 virtual void willSendRequest(const CachedResource*, ResourceRequest&, const
ResourceResponse& redirectResponse, const ResourceLoaderOptions&) OVERRIDE; |
139 virtual void didReceiveResponse(const CachedResource*, const ResourceRespons
e&, const ResourceLoaderOptions&) OVERRIDE; | 141 virtual void didReceiveResponse(const CachedResource*, const ResourceRespons
e&, const ResourceLoaderOptions&) OVERRIDE; |
140 virtual void didReceiveData(const CachedResource*, const char* data, int dat
aLength, int encodedDataLength, const ResourceLoaderOptions&) OVERRIDE; | 142 virtual void didReceiveData(const CachedResource*, const char* data, int dat
aLength, int encodedDataLength, const ResourceLoaderOptions&) OVERRIDE; |
141 virtual void subresourceLoaderFinishedLoadingOnePart(ResourceLoader*) OVERRI
DE; | 143 virtual void subresourceLoaderFinishedLoadingOnePart(ResourceLoader*) OVERRI
DE; |
142 virtual void didInitializeResourceLoader(ResourceLoader*) OVERRIDE; | 144 virtual void didInitializeResourceLoader(ResourceLoader*) OVERRIDE; |
143 virtual void willTerminateResourceLoader(ResourceLoader*) OVERRIDE; | 145 virtual void willTerminateResourceLoader(ResourceLoader*) OVERRIDE; |
144 virtual void willStartLoadingResource(ResourceRequest&) OVERRIDE; | 146 virtual void willStartLoadingResource(ResourceRequest&) OVERRIDE; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 OwnPtr<ListHashSet<CachedResource*> > m_preloads; | 191 OwnPtr<ListHashSet<CachedResource*> > m_preloads; |
190 struct PendingPreload { | 192 struct PendingPreload { |
191 CachedResource::Type m_type; | 193 CachedResource::Type m_type; |
192 CachedResourceRequest m_request; | 194 CachedResourceRequest m_request; |
193 String m_charset; | 195 String m_charset; |
194 }; | 196 }; |
195 Deque<PendingPreload> m_pendingPreloads; | 197 Deque<PendingPreload> m_pendingPreloads; |
196 | 198 |
197 Timer<CachedResourceLoader> m_garbageCollectDocumentResourcesTimer; | 199 Timer<CachedResourceLoader> m_garbageCollectDocumentResourcesTimer; |
198 | 200 |
199 HashMap<CachedResource*, CachedResourceInitiatorInfo> m_initiatorMap; | 201 typedef HashMap<CachedResource*, RefPtr<ResourceTimingInfo> > ResourceTiming
InfoMap; |
| 202 ResourceTimingInfoMap m_resourceTimingInfoMap; |
200 | 203 |
201 // 29 bits left | 204 // 29 bits left |
202 bool m_autoLoadImages : 1; | 205 bool m_autoLoadImages : 1; |
203 bool m_imagesEnabled : 1; | 206 bool m_imagesEnabled : 1; |
204 bool m_allowStaleResources : 1; | 207 bool m_allowStaleResources : 1; |
205 }; | 208 }; |
206 | 209 |
207 class ResourceCacheValidationSuppressor { | 210 class ResourceCacheValidationSuppressor { |
208 WTF_MAKE_NONCOPYABLE(ResourceCacheValidationSuppressor); | 211 WTF_MAKE_NONCOPYABLE(ResourceCacheValidationSuppressor); |
209 WTF_MAKE_FAST_ALLOCATED; | 212 WTF_MAKE_FAST_ALLOCATED; |
(...skipping 13 matching lines...) Expand all Loading... |
223 m_loader->m_allowStaleResources = m_previousState; | 226 m_loader->m_allowStaleResources = m_previousState; |
224 } | 227 } |
225 private: | 228 private: |
226 CachedResourceLoader* m_loader; | 229 CachedResourceLoader* m_loader; |
227 bool m_previousState; | 230 bool m_previousState; |
228 }; | 231 }; |
229 | 232 |
230 } // namespace WebCore | 233 } // namespace WebCore |
231 | 234 |
232 #endif | 235 #endif |
OLD | NEW |