Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: third_party/WebKit/Source/core/fetch/Resource.h

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

Powered by Google App Engine
This is Rietveld 408576698