| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 class CachedRawResource; | 48 class CachedRawResource; |
| 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 ImageLoader; | 56 class ImageLoader; |
| 57 class KURL; | 57 class KURL; |
| 58 class ResourceTimingInfo; | |
| 59 | 58 |
| 60 // The CachedResourceLoader provides a per-context interface to the MemoryCache | 59 // The CachedResourceLoader provides a per-context interface to the MemoryCache |
| 61 // and enforces a bunch of security checks and rules for resource revalidation. | 60 // 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 | 61 // Its lifetime is roughly per-DocumentLoader, in that it is generally created |
| 63 // in the DocumentLoader constructor and loses its ability to generate network | 62 // in the DocumentLoader constructor and loses its ability to generate network |
| 64 // requests when the DocumentLoader is destroyed. Documents also hold a | 63 // requests when the DocumentLoader is destroyed. Documents also hold a |
| 65 // RefPtr<CachedResourceLoader> for their lifetime (and will create one if they | 64 // 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 | 65 // are initialized without a Frame), so a Document can keep a CachedResourceLoad
er |
| 67 // alive past detach if scripts still reference the Document. | 66 // alive past detach if scripts still reference the Document. |
| 68 class CachedResourceLoader : public RefCounted<CachedResourceLoader> { | 67 class CachedResourceLoader : public RefCounted<CachedResourceLoader> { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 106 |
| 108 Frame* frame() const; // Can be null | 107 Frame* frame() const; // Can be null |
| 109 Document* document() const { return m_document; } // Can be null | 108 Document* document() const { return m_document; } // Can be null |
| 110 void setDocument(Document* document) { m_document = document; } | 109 void setDocument(Document* document) { m_document = document; } |
| 111 | 110 |
| 112 DocumentLoader* documentLoader() const { return m_documentLoader; } | 111 DocumentLoader* documentLoader() const { return m_documentLoader; } |
| 113 void clearDocumentLoader() { m_documentLoader = 0; } | 112 void clearDocumentLoader() { m_documentLoader = 0; } |
| 114 | 113 |
| 115 void loadDone(CachedResource*); | 114 void loadDone(CachedResource*); |
| 116 void garbageCollectDocumentResources(); | 115 void garbageCollectDocumentResources(); |
| 117 void redirectReceived(CachedResource*, const ResourceResponse&); | |
| 118 | 116 |
| 119 void incrementRequestCount(const CachedResource*); | 117 void incrementRequestCount(const CachedResource*); |
| 120 void decrementRequestCount(const CachedResource*); | 118 void decrementRequestCount(const CachedResource*); |
| 121 int requestCount() const { return m_requestCount; } | 119 int requestCount() const { return m_requestCount; } |
| 122 | 120 |
| 123 bool isPreloaded(const String& urlString) const; | 121 bool isPreloaded(const String& urlString) const; |
| 124 void clearPreloads(); | 122 void clearPreloads(); |
| 125 void clearPendingPreloads(); | 123 void clearPendingPreloads(); |
| 126 void preload(CachedResource::Type, CachedResourceRequest&, const String& cha
rset); | 124 void preload(CachedResource::Type, CachedResourceRequest&, const String& cha
rset); |
| 127 void checkForPendingPreloads(); | 125 void checkForPendingPreloads(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 OwnPtr<ListHashSet<CachedResource*> > m_preloads; | 165 OwnPtr<ListHashSet<CachedResource*> > m_preloads; |
| 168 struct PendingPreload { | 166 struct PendingPreload { |
| 169 CachedResource::Type m_type; | 167 CachedResource::Type m_type; |
| 170 CachedResourceRequest m_request; | 168 CachedResourceRequest m_request; |
| 171 String m_charset; | 169 String m_charset; |
| 172 }; | 170 }; |
| 173 Deque<PendingPreload> m_pendingPreloads; | 171 Deque<PendingPreload> m_pendingPreloads; |
| 174 | 172 |
| 175 Timer<CachedResourceLoader> m_garbageCollectDocumentResourcesTimer; | 173 Timer<CachedResourceLoader> m_garbageCollectDocumentResourcesTimer; |
| 176 | 174 |
| 177 typedef HashMap<CachedResource*, RefPtr<ResourceTimingInfo> > ResourceTiming
InfoMap; | 175 HashMap<CachedResource*, CachedResourceInitiatorInfo> m_initiatorMap; |
| 178 ResourceTimingInfoMap m_resourceTimingInfoMap; | |
| 179 | 176 |
| 180 // 29 bits left | 177 // 29 bits left |
| 181 bool m_autoLoadImages : 1; | 178 bool m_autoLoadImages : 1; |
| 182 bool m_imagesEnabled : 1; | 179 bool m_imagesEnabled : 1; |
| 183 bool m_allowStaleResources : 1; | 180 bool m_allowStaleResources : 1; |
| 184 }; | 181 }; |
| 185 | 182 |
| 186 class ResourceCacheValidationSuppressor { | 183 class ResourceCacheValidationSuppressor { |
| 187 WTF_MAKE_NONCOPYABLE(ResourceCacheValidationSuppressor); | 184 WTF_MAKE_NONCOPYABLE(ResourceCacheValidationSuppressor); |
| 188 WTF_MAKE_FAST_ALLOCATED; | 185 WTF_MAKE_FAST_ALLOCATED; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 202 m_loader->m_allowStaleResources = m_previousState; | 199 m_loader->m_allowStaleResources = m_previousState; |
| 203 } | 200 } |
| 204 private: | 201 private: |
| 205 CachedResourceLoader* m_loader; | 202 CachedResourceLoader* m_loader; |
| 206 bool m_previousState; | 203 bool m_previousState; |
| 207 }; | 204 }; |
| 208 | 205 |
| 209 } // namespace WebCore | 206 } // namespace WebCore |
| 210 | 207 |
| 211 #endif | 208 #endif |
| OLD | NEW |