| 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 15 matching lines...) Expand all Loading... |
| 26 #ifndef ResourceFetcher_h | 26 #ifndef ResourceFetcher_h |
| 27 #define ResourceFetcher_h | 27 #define ResourceFetcher_h |
| 28 | 28 |
| 29 #include "core/CoreExport.h" | 29 #include "core/CoreExport.h" |
| 30 #include "core/fetch/CachePolicy.h" | 30 #include "core/fetch/CachePolicy.h" |
| 31 #include "core/fetch/FetchContext.h" | 31 #include "core/fetch/FetchContext.h" |
| 32 #include "core/fetch/FetchInitiatorInfo.h" | 32 #include "core/fetch/FetchInitiatorInfo.h" |
| 33 #include "core/fetch/FetchRequest.h" | 33 #include "core/fetch/FetchRequest.h" |
| 34 #include "core/fetch/Resource.h" | 34 #include "core/fetch/Resource.h" |
| 35 #include "core/fetch/ResourceLoaderOptions.h" | 35 #include "core/fetch/ResourceLoaderOptions.h" |
| 36 #include "core/fetch/ResourceLoaderSet.h" |
| 36 #include "core/fetch/SubstituteData.h" | 37 #include "core/fetch/SubstituteData.h" |
| 37 #include "platform/Timer.h" | 38 #include "platform/Timer.h" |
| 38 #include "platform/network/ResourceError.h" | 39 #include "platform/network/ResourceError.h" |
| 39 #include "platform/network/ResourceLoadPriority.h" | 40 #include "platform/network/ResourceLoadPriority.h" |
| 40 #include "wtf/HashMap.h" | 41 #include "wtf/HashMap.h" |
| 41 #include "wtf/HashSet.h" | 42 #include "wtf/HashSet.h" |
| 42 #include "wtf/ListHashSet.h" | 43 #include "wtf/ListHashSet.h" |
| 43 #include "wtf/text/StringHash.h" | 44 #include "wtf/text/StringHash.h" |
| 44 | 45 |
| 45 namespace blink { | 46 namespace blink { |
| 46 | 47 |
| 47 class ArchiveResource; | 48 class ArchiveResource; |
| 48 class CSSStyleSheetResource; | 49 class CSSStyleSheetResource; |
| 49 class DocumentResource; | 50 class DocumentResource; |
| 50 class FontResource; | 51 class FontResource; |
| 51 class ImageResource; | 52 class ImageResource; |
| 52 class MHTMLArchive; | 53 class MHTMLArchive; |
| 53 class RawResource; | 54 class RawResource; |
| 54 class ScriptResource; | 55 class ScriptResource; |
| 55 class XSLStyleSheetResource; | 56 class XSLStyleSheetResource; |
| 56 class KURL; | 57 class KURL; |
| 57 class ResourceTimingInfo; | 58 class ResourceTimingInfo; |
| 58 class ResourceLoaderSet; | |
| 59 | 59 |
| 60 // The ResourceFetcher provides a per-context interface to the MemoryCache | 60 // The ResourceFetcher provides a per-context interface to the MemoryCache |
| 61 // 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. |
| 62 // 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 |
| 63 // in the DocumentLoader constructor and loses its ability to generate network | 63 // in the DocumentLoader constructor and loses its ability to generate network |
| 64 // requests when the DocumentLoader is destroyed. Documents also hold a pointer | 64 // requests when the DocumentLoader is destroyed. Documents also hold a pointer |
| 65 // to ResourceFetcher for their lifetime (and will create one if they | 65 // to ResourceFetcher for their lifetime (and will create one if they |
| 66 // are initialized without a LocalFrame), so a Document can keep a ResourceFetch
er | 66 // are initialized without a LocalFrame), so a Document can keep a ResourceFetch
er |
| 67 // alive past detach if scripts still reference the Document. | 67 // alive past detach if scripts still reference the Document. |
| 68 class CORE_EXPORT ResourceFetcher : public GarbageCollectedFinalized<ResourceFet
cher> { | 68 class CORE_EXPORT ResourceFetcher : public GarbageCollectedFinalized<ResourceFet
cher> { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 Member<HeapListHashSet<Member<Resource>>> m_preloads; | 186 Member<HeapListHashSet<Member<Resource>>> m_preloads; |
| 187 Member<MHTMLArchive> m_archive; | 187 Member<MHTMLArchive> m_archive; |
| 188 | 188 |
| 189 Timer<ResourceFetcher> m_resourceTimingReportTimer; | 189 Timer<ResourceFetcher> m_resourceTimingReportTimer; |
| 190 | 190 |
| 191 using ResourceTimingInfoMap = HeapHashMap<Member<Resource>, OwnPtr<ResourceT
imingInfo>>; | 191 using ResourceTimingInfoMap = HeapHashMap<Member<Resource>, OwnPtr<ResourceT
imingInfo>>; |
| 192 ResourceTimingInfoMap m_resourceTimingInfoMap; | 192 ResourceTimingInfoMap m_resourceTimingInfoMap; |
| 193 | 193 |
| 194 Vector<OwnPtr<ResourceTimingInfo>> m_scheduledResourceTimingReports; | 194 Vector<OwnPtr<ResourceTimingInfo>> m_scheduledResourceTimingReports; |
| 195 | 195 |
| 196 Member<ResourceLoaderSet> m_loaders; | 196 ResourceLoaderSet m_loaders; |
| 197 Member<ResourceLoaderSet> m_nonBlockingLoaders; | 197 ResourceLoaderSet m_nonBlockingLoaders; |
| 198 | 198 |
| 199 // Used in hit rate histograms. | 199 // Used in hit rate histograms. |
| 200 class DeadResourceStatsRecorder { | 200 class DeadResourceStatsRecorder { |
| 201 DISALLOW_NEW(); | 201 DISALLOW_NEW(); |
| 202 public: | 202 public: |
| 203 DeadResourceStatsRecorder(); | 203 DeadResourceStatsRecorder(); |
| 204 ~DeadResourceStatsRecorder(); | 204 ~DeadResourceStatsRecorder(); |
| 205 | 205 |
| 206 void update(RevalidationPolicy); | 206 void update(RevalidationPolicy); |
| 207 | 207 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 237 m_loader->m_allowStaleResources = m_previousState; | 237 m_loader->m_allowStaleResources = m_previousState; |
| 238 } | 238 } |
| 239 private: | 239 private: |
| 240 Member<ResourceFetcher> m_loader; | 240 Member<ResourceFetcher> m_loader; |
| 241 bool m_previousState; | 241 bool m_previousState; |
| 242 }; | 242 }; |
| 243 | 243 |
| 244 } // namespace blink | 244 } // namespace blink |
| 245 | 245 |
| 246 #endif // ResourceFetcher_h | 246 #endif // ResourceFetcher_h |
| OLD | NEW |