| 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) 2006 Samuel Weinig (sam.weinig@gmail.com) | 4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
rights reserved. | 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
rights reserved. |
| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 ResourceLoaderOptions& mutableOptions() { return m_options; } | 137 ResourceLoaderOptions& mutableOptions() { return m_options; } |
| 138 | 138 |
| 139 void didChangePriority(ResourceLoadPriority, int intraPriorityValue); | 139 void didChangePriority(ResourceLoadPriority, int intraPriorityValue); |
| 140 virtual ResourcePriority priorityFromObservers() { return ResourcePriority()
; } | 140 virtual ResourcePriority priorityFromObservers() { return ResourcePriority()
; } |
| 141 | 141 |
| 142 // The reference policy indicates that the client should not affect whether | 142 // The reference policy indicates that the client should not affect whether |
| 143 // a preload is considered referenced or not. This allows for "passive" | 143 // a preload is considered referenced or not. This allows for "passive" |
| 144 // resource clients that simply observe the resource. | 144 // resource clients that simply observe the resource. |
| 145 void addClient(ResourceClient*, PreloadReferencePolicy = MarkAsReferenced); | 145 void addClient(ResourceClient*, PreloadReferencePolicy = MarkAsReferenced); |
| 146 void removeClient(ResourceClient*); | 146 void removeClient(ResourceClient*); |
| 147 virtual bool hasClientsOrObservers() const { return !m_clients.isEmpty() ||
!m_clientsAwaitingCallback.isEmpty() || !m_finishedClients.isEmpty(); } | |
| 148 | 147 |
| 149 enum PreloadResult { | 148 enum PreloadResult { |
| 150 PreloadNotReferenced, | 149 PreloadNotReferenced, |
| 151 PreloadReferenced, | 150 PreloadReferenced, |
| 152 PreloadReferencedWhileLoading, | 151 PreloadReferencedWhileLoading, |
| 153 PreloadReferencedWhileComplete | 152 PreloadReferencedWhileComplete |
| 154 }; | 153 }; |
| 155 PreloadResult getPreloadResult() const { return static_cast<PreloadResult>(m
_preloadResult); } | 154 PreloadResult getPreloadResult() const { return static_cast<PreloadResult>(m
_preloadResult); } |
| 156 | 155 |
| 157 Status getStatus() const { return static_cast<Status>(m_status); } | 156 Status getStatus() const { return static_cast<Status>(m_status); } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 bool canUseCacheValidator(); | 224 bool canUseCacheValidator(); |
| 226 bool isCacheValidator() const { return m_isRevalidating; } | 225 bool isCacheValidator() const { return m_isRevalidating; } |
| 227 bool hasCacheControlNoStoreHeader() const; | 226 bool hasCacheControlNoStoreHeader() const; |
| 228 bool hasVaryHeader() const; | 227 bool hasVaryHeader() const; |
| 229 virtual bool mustRefetchDueToIntegrityMetadata(const FetchRequest& request)
const { return false; } | 228 virtual bool mustRefetchDueToIntegrityMetadata(const FetchRequest& request)
const { return false; } |
| 230 | 229 |
| 231 double currentAge() const; | 230 double currentAge() const; |
| 232 double freshnessLifetime(); | 231 double freshnessLifetime(); |
| 233 double stalenessLifetime(); | 232 double stalenessLifetime(); |
| 234 | 233 |
| 234 bool isAlive() const { return m_isAlive; } |
| 235 |
| 235 void setCacheIdentifier(const String& cacheIdentifier) { m_cacheIdentifier =
cacheIdentifier; } | 236 void setCacheIdentifier(const String& cacheIdentifier) { m_cacheIdentifier =
cacheIdentifier; } |
| 236 String cacheIdentifier() const { return m_cacheIdentifier; } | 237 String cacheIdentifier() const { return m_cacheIdentifier; } |
| 237 | 238 |
| 238 virtual void didSendData(unsigned long long /* bytesSent */, unsigned long l
ong /* totalBytesToBeSent */) { } | 239 virtual void didSendData(unsigned long long /* bytesSent */, unsigned long l
ong /* totalBytesToBeSent */) { } |
| 239 virtual void didDownloadData(int) { } | 240 virtual void didDownloadData(int) { } |
| 240 | 241 |
| 241 double loadFinishTime() const { return m_loadFinishTime; } | 242 double loadFinishTime() const { return m_loadFinishTime; } |
| 242 | 243 |
| 243 void addToEncodedBodyLength(int value) { m_response.addToEncodedBodyLength(v
alue); } | 244 void addToEncodedBodyLength(int value) { m_response.addToEncodedBodyLength(v
alue); } |
| 244 void addToDecodedBodyLength(int value) { m_response.addToDecodedBodyLength(v
alue); } | 245 void addToDecodedBodyLength(int value) { m_response.addToDecodedBodyLength(v
alue); } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 257 | 258 |
| 258 virtual void checkNotify(); | 259 virtual void checkNotify(); |
| 259 | 260 |
| 260 enum class MarkFinishedOption { | 261 enum class MarkFinishedOption { |
| 261 ShouldMarkFinished, | 262 ShouldMarkFinished, |
| 262 DoNotMarkFinished | 263 DoNotMarkFinished |
| 263 }; | 264 }; |
| 264 void notifyClientsInternal(MarkFinishedOption); | 265 void notifyClientsInternal(MarkFinishedOption); |
| 265 void markClientFinished(ResourceClient*); | 266 void markClientFinished(ResourceClient*); |
| 266 | 267 |
| 268 virtual bool hasClientsOrObservers() const { return !m_clients.isEmpty() ||
!m_clientsAwaitingCallback.isEmpty() || !m_finishedClients.isEmpty(); } |
| 267 virtual void destroyDecodedDataForFailedRevalidation() { } | 269 virtual void destroyDecodedDataForFailedRevalidation() { } |
| 268 | 270 |
| 269 void setEncodedSize(size_t); | 271 void setEncodedSize(size_t); |
| 270 void setDecodedSize(size_t); | 272 void setDecodedSize(size_t); |
| 271 void didAccessDecodedData(); | 273 void didAccessDecodedData(); |
| 272 | 274 |
| 273 void finishPendingClients(); | 275 void finishPendingClients(); |
| 274 | 276 |
| 275 virtual void didAddClient(ResourceClient*); | 277 virtual void didAddClient(ResourceClient*); |
| 276 void willAddClientOrObserver(PreloadReferencePolicy); | 278 void willAddClientOrObserver(PreloadReferencePolicy); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 293 ResourceRequest m_request; | 295 ResourceRequest m_request; |
| 294 ResourceResponse m_redirectResponse; | 296 ResourceResponse m_redirectResponse; |
| 295 }; | 297 }; |
| 296 const Vector<RedirectPair>& redirectChain() const { return m_redirectChain;
} | 298 const Vector<RedirectPair>& redirectChain() const { return m_redirectChain;
} |
| 297 | 299 |
| 298 virtual void destroyDecodedDataIfPossible() { } | 300 virtual void destroyDecodedDataIfPossible() { } |
| 299 | 301 |
| 300 // Returns the memory dump name used for tracing. See Resource::onMemoryDump
. | 302 // Returns the memory dump name used for tracing. See Resource::onMemoryDump
. |
| 301 String getMemoryDumpName() const; | 303 String getMemoryDumpName() const; |
| 302 | 304 |
| 303 const HashCountedSet<ResourceClient*>& clients() const { return m_clients; } | 305 const HeapHashCountedSet<WeakMember<ResourceClient>>& clients() const { retu
rn m_clients; } |
| 304 DataBufferingPolicy dataBufferingPolicy() const { return m_options.dataBuffe
ringPolicy; } | 306 DataBufferingPolicy dataBufferingPolicy() const { return m_options.dataBuffe
ringPolicy; } |
| 305 | 307 |
| 306 void setCachePolicyBypassingCache(); | 308 void setCachePolicyBypassingCache(); |
| 307 void setLoFiStateOff(); | 309 void setLoFiStateOff(); |
| 308 | 310 |
| 309 SharedBuffer* data() const { return m_data.get(); } | 311 SharedBuffer* data() const { return m_data.get(); } |
| 310 void clearData() { m_data.clear(); } | 312 void clearData() { m_data.clear(); } |
| 311 | 313 |
| 312 private: | 314 private: |
| 313 class ResourceCallback; | 315 class ResourceCallback; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 | 352 |
| 351 String m_cacheIdentifier; | 353 String m_cacheIdentifier; |
| 352 | 354 |
| 353 unsigned m_preloadResult : 2; // PreloadResult | 355 unsigned m_preloadResult : 2; // PreloadResult |
| 354 unsigned m_type : 4; // Type | 356 unsigned m_type : 4; // Type |
| 355 unsigned m_status : 3; // Status | 357 unsigned m_status : 3; // Status |
| 356 | 358 |
| 357 unsigned m_needsSynchronousCacheHit : 1; | 359 unsigned m_needsSynchronousCacheHit : 1; |
| 358 unsigned m_linkPreload : 1; | 360 unsigned m_linkPreload : 1; |
| 359 bool m_isRevalidating : 1; | 361 bool m_isRevalidating : 1; |
| 362 bool m_isAlive : 1; |
| 360 | 363 |
| 361 // Ordered list of all redirects followed while fetching this resource. | 364 // Ordered list of all redirects followed while fetching this resource. |
| 362 Vector<RedirectPair> m_redirectChain; | 365 Vector<RedirectPair> m_redirectChain; |
| 363 | 366 |
| 364 HashCountedSet<ResourceClient*> m_clients; | 367 HeapHashCountedSet<WeakMember<ResourceClient>> m_clients; |
| 365 HashCountedSet<ResourceClient*> m_clientsAwaitingCallback; | 368 HeapHashCountedSet<WeakMember<ResourceClient>> m_clientsAwaitingCallback; |
| 366 HashCountedSet<ResourceClient*> m_finishedClients; | 369 HeapHashCountedSet<WeakMember<ResourceClient>> m_finishedClients; |
| 367 | 370 |
| 368 ResourceLoaderOptions m_options; | 371 ResourceLoaderOptions m_options; |
| 369 | 372 |
| 370 double m_responseTimestamp; | 373 double m_responseTimestamp; |
| 371 | 374 |
| 372 Timer<Resource> m_cancelTimer; | 375 Timer<Resource> m_cancelTimer; |
| 373 | 376 |
| 374 ResourceRequest m_resourceRequest; | 377 ResourceRequest m_resourceRequest; |
| 375 Member<ResourceLoader> m_loader; | 378 Member<ResourceLoader> m_loader; |
| 376 ResourceResponse m_response; | 379 ResourceResponse m_response; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 389 | 392 |
| 390 Resource::Type m_type; | 393 Resource::Type m_type; |
| 391 }; | 394 }; |
| 392 | 395 |
| 393 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ | 396 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ |
| 394 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->getType(
) == Resource::typeName, resource.getType() == Resource::typeName); | 397 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->getType(
) == Resource::typeName, resource.getType() == Resource::typeName); |
| 395 | 398 |
| 396 } // namespace blink | 399 } // namespace blink |
| 397 | 400 |
| 398 #endif | 401 #endif |
| OLD | NEW |