| 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 | 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
| 6 rights reserved. | 6 rights reserved. |
| 7 | 7 |
| 8 This library is free software; you can redistribute it and/or | 8 This library is free software; you can redistribute it and/or |
| 9 modify it under the terms of the GNU Library General Public | 9 modify it under the terms of the GNU Library General Public |
| 10 License as published by the Free Software Foundation; either | 10 License as published by the Free Software Foundation; either |
| 11 version 2 of the License, or (at your option) any later version. | 11 version 2 of the License, or (at your option) any later version. |
| 12 | 12 |
| 13 This library is distributed in the hope that it will be useful, | 13 This library is distributed in the hope that it will be useful, |
| 14 but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 Library General Public License for more details. | 16 Library General Public License for more details. |
| 17 | 17 |
| 18 You should have received a copy of the GNU Library General Public License | 18 You should have received a copy of the GNU Library General Public License |
| 19 along with this library; see the file COPYING.LIB. If not, write to | 19 along with this library; see the file COPYING.LIB. If not, write to |
| 20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 21 Boston, MA 02110-1301, USA. | 21 Boston, MA 02110-1301, USA. |
| 22 */ | 22 */ |
| 23 | 23 |
| 24 #ifndef Resource_h | 24 #ifndef Resource_h |
| 25 #define Resource_h | 25 #define Resource_h |
| 26 | 26 |
| 27 #include "core/CoreExport.h" | 27 #include "core/CoreExport.h" |
| 28 #include "core/fetch/CachedMetadataHandler.h" | 28 #include "core/fetch/CachedMetadataHandler.h" |
| 29 #include "core/fetch/IntegrityMetadata.h" |
| 29 #include "core/fetch/ResourceLoaderOptions.h" | 30 #include "core/fetch/ResourceLoaderOptions.h" |
| 30 #include "platform/MemoryCoordinator.h" | 31 #include "platform/MemoryCoordinator.h" |
| 31 #include "platform/SharedBuffer.h" | 32 #include "platform/SharedBuffer.h" |
| 32 #include "platform/Timer.h" | 33 #include "platform/Timer.h" |
| 33 #include "platform/network/ResourceError.h" | 34 #include "platform/network/ResourceError.h" |
| 34 #include "platform/network/ResourceLoadPriority.h" | 35 #include "platform/network/ResourceLoadPriority.h" |
| 35 #include "platform/network/ResourceRequest.h" | 36 #include "platform/network/ResourceRequest.h" |
| 36 #include "platform/network/ResourceResponse.h" | 37 #include "platform/network/ResourceResponse.h" |
| 37 #include "platform/scheduler/CancellableTaskFactory.h" | 38 #include "platform/scheduler/CancellableTaskFactory.h" |
| 38 #include "platform/tracing/web_process_memory_dump.h" | 39 #include "platform/tracing/web_process_memory_dump.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 // the cache entry file | 189 // the cache entry file |
| 189 virtual void finish(double finishTime); | 190 virtual void finish(double finishTime); |
| 190 void finish() { finish(0.0); } | 191 void finish() { finish(0.0); } |
| 191 | 192 |
| 192 // FIXME: Remove the stringless variant once all the callsites' error messages | 193 // FIXME: Remove the stringless variant once all the callsites' error messages |
| 193 // are updated. | 194 // are updated. |
| 194 bool passesAccessControlCheck(SecurityOrigin*) const; | 195 bool passesAccessControlCheck(SecurityOrigin*) const; |
| 195 bool passesAccessControlCheck(SecurityOrigin*, | 196 bool passesAccessControlCheck(SecurityOrigin*, |
| 196 String& errorDescription) const; | 197 String& errorDescription) const; |
| 197 | 198 |
| 198 bool isEligibleForIntegrityCheck(SecurityOrigin*) const; | |
| 199 | |
| 200 virtual PassRefPtr<const SharedBuffer> resourceBuffer() const { | 199 virtual PassRefPtr<const SharedBuffer> resourceBuffer() const { |
| 201 return m_data; | 200 return m_data; |
| 202 } | 201 } |
| 203 void setResourceBuffer(PassRefPtr<SharedBuffer>); | 202 void setResourceBuffer(PassRefPtr<SharedBuffer>); |
| 204 | 203 |
| 205 virtual bool willFollowRedirect(const ResourceRequest&, | 204 virtual bool willFollowRedirect(const ResourceRequest&, |
| 206 const ResourceResponse&); | 205 const ResourceResponse&); |
| 207 | 206 |
| 208 // Called when a redirect response was received but a decision has already | 207 // Called when a redirect response was received but a decision has already |
| 209 // been made to not follow it. | 208 // been made to not follow it. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 DCHECK(m_preloadCount); | 246 DCHECK(m_preloadCount); |
| 248 --m_preloadCount; | 247 --m_preloadCount; |
| 249 } | 248 } |
| 250 | 249 |
| 251 bool canReuseRedirectChain(); | 250 bool canReuseRedirectChain(); |
| 252 bool mustRevalidateDueToCacheHeaders(); | 251 bool mustRevalidateDueToCacheHeaders(); |
| 253 bool canUseCacheValidator(); | 252 bool canUseCacheValidator(); |
| 254 bool isCacheValidator() const { return m_isRevalidating; } | 253 bool isCacheValidator() const { return m_isRevalidating; } |
| 255 bool hasCacheControlNoStoreHeader() const; | 254 bool hasCacheControlNoStoreHeader() const; |
| 256 bool hasVaryHeader() const; | 255 bool hasVaryHeader() const; |
| 257 virtual bool mustRefetchDueToIntegrityMetadata( | 256 |
| 258 const FetchRequest& request) const { | 257 bool isEligibleForIntegrityCheck(SecurityOrigin*) const; |
| 259 return false; | 258 |
| 259 void setIntegrityMetadata(const IntegrityMetadataSet& metadata) { |
| 260 m_integrityMetadata = metadata; |
| 260 } | 261 } |
| 262 const IntegrityMetadataSet& integrityMetadata() const { |
| 263 return m_integrityMetadata; |
| 264 } |
| 265 // The argument must never be |NotChecked|. |
| 266 void setIntegrityDisposition(ResourceIntegrityDisposition); |
| 267 ResourceIntegrityDisposition integrityDisposition() const { |
| 268 return m_integrityDisposition; |
| 269 } |
| 270 bool mustRefetchDueToIntegrityMetadata(const FetchRequest&) const; |
| 261 | 271 |
| 262 double currentAge() const; | 272 double currentAge() const; |
| 263 double freshnessLifetime(); | 273 double freshnessLifetime(); |
| 264 double stalenessLifetime(); | 274 double stalenessLifetime(); |
| 265 | 275 |
| 266 bool isAlive() const { return m_isAlive; } | 276 bool isAlive() const { return m_isAlive; } |
| 267 | 277 |
| 268 void setCacheIdentifier(const String& cacheIdentifier) { | 278 void setCacheIdentifier(const String& cacheIdentifier) { |
| 269 m_cacheIdentifier = cacheIdentifier; | 279 m_cacheIdentifier = cacheIdentifier; |
| 270 } | 280 } |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 | 417 |
| 408 unsigned m_preloadResult : 2; // PreloadResult | 418 unsigned m_preloadResult : 2; // PreloadResult |
| 409 unsigned m_type : 4; // Type | 419 unsigned m_type : 4; // Type |
| 410 unsigned m_status : 3; // Status | 420 unsigned m_status : 3; // Status |
| 411 | 421 |
| 412 unsigned m_needsSynchronousCacheHit : 1; | 422 unsigned m_needsSynchronousCacheHit : 1; |
| 413 unsigned m_linkPreload : 1; | 423 unsigned m_linkPreload : 1; |
| 414 bool m_isRevalidating : 1; | 424 bool m_isRevalidating : 1; |
| 415 bool m_isAlive : 1; | 425 bool m_isAlive : 1; |
| 416 | 426 |
| 427 ResourceIntegrityDisposition m_integrityDisposition; |
| 428 IntegrityMetadataSet m_integrityMetadata; |
| 429 |
| 417 bool m_isAddRemoveClientProhibited; | 430 bool m_isAddRemoveClientProhibited; |
| 418 | 431 |
| 419 // Ordered list of all redirects followed while fetching this resource. | 432 // Ordered list of all redirects followed while fetching this resource. |
| 420 Vector<RedirectPair> m_redirectChain; | 433 Vector<RedirectPair> m_redirectChain; |
| 421 | 434 |
| 422 HeapHashCountedSet<WeakMember<ResourceClient>> m_clients; | 435 HeapHashCountedSet<WeakMember<ResourceClient>> m_clients; |
| 423 HeapHashCountedSet<WeakMember<ResourceClient>> m_clientsAwaitingCallback; | 436 HeapHashCountedSet<WeakMember<ResourceClient>> m_clientsAwaitingCallback; |
| 424 HeapHashCountedSet<WeakMember<ResourceClient>> m_finishedClients; | 437 HeapHashCountedSet<WeakMember<ResourceClient>> m_finishedClients; |
| 425 | 438 |
| 426 ResourceLoaderOptions m_options; | 439 ResourceLoaderOptions m_options; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 452 }; | 465 }; |
| 453 | 466 |
| 454 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ | 467 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ |
| 455 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \ | 468 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \ |
| 456 resource->getType() == Resource::typeName, \ | 469 resource->getType() == Resource::typeName, \ |
| 457 resource.getType() == Resource::typeName); | 470 resource.getType() == Resource::typeName); |
| 458 | 471 |
| 459 } // namespace blink | 472 } // namespace blink |
| 460 | 473 |
| 461 #endif | 474 #endif |
| OLD | NEW |