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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 // the cache entry file | 188 // the cache entry file |
188 virtual void finish(double finishTime); | 189 virtual void finish(double finishTime); |
189 void finish() { finish(0.0); } | 190 void finish() { finish(0.0); } |
190 | 191 |
191 // FIXME: Remove the stringless variant once all the callsites' error messages | 192 // FIXME: Remove the stringless variant once all the callsites' error messages |
192 // are updated. | 193 // are updated. |
193 bool passesAccessControlCheck(SecurityOrigin*) const; | 194 bool passesAccessControlCheck(SecurityOrigin*) const; |
194 bool passesAccessControlCheck(SecurityOrigin*, | 195 bool passesAccessControlCheck(SecurityOrigin*, |
195 String& errorDescription) const; | 196 String& errorDescription) const; |
196 | 197 |
197 bool isEligibleForIntegrityCheck(SecurityOrigin*) const; | |
198 | |
199 virtual PassRefPtr<const SharedBuffer> resourceBuffer() const { | 198 virtual PassRefPtr<const SharedBuffer> resourceBuffer() const { |
200 return m_data; | 199 return m_data; |
201 } | 200 } |
202 void setResourceBuffer(PassRefPtr<SharedBuffer>); | 201 void setResourceBuffer(PassRefPtr<SharedBuffer>); |
203 | 202 |
204 virtual bool willFollowRedirect(const ResourceRequest&, | 203 virtual bool willFollowRedirect(const ResourceRequest&, |
205 const ResourceResponse&); | 204 const ResourceResponse&); |
206 | 205 |
207 // Called when a redirect response was received but a decision has already | 206 // Called when a redirect response was received but a decision has already |
208 // been made to not follow it. | 207 // been made to not follow it. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 DCHECK(m_preloadCount); | 245 DCHECK(m_preloadCount); |
247 --m_preloadCount; | 246 --m_preloadCount; |
248 } | 247 } |
249 | 248 |
250 bool canReuseRedirectChain(); | 249 bool canReuseRedirectChain(); |
251 bool mustRevalidateDueToCacheHeaders(); | 250 bool mustRevalidateDueToCacheHeaders(); |
252 bool canUseCacheValidator(); | 251 bool canUseCacheValidator(); |
253 bool isCacheValidator() const { return m_isRevalidating; } | 252 bool isCacheValidator() const { return m_isRevalidating; } |
254 bool hasCacheControlNoStoreHeader() const; | 253 bool hasCacheControlNoStoreHeader() const; |
255 bool hasVaryHeader() const; | 254 bool hasVaryHeader() const; |
256 virtual bool mustRefetchDueToIntegrityMetadata( | 255 |
257 const FetchRequest& request) const { | 256 bool isEligibleForIntegrityCheck(SecurityOrigin*) const; |
258 return false; | 257 |
| 258 void setIntegrityMetadata(const IntegrityMetadataSet& metadata) { |
| 259 m_integrityMetadata = metadata; |
259 } | 260 } |
| 261 const IntegrityMetadataSet& integrityMetadata() const { |
| 262 return m_integrityMetadata; |
| 263 } |
| 264 // The argument must never be |NotChecked|. |
| 265 void setIntegrityDisposition(ResourceIntegrityDisposition); |
| 266 ResourceIntegrityDisposition integrityDisposition() const { |
| 267 return m_integrityDisposition; |
| 268 } |
| 269 bool mustRefetchDueToIntegrityMetadata(const FetchRequest&) const; |
260 | 270 |
261 double currentAge() const; | 271 double currentAge() const; |
262 double freshnessLifetime(); | 272 double freshnessLifetime(); |
263 double stalenessLifetime(); | 273 double stalenessLifetime(); |
264 | 274 |
265 bool isAlive() const { return m_isAlive; } | 275 bool isAlive() const { return m_isAlive; } |
266 | 276 |
267 void setCacheIdentifier(const String& cacheIdentifier) { | 277 void setCacheIdentifier(const String& cacheIdentifier) { |
268 m_cacheIdentifier = cacheIdentifier; | 278 m_cacheIdentifier = cacheIdentifier; |
269 } | 279 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 | 410 |
401 unsigned m_preloadResult : 2; // PreloadResult | 411 unsigned m_preloadResult : 2; // PreloadResult |
402 unsigned m_type : 4; // Type | 412 unsigned m_type : 4; // Type |
403 unsigned m_status : 3; // Status | 413 unsigned m_status : 3; // Status |
404 | 414 |
405 unsigned m_needsSynchronousCacheHit : 1; | 415 unsigned m_needsSynchronousCacheHit : 1; |
406 unsigned m_linkPreload : 1; | 416 unsigned m_linkPreload : 1; |
407 bool m_isRevalidating : 1; | 417 bool m_isRevalidating : 1; |
408 bool m_isAlive : 1; | 418 bool m_isAlive : 1; |
409 | 419 |
| 420 ResourceIntegrityDisposition m_integrityDisposition; |
| 421 IntegrityMetadataSet m_integrityMetadata; |
| 422 |
410 // Ordered list of all redirects followed while fetching this resource. | 423 // Ordered list of all redirects followed while fetching this resource. |
411 Vector<RedirectPair> m_redirectChain; | 424 Vector<RedirectPair> m_redirectChain; |
412 | 425 |
413 HeapHashCountedSet<WeakMember<ResourceClient>> m_clients; | 426 HeapHashCountedSet<WeakMember<ResourceClient>> m_clients; |
414 HeapHashCountedSet<WeakMember<ResourceClient>> m_clientsAwaitingCallback; | 427 HeapHashCountedSet<WeakMember<ResourceClient>> m_clientsAwaitingCallback; |
415 HeapHashCountedSet<WeakMember<ResourceClient>> m_finishedClients; | 428 HeapHashCountedSet<WeakMember<ResourceClient>> m_finishedClients; |
416 | 429 |
417 ResourceLoaderOptions m_options; | 430 ResourceLoaderOptions m_options; |
418 | 431 |
419 double m_responseTimestamp; | 432 double m_responseTimestamp; |
(...skipping 23 matching lines...) Expand all Loading... |
443 }; | 456 }; |
444 | 457 |
445 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ | 458 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ |
446 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \ | 459 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \ |
447 resource->getType() == Resource::typeName, \ | 460 resource->getType() == Resource::typeName, \ |
448 resource.getType() == Resource::typeName); | 461 resource.getType() == Resource::typeName); |
449 | 462 |
450 } // namespace blink | 463 } // namespace blink |
451 | 464 |
452 #endif | 465 #endif |
OLD | NEW |