| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 class CachedRawResource; | 47 class CachedRawResource; |
| 48 class CachedScript; | 48 class CachedScript; |
| 49 class CachedShader; | 49 class CachedShader; |
| 50 class CachedTextTrack; | 50 class CachedTextTrack; |
| 51 class CachedXSLStyleSheet; | 51 class CachedXSLStyleSheet; |
| 52 class Document; | 52 class Document; |
| 53 class DocumentLoader; | 53 class DocumentLoader; |
| 54 class Frame; | 54 class Frame; |
| 55 class ImageLoader; | 55 class ImageLoader; |
| 56 class KURL; | 56 class KURL; |
| 57 class ResourceTimingInfo; |
| 57 | 58 |
| 58 // The CachedResourceLoader provides a per-context interface to the MemoryCache | 59 // The CachedResourceLoader provides a per-context interface to the MemoryCache |
| 59 // 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. |
| 60 // 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 |
| 61 // in the DocumentLoader constructor and loses its ability to generate network | 62 // in the DocumentLoader constructor and loses its ability to generate network |
| 62 // requests when the DocumentLoader is destroyed. Documents also hold a | 63 // requests when the DocumentLoader is destroyed. Documents also hold a |
| 63 // RefPtr<CachedResourceLoader> for their lifetime (and will create one if they | 64 // RefPtr<CachedResourceLoader> for their lifetime (and will create one if they |
| 64 // 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 |
| 65 // alive past detach if scripts still reference the Document. | 66 // alive past detach if scripts still reference the Document. |
| 66 class CachedResourceLoader : public RefCounted<CachedResourceLoader> { | 67 class CachedResourceLoader : public RefCounted<CachedResourceLoader> { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 CachePolicy cachePolicy(CachedResource::Type) const; | 108 CachePolicy cachePolicy(CachedResource::Type) const; |
| 108 | 109 |
| 109 Frame* frame() const; // Can be null | 110 Frame* frame() const; // Can be null |
| 110 Document* document() const { return m_document; } // Can be null | 111 Document* document() const { return m_document; } // Can be null |
| 111 void setDocument(Document* document) { m_document = document; } | 112 void setDocument(Document* document) { m_document = document; } |
| 112 void clearDocumentLoader() { m_documentLoader = 0; } | 113 void clearDocumentLoader() { m_documentLoader = 0; } |
| 113 | 114 |
| 114 void removeCachedResource(CachedResource*) const; | 115 void removeCachedResource(CachedResource*) const; |
| 115 void loadDone(CachedResource*); | 116 void loadDone(CachedResource*); |
| 116 void garbageCollectDocumentResources(); | 117 void garbageCollectDocumentResources(); |
| 118 void redirectReceived(CachedResource*, const ResourceResponse&); |
| 117 | 119 |
| 118 void incrementRequestCount(const CachedResource*); | 120 void incrementRequestCount(const CachedResource*); |
| 119 void decrementRequestCount(const CachedResource*); | 121 void decrementRequestCount(const CachedResource*); |
| 120 int requestCount() const { return m_requestCount; } | 122 int requestCount() const { return m_requestCount; } |
| 121 | 123 |
| 122 bool isPreloaded(const String& urlString) const; | 124 bool isPreloaded(const String& urlString) const; |
| 123 void clearPreloads(); | 125 void clearPreloads(); |
| 124 void clearPendingPreloads(); | 126 void clearPendingPreloads(); |
| 125 void preload(CachedResource::Type, CachedResourceRequest&, const String& cha
rset); | 127 void preload(CachedResource::Type, CachedResourceRequest&, const String& cha
rset); |
| 126 void checkForPendingPreloads(); | 128 void checkForPendingPreloads(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 OwnPtr<ListHashSet<CachedResource*> > m_preloads; | 164 OwnPtr<ListHashSet<CachedResource*> > m_preloads; |
| 163 struct PendingPreload { | 165 struct PendingPreload { |
| 164 CachedResource::Type m_type; | 166 CachedResource::Type m_type; |
| 165 CachedResourceRequest m_request; | 167 CachedResourceRequest m_request; |
| 166 String m_charset; | 168 String m_charset; |
| 167 }; | 169 }; |
| 168 Deque<PendingPreload> m_pendingPreloads; | 170 Deque<PendingPreload> m_pendingPreloads; |
| 169 | 171 |
| 170 Timer<CachedResourceLoader> m_garbageCollectDocumentResourcesTimer; | 172 Timer<CachedResourceLoader> m_garbageCollectDocumentResourcesTimer; |
| 171 | 173 |
| 172 struct InitiatorInfo { | 174 HashMap<CachedResource*, ResourceTimingInfo> m_resourceTimingInfoMap; |
| 173 AtomicString name; | |
| 174 double startTime; | |
| 175 }; | |
| 176 HashMap<CachedResource*, InitiatorInfo> m_initiatorMap; | |
| 177 | 175 |
| 178 // 29 bits left | 176 // 29 bits left |
| 179 bool m_autoLoadImages : 1; | 177 bool m_autoLoadImages : 1; |
| 180 bool m_imagesEnabled : 1; | 178 bool m_imagesEnabled : 1; |
| 181 bool m_allowStaleResources : 1; | 179 bool m_allowStaleResources : 1; |
| 182 }; | 180 }; |
| 183 | 181 |
| 184 class ResourceCacheValidationSuppressor { | 182 class ResourceCacheValidationSuppressor { |
| 185 WTF_MAKE_NONCOPYABLE(ResourceCacheValidationSuppressor); | 183 WTF_MAKE_NONCOPYABLE(ResourceCacheValidationSuppressor); |
| 186 WTF_MAKE_FAST_ALLOCATED; | 184 WTF_MAKE_FAST_ALLOCATED; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 200 m_loader->m_allowStaleResources = m_previousState; | 198 m_loader->m_allowStaleResources = m_previousState; |
| 201 } | 199 } |
| 202 private: | 200 private: |
| 203 CachedResourceLoader* m_loader; | 201 CachedResourceLoader* m_loader; |
| 204 bool m_previousState; | 202 bool m_previousState; |
| 205 }; | 203 }; |
| 206 | 204 |
| 207 } // namespace WebCore | 205 } // namespace WebCore |
| 208 | 206 |
| 209 #endif | 207 #endif |
| OLD | NEW |