Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Side by Side Diff: Source/core/loader/cache/CachedResourceLoader.h

Issue 16950017: Reland [Resource Timing] Expose redirect timing information (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebaseline Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 106
106 Frame* frame() const; // Can be null 107 Frame* frame() const; // Can be null
107 Document* document() const { return m_document; } // Can be null 108 Document* document() const { return m_document; } // Can be null
108 void setDocument(Document* document) { m_document = document; } 109 void setDocument(Document* document) { m_document = document; }
109 110
110 DocumentLoader* documentLoader() const { return m_documentLoader; } 111 DocumentLoader* documentLoader() const { return m_documentLoader; }
111 void clearDocumentLoader() { m_documentLoader = 0; } 112 void clearDocumentLoader() { m_documentLoader = 0; }
112 113
113 void loadDone(CachedResource*); 114 void loadDone(CachedResource*);
114 void garbageCollectDocumentResources(); 115 void garbageCollectDocumentResources();
116 void redirectReceived(CachedResource*, const ResourceResponse&);
115 117
116 void incrementRequestCount(const CachedResource*); 118 void incrementRequestCount(const CachedResource*);
117 void decrementRequestCount(const CachedResource*); 119 void decrementRequestCount(const CachedResource*);
118 int requestCount() const { return m_requestCount; } 120 int requestCount() const { return m_requestCount; }
119 121
120 bool isPreloaded(const String& urlString) const; 122 bool isPreloaded(const String& urlString) const;
121 void clearPreloads(); 123 void clearPreloads();
122 void clearPendingPreloads(); 124 void clearPendingPreloads();
123 void preload(CachedResource::Type, CachedResourceRequest&, const String& cha rset); 125 void preload(CachedResource::Type, CachedResourceRequest&, const String& cha rset);
124 void checkForPendingPreloads(); 126 void checkForPendingPreloads();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 OwnPtr<ListHashSet<CachedResource*> > m_preloads; 167 OwnPtr<ListHashSet<CachedResource*> > m_preloads;
166 struct PendingPreload { 168 struct PendingPreload {
167 CachedResource::Type m_type; 169 CachedResource::Type m_type;
168 CachedResourceRequest m_request; 170 CachedResourceRequest m_request;
169 String m_charset; 171 String m_charset;
170 }; 172 };
171 Deque<PendingPreload> m_pendingPreloads; 173 Deque<PendingPreload> m_pendingPreloads;
172 174
173 Timer<CachedResourceLoader> m_garbageCollectDocumentResourcesTimer; 175 Timer<CachedResourceLoader> m_garbageCollectDocumentResourcesTimer;
174 176
175 HashMap<CachedResource*, CachedResourceInitiatorInfo> m_initiatorMap; 177 typedef HashMap<CachedResource*, RefPtr<ResourceTimingInfo> > ResourceTiming InfoMap;
178 ResourceTimingInfoMap m_resourceTimingInfoMap;
176 179
177 // 29 bits left 180 // 29 bits left
178 bool m_autoLoadImages : 1; 181 bool m_autoLoadImages : 1;
179 bool m_imagesEnabled : 1; 182 bool m_imagesEnabled : 1;
180 bool m_allowStaleResources : 1; 183 bool m_allowStaleResources : 1;
181 }; 184 };
182 185
183 class ResourceCacheValidationSuppressor { 186 class ResourceCacheValidationSuppressor {
184 WTF_MAKE_NONCOPYABLE(ResourceCacheValidationSuppressor); 187 WTF_MAKE_NONCOPYABLE(ResourceCacheValidationSuppressor);
185 WTF_MAKE_FAST_ALLOCATED; 188 WTF_MAKE_FAST_ALLOCATED;
(...skipping 13 matching lines...) Expand all
199 m_loader->m_allowStaleResources = m_previousState; 202 m_loader->m_allowStaleResources = m_previousState;
200 } 203 }
201 private: 204 private:
202 CachedResourceLoader* m_loader; 205 CachedResourceLoader* m_loader;
203 bool m_previousState; 206 bool m_previousState;
204 }; 207 };
205 208
206 } // namespace WebCore 209 } // namespace WebCore
207 210
208 #endif 211 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698