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

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

Issue 2656443003: Make the uses of Resource::m_resourceRequest/m_response const if applicable (Closed)
Patch Set: Rebase Created 3 years, 10 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/fetch/Resource.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 const ResourceRequest& lastResourceRequest() const; 141 const ResourceRequest& lastResourceRequest() const;
142 142
143 virtual void setRevalidatingRequest(const ResourceRequest&); 143 virtual void setRevalidatingRequest(const ResourceRequest&);
144 144
145 void setFetcherSecurityOrigin(SecurityOrigin* origin) { 145 void setFetcherSecurityOrigin(SecurityOrigin* origin) {
146 m_fetcherSecurityOrigin = origin; 146 m_fetcherSecurityOrigin = origin;
147 } 147 }
148 148
149 // This url can have a fragment, but it can match resources that differ by the 149 // This url can have a fragment, but it can match resources that differ by the
150 // fragment only. 150 // fragment only.
151 const KURL& url() const { return m_resourceRequest.url(); } 151 const KURL& url() const { return resourceRequest().url(); }
152 Type getType() const { return static_cast<Type>(m_type); } 152 Type getType() const { return static_cast<Type>(m_type); }
153 const ResourceLoaderOptions& options() const { return m_options; } 153 const ResourceLoaderOptions& options() const { return m_options; }
154 ResourceLoaderOptions& mutableOptions() { return m_options; } 154 ResourceLoaderOptions& mutableOptions() { return m_options; }
155 155
156 void didChangePriority(ResourceLoadPriority, int intraPriorityValue); 156 void didChangePriority(ResourceLoadPriority, int intraPriorityValue);
157 virtual ResourcePriority priorityFromObservers() { 157 virtual ResourcePriority priorityFromObservers() {
158 return ResourcePriority(); 158 return ResourcePriority();
159 } 159 }
160 160
161 // The reference policy indicates that the client should not affect whether 161 // The reference policy indicates that the client should not affect whether
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 bool isUnusedPreload() const { 260 bool isUnusedPreload() const {
261 return isPreloaded() && getPreloadResult() == PreloadNotReferenced; 261 return isPreloaded() && getPreloadResult() == PreloadNotReferenced;
262 } 262 }
263 bool isPreloaded() const { return m_preloadCount; } 263 bool isPreloaded() const { return m_preloadCount; }
264 void increasePreloadCount() { ++m_preloadCount; } 264 void increasePreloadCount() { ++m_preloadCount; }
265 void decreasePreloadCount() { 265 void decreasePreloadCount() {
266 DCHECK(m_preloadCount); 266 DCHECK(m_preloadCount);
267 --m_preloadCount; 267 --m_preloadCount;
268 } 268 }
269 269
270 bool canReuseRedirectChain(); 270 bool canReuseRedirectChain() const;
271 bool mustRevalidateDueToCacheHeaders(); 271 bool mustRevalidateDueToCacheHeaders() const;
272 bool canUseCacheValidator(); 272 bool canUseCacheValidator() const;
273 bool isCacheValidator() const { return m_isRevalidating; } 273 bool isCacheValidator() const { return m_isRevalidating; }
274 bool hasCacheControlNoStoreHeader() const; 274 bool hasCacheControlNoStoreHeader() const;
275 bool hasVaryHeader() const; 275 bool hasVaryHeader() const;
276 276
277 bool isEligibleForIntegrityCheck(SecurityOrigin*) const; 277 bool isEligibleForIntegrityCheck(SecurityOrigin*) const;
278 278
279 void setIntegrityMetadata(const IntegrityMetadataSet& metadata) { 279 void setIntegrityMetadata(const IntegrityMetadataSet& metadata) {
280 m_integrityMetadata = metadata; 280 m_integrityMetadata = metadata;
281 } 281 }
282 const IntegrityMetadataSet& integrityMetadata() const { 282 const IntegrityMetadataSet& integrityMetadata() const {
283 return m_integrityMetadata; 283 return m_integrityMetadata;
284 } 284 }
285 // The argument must never be |NotChecked|. 285 // The argument must never be |NotChecked|.
286 void setIntegrityDisposition(ResourceIntegrityDisposition); 286 void setIntegrityDisposition(ResourceIntegrityDisposition);
287 ResourceIntegrityDisposition integrityDisposition() const { 287 ResourceIntegrityDisposition integrityDisposition() const {
288 return m_integrityDisposition; 288 return m_integrityDisposition;
289 } 289 }
290 bool mustRefetchDueToIntegrityMetadata(const FetchRequest&) const; 290 bool mustRefetchDueToIntegrityMetadata(const FetchRequest&) const;
291 291
292 double currentAge() const; 292 double currentAge() const;
293 double freshnessLifetime(); 293 double freshnessLifetime() const;
294 double stalenessLifetime(); 294 double stalenessLifetime() const;
295 295
296 bool isAlive() const { return m_isAlive; } 296 bool isAlive() const { return m_isAlive; }
297 297
298 void setCacheIdentifier(const String& cacheIdentifier) { 298 void setCacheIdentifier(const String& cacheIdentifier) {
299 m_cacheIdentifier = cacheIdentifier; 299 m_cacheIdentifier = cacheIdentifier;
300 } 300 }
301 String cacheIdentifier() const { return m_cacheIdentifier; } 301 String cacheIdentifier() const { return m_cacheIdentifier; }
302 302
303 virtual void didSendData(unsigned long long /* bytesSent */, 303 virtual void didSendData(unsigned long long /* bytesSent */,
304 unsigned long long /* totalBytesToBeSent */) {} 304 unsigned long long /* totalBytesToBeSent */) {}
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 void setDecodedSize(size_t); 364 void setDecodedSize(size_t);
365 365
366 void finishPendingClients(); 366 void finishPendingClients();
367 367
368 virtual void didAddClient(ResourceClient*); 368 virtual void didAddClient(ResourceClient*);
369 void willAddClientOrObserver(PreloadReferencePolicy); 369 void willAddClientOrObserver(PreloadReferencePolicy);
370 370
371 void didRemoveClientOrObserver(); 371 void didRemoveClientOrObserver();
372 virtual void allClientsAndObserversRemoved(); 372 virtual void allClientsAndObserversRemoved();
373 373
374 bool hasClient(ResourceClient* client) { 374 bool hasClient(ResourceClient* client) const {
375 return m_clients.contains(client) || 375 return m_clients.contains(client) ||
376 m_clientsAwaitingCallback.contains(client) || 376 m_clientsAwaitingCallback.contains(client) ||
377 m_finishedClients.contains(client); 377 m_finishedClients.contains(client);
378 } 378 }
379 379
380 struct RedirectPair { 380 struct RedirectPair {
381 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 381 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
382 382
383 public: 383 public:
384 explicit RedirectPair(const ResourceRequest& request, 384 explicit RedirectPair(const ResourceRequest& request,
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 }; 510 };
511 511
512 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ 512 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \
513 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \ 513 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \
514 resource->getType() == Resource::typeName, \ 514 resource->getType() == Resource::typeName, \
515 resource.getType() == Resource::typeName); 515 resource.getType() == Resource::typeName);
516 516
517 } // namespace blink 517 } // namespace blink
518 518
519 #endif 519 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/fetch/Resource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698