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

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

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

Powered by Google App Engine
This is Rietveld 408576698