| 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" | |
| 30 #include "core/fetch/ResourceLoaderOptions.h" | 29 #include "core/fetch/ResourceLoaderOptions.h" |
| 31 #include "platform/MemoryCoordinator.h" | 30 #include "platform/MemoryCoordinator.h" |
| 32 #include "platform/SharedBuffer.h" | 31 #include "platform/SharedBuffer.h" |
| 33 #include "platform/Timer.h" | 32 #include "platform/Timer.h" |
| 34 #include "platform/network/ResourceError.h" | 33 #include "platform/network/ResourceError.h" |
| 35 #include "platform/network/ResourceLoadPriority.h" | 34 #include "platform/network/ResourceLoadPriority.h" |
| 36 #include "platform/network/ResourceRequest.h" | 35 #include "platform/network/ResourceRequest.h" |
| 37 #include "platform/network/ResourceResponse.h" | 36 #include "platform/network/ResourceResponse.h" |
| 38 #include "platform/scheduler/CancellableTaskFactory.h" | 37 #include "platform/scheduler/CancellableTaskFactory.h" |
| 39 #include "platform/tracing/web_process_memory_dump.h" | 38 #include "platform/tracing/web_process_memory_dump.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 // the cache entry file | 188 // the cache entry file |
| 190 virtual void finish(double finishTime); | 189 virtual void finish(double finishTime); |
| 191 void finish() { finish(0.0); } | 190 void finish() { finish(0.0); } |
| 192 | 191 |
| 193 // FIXME: Remove the stringless variant once all the callsites' error messages | 192 // FIXME: Remove the stringless variant once all the callsites' error messages |
| 194 // are updated. | 193 // are updated. |
| 195 bool passesAccessControlCheck(SecurityOrigin*) const; | 194 bool passesAccessControlCheck(SecurityOrigin*) const; |
| 196 bool passesAccessControlCheck(SecurityOrigin*, | 195 bool passesAccessControlCheck(SecurityOrigin*, |
| 197 String& errorDescription) const; | 196 String& errorDescription) const; |
| 198 | 197 |
| 198 bool isEligibleForIntegrityCheck(SecurityOrigin*) const; |
| 199 |
| 199 virtual PassRefPtr<const SharedBuffer> resourceBuffer() const { | 200 virtual PassRefPtr<const SharedBuffer> resourceBuffer() const { |
| 200 return m_data; | 201 return m_data; |
| 201 } | 202 } |
| 202 void setResourceBuffer(PassRefPtr<SharedBuffer>); | 203 void setResourceBuffer(PassRefPtr<SharedBuffer>); |
| 203 | 204 |
| 204 virtual bool willFollowRedirect(const ResourceRequest&, | 205 virtual bool willFollowRedirect(const ResourceRequest&, |
| 205 const ResourceResponse&); | 206 const ResourceResponse&); |
| 206 | 207 |
| 207 // Called when a redirect response was received but a decision has already | 208 // Called when a redirect response was received but a decision has already |
| 208 // been made to not follow it. | 209 // been made to not follow it. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 DCHECK(m_preloadCount); | 247 DCHECK(m_preloadCount); |
| 247 --m_preloadCount; | 248 --m_preloadCount; |
| 248 } | 249 } |
| 249 | 250 |
| 250 bool canReuseRedirectChain(); | 251 bool canReuseRedirectChain(); |
| 251 bool mustRevalidateDueToCacheHeaders(); | 252 bool mustRevalidateDueToCacheHeaders(); |
| 252 bool canUseCacheValidator(); | 253 bool canUseCacheValidator(); |
| 253 bool isCacheValidator() const { return m_isRevalidating; } | 254 bool isCacheValidator() const { return m_isRevalidating; } |
| 254 bool hasCacheControlNoStoreHeader() const; | 255 bool hasCacheControlNoStoreHeader() const; |
| 255 bool hasVaryHeader() const; | 256 bool hasVaryHeader() const; |
| 256 | 257 virtual bool mustRefetchDueToIntegrityMetadata( |
| 257 bool isEligibleForIntegrityCheck(SecurityOrigin*) const; | 258 const FetchRequest& request) const { |
| 258 | 259 return false; |
| 259 void setIntegrityMetadata(const IntegrityMetadataSet& metadata) { | |
| 260 m_integrityMetadata = metadata; | |
| 261 } | 260 } |
| 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; | |
| 271 | 261 |
| 272 double currentAge() const; | 262 double currentAge() const; |
| 273 double freshnessLifetime(); | 263 double freshnessLifetime(); |
| 274 double stalenessLifetime(); | 264 double stalenessLifetime(); |
| 275 | 265 |
| 276 bool isAlive() const { return m_isAlive; } | 266 bool isAlive() const { return m_isAlive; } |
| 277 | 267 |
| 278 void setCacheIdentifier(const String& cacheIdentifier) { | 268 void setCacheIdentifier(const String& cacheIdentifier) { |
| 279 m_cacheIdentifier = cacheIdentifier; | 269 m_cacheIdentifier = cacheIdentifier; |
| 280 } | 270 } |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 | 407 |
| 418 unsigned m_preloadResult : 2; // PreloadResult | 408 unsigned m_preloadResult : 2; // PreloadResult |
| 419 unsigned m_type : 4; // Type | 409 unsigned m_type : 4; // Type |
| 420 unsigned m_status : 3; // Status | 410 unsigned m_status : 3; // Status |
| 421 | 411 |
| 422 unsigned m_needsSynchronousCacheHit : 1; | 412 unsigned m_needsSynchronousCacheHit : 1; |
| 423 unsigned m_linkPreload : 1; | 413 unsigned m_linkPreload : 1; |
| 424 bool m_isRevalidating : 1; | 414 bool m_isRevalidating : 1; |
| 425 bool m_isAlive : 1; | 415 bool m_isAlive : 1; |
| 426 | 416 |
| 427 ResourceIntegrityDisposition m_integrityDisposition; | |
| 428 IntegrityMetadataSet m_integrityMetadata; | |
| 429 | |
| 430 bool m_isAddRemoveClientProhibited; | 417 bool m_isAddRemoveClientProhibited; |
| 431 | 418 |
| 432 // Ordered list of all redirects followed while fetching this resource. | 419 // Ordered list of all redirects followed while fetching this resource. |
| 433 Vector<RedirectPair> m_redirectChain; | 420 Vector<RedirectPair> m_redirectChain; |
| 434 | 421 |
| 435 HeapHashCountedSet<WeakMember<ResourceClient>> m_clients; | 422 HeapHashCountedSet<WeakMember<ResourceClient>> m_clients; |
| 436 HeapHashCountedSet<WeakMember<ResourceClient>> m_clientsAwaitingCallback; | 423 HeapHashCountedSet<WeakMember<ResourceClient>> m_clientsAwaitingCallback; |
| 437 HeapHashCountedSet<WeakMember<ResourceClient>> m_finishedClients; | 424 HeapHashCountedSet<WeakMember<ResourceClient>> m_finishedClients; |
| 438 | 425 |
| 439 ResourceLoaderOptions m_options; | 426 ResourceLoaderOptions m_options; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 465 }; | 452 }; |
| 466 | 453 |
| 467 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ | 454 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ |
| 468 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \ | 455 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \ |
| 469 resource->getType() == Resource::typeName, \ | 456 resource->getType() == Resource::typeName, \ |
| 470 resource.getType() == Resource::typeName); | 457 resource.getType() == Resource::typeName); |
| 471 | 458 |
| 472 } // namespace blink | 459 } // namespace blink |
| 473 | 460 |
| 474 #endif | 461 #endif |
| OLD | NEW |