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