| 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 13 matching lines...) Expand all Loading... |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef ResourceFetcher_h | 26 #ifndef ResourceFetcher_h |
| 27 #define ResourceFetcher_h | 27 #define ResourceFetcher_h |
| 28 | 28 |
| 29 #include "core/fetch/CachePolicy.h" | 29 #include "core/fetch/CachePolicy.h" |
| 30 #include "core/fetch/FetchInitiatorInfo.h" | 30 #include "core/fetch/FetchInitiatorInfo.h" |
| 31 #include "core/fetch/FetchRequest.h" | 31 #include "core/fetch/FetchRequest.h" |
| 32 #include "core/fetch/Resource.h" | 32 #include "core/fetch/Resource.h" |
| 33 #include "core/fetch/ResourceLoaderHost.h" | 33 #include "core/fetch/ResourceLoaderHost.h" |
| 34 #include "core/fetch/ResourceLoaderOptions.h" |
| 34 #include "core/fetch/ResourcePtr.h" | 35 #include "core/fetch/ResourcePtr.h" |
| 35 #include "core/platform/Timer.h" | 36 #include "core/platform/Timer.h" |
| 36 #include "wtf/Deque.h" | 37 #include "wtf/Deque.h" |
| 37 #include "wtf/HashMap.h" | 38 #include "wtf/HashMap.h" |
| 38 #include "wtf/HashSet.h" | 39 #include "wtf/HashSet.h" |
| 39 #include "wtf/ListHashSet.h" | 40 #include "wtf/ListHashSet.h" |
| 40 #include "wtf/text/StringHash.h" | 41 #include "wtf/text/StringHash.h" |
| 41 | 42 |
| 42 namespace WebCore { | 43 namespace WebCore { |
| 43 | 44 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 int requestCount() const { return m_requestCount; } | 123 int requestCount() const { return m_requestCount; } |
| 123 | 124 |
| 124 bool isPreloaded(const String& urlString) const; | 125 bool isPreloaded(const String& urlString) const; |
| 125 void clearPreloads(); | 126 void clearPreloads(); |
| 126 void clearPendingPreloads(); | 127 void clearPendingPreloads(); |
| 127 void preload(Resource::Type, FetchRequest&, const String& charset); | 128 void preload(Resource::Type, FetchRequest&, const String& charset); |
| 128 void checkForPendingPreloads(); | 129 void checkForPendingPreloads(); |
| 129 void printPreloadStats(); | 130 void printPreloadStats(); |
| 130 bool canRequest(Resource::Type, const KURL&, const ResourceLoaderOptions&, b
ool forPreload = false); | 131 bool canRequest(Resource::Type, const KURL&, const ResourceLoaderOptions&, b
ool forPreload = false); |
| 131 bool canAccess(Resource*); | 132 bool canAccess(Resource*); |
| 133 bool checkInsecureContent(Resource::Type, const KURL&, MixedContentBlockingT
reatment) const; |
| 132 | 134 |
| 133 // ResourceLoaderHost | 135 // ResourceLoaderHost |
| 134 virtual void incrementRequestCount(const Resource*) OVERRIDE; | 136 virtual void incrementRequestCount(const Resource*) OVERRIDE; |
| 135 virtual void decrementRequestCount(const Resource*) OVERRIDE; | 137 virtual void decrementRequestCount(const Resource*) OVERRIDE; |
| 136 virtual void didLoadResource(Resource*) OVERRIDE; | 138 virtual void didLoadResource(Resource*) OVERRIDE; |
| 137 virtual void redirectReceived(Resource*, const ResourceResponse&) OVERRIDE; | 139 virtual void redirectReceived(Resource*, const ResourceResponse&) OVERRIDE; |
| 138 virtual void didFinishLoading(const Resource*, double finishTime, const Reso
urceLoaderOptions&) OVERRIDE; | 140 virtual void didFinishLoading(const Resource*, double finishTime, const Reso
urceLoaderOptions&) OVERRIDE; |
| 139 virtual void didChangeLoadingPriority(const Resource*, ResourceLoadPriority)
OVERRIDE; | 141 virtual void didChangeLoadingPriority(const Resource*, ResourceLoadPriority)
OVERRIDE; |
| 140 virtual void didFailLoading(const Resource*, const ResourceError&, const Res
ourceLoaderOptions&) OVERRIDE; | 142 virtual void didFailLoading(const Resource*, const ResourceError&, const Res
ourceLoaderOptions&) OVERRIDE; |
| 141 virtual void willSendRequest(const Resource*, ResourceRequest&, const Resour
ceResponse& redirectResponse, const ResourceLoaderOptions&) OVERRIDE; | 143 virtual void willSendRequest(const Resource*, ResourceRequest&, const Resour
ceResponse& redirectResponse, const ResourceLoaderOptions&) OVERRIDE; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 167 void requestPreload(Resource::Type, FetchRequest&, const String& charset); | 169 void requestPreload(Resource::Type, FetchRequest&, const String& charset); |
| 168 | 170 |
| 169 enum RevalidationPolicy { Use, Revalidate, Reload, Load }; | 171 enum RevalidationPolicy { Use, Revalidate, Reload, Load }; |
| 170 RevalidationPolicy determineRevalidationPolicy(Resource::Type, ResourceReque
st&, bool forPreload, Resource* existingResource, FetchRequest::DeferOption) con
st; | 172 RevalidationPolicy determineRevalidationPolicy(Resource::Type, ResourceReque
st&, bool forPreload, Resource* existingResource, FetchRequest::DeferOption) con
st; |
| 171 | 173 |
| 172 void determineTargetType(ResourceRequest&, Resource::Type); | 174 void determineTargetType(ResourceRequest&, Resource::Type); |
| 173 ResourceRequestCachePolicy resourceRequestCachePolicy(const ResourceRequest&
, Resource::Type); | 175 ResourceRequestCachePolicy resourceRequestCachePolicy(const ResourceRequest&
, Resource::Type); |
| 174 void addAdditionalRequestHeaders(ResourceRequest&, Resource::Type); | 176 void addAdditionalRequestHeaders(ResourceRequest&, Resource::Type); |
| 175 | 177 |
| 176 void notifyLoadedFromMemoryCache(Resource*); | 178 void notifyLoadedFromMemoryCache(Resource*); |
| 177 bool checkInsecureContent(Resource::Type, const KURL&) const; | |
| 178 | 179 |
| 179 void garbageCollectDocumentResourcesTimerFired(Timer<ResourceFetcher>*); | 180 void garbageCollectDocumentResourcesTimerFired(Timer<ResourceFetcher>*); |
| 180 void performPostLoadActions(); | 181 void performPostLoadActions(); |
| 181 | 182 |
| 182 bool clientDefersImage(const KURL&) const; | 183 bool clientDefersImage(const KURL&) const; |
| 183 void reloadImagesIfNotDeferred(); | 184 void reloadImagesIfNotDeferred(); |
| 184 | 185 |
| 185 HashSet<String> m_validatedURLs; | 186 HashSet<String> m_validatedURLs; |
| 186 mutable DocumentResourceMap m_documentResources; | 187 mutable DocumentResourceMap m_documentResources; |
| 187 Document* m_document; | 188 Document* m_document; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 m_loader->m_allowStaleResources = m_previousState; | 228 m_loader->m_allowStaleResources = m_previousState; |
| 228 } | 229 } |
| 229 private: | 230 private: |
| 230 ResourceFetcher* m_loader; | 231 ResourceFetcher* m_loader; |
| 231 bool m_previousState; | 232 bool m_previousState; |
| 232 }; | 233 }; |
| 233 | 234 |
| 234 } // namespace WebCore | 235 } // namespace WebCore |
| 235 | 236 |
| 236 #endif | 237 #endif |
| OLD | NEW |