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

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

Issue 174523002: Reland "Move MemoryCache implementation details out of Resource" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/fetch/MemoryCacheTest.cpp ('k') | 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 rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 // Called by the cache if the object has been removed from the cache 173 // Called by the cache if the object has been removed from the cache
174 // while still being referenced. This means the object should delete itself 174 // while still being referenced. This means the object should delete itself
175 // if the number of clients observing it ever drops to 0. 175 // if the number of clients observing it ever drops to 0.
176 // The resource can be brought back to cache after successful revalidation. 176 // The resource can be brought back to cache after successful revalidation.
177 void setInCache(bool inCache) { m_inCache = inCache; } 177 void setInCache(bool inCache) { m_inCache = inCache; }
178 bool inCache() const { return m_inCache; } 178 bool inCache() const { return m_inCache; }
179 179
180 void setCacheLiveResourcePriority(CacheLiveResourcePriority); 180 void setCacheLiveResourcePriority(CacheLiveResourcePriority);
181 unsigned cacheLiveResourcePriority() const { return m_cacheLiveResourcePrior ity; } 181 unsigned cacheLiveResourcePriority() const { return m_cacheLiveResourcePrior ity; }
182 bool inLiveDecodedResourcesList() { return m_inLiveDecodedResourcesList; }
183 182
184 void clearLoader(); 183 void clearLoader();
185 184
186 SharedBuffer* resourceBuffer() const { return m_data.get(); } 185 SharedBuffer* resourceBuffer() const { return m_data.get(); }
187 void setResourceBuffer(PassRefPtr<SharedBuffer>); 186 void setResourceBuffer(PassRefPtr<SharedBuffer>);
188 187
189 virtual void willSendRequest(ResourceRequest&, const ResourceResponse&); 188 virtual void willSendRequest(ResourceRequest&, const ResourceResponse&);
190 189
191 virtual void updateRequest(const ResourceRequest&) { } 190 virtual void updateRequest(const ResourceRequest&) { }
192 virtual void responseReceived(const ResourceResponse&); 191 virtual void responseReceived(const ResourceResponse&);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 355
357 size_t m_encodedSize; 356 size_t m_encodedSize;
358 size_t m_decodedSize; 357 size_t m_decodedSize;
359 unsigned m_accessCount; 358 unsigned m_accessCount;
360 unsigned m_handleCount; 359 unsigned m_handleCount;
361 unsigned m_preloadCount; 360 unsigned m_preloadCount;
362 unsigned m_protectorCount; 361 unsigned m_protectorCount;
363 362
364 unsigned m_preloadResult : 2; // PreloadResult 363 unsigned m_preloadResult : 2; // PreloadResult
365 unsigned m_cacheLiveResourcePriority : 2; // CacheLiveResourcePriority 364 unsigned m_cacheLiveResourcePriority : 2; // CacheLiveResourcePriority
366 unsigned m_inLiveDecodedResourcesList : 1;
367 unsigned m_requestedFromNetworkingLayer : 1; 365 unsigned m_requestedFromNetworkingLayer : 1;
368 366
369 unsigned m_inCache : 1; 367 unsigned m_inCache : 1;
370 unsigned m_loading : 1; 368 unsigned m_loading : 1;
371 369
372 unsigned m_switchingClientsToRevalidatedResource : 1; 370 unsigned m_switchingClientsToRevalidatedResource : 1;
373 371
374 unsigned m_type : 4; // Type 372 unsigned m_type : 4; // Type
375 unsigned m_status : 3; // Status 373 unsigned m_status : 3; // Status
376 374
377 unsigned m_wasPurged : 1; 375 unsigned m_wasPurged : 1;
378 376
379 unsigned m_needsSynchronousCacheHit : 1; 377 unsigned m_needsSynchronousCacheHit : 1;
380 378
381 #ifndef NDEBUG 379 #ifndef NDEBUG
382 bool m_deleted; 380 bool m_deleted;
383 unsigned m_lruIndex;
384 #endif 381 #endif
385 382
386 Resource* m_nextInAllResourcesList;
387 Resource* m_prevInAllResourcesList;
388
389 Resource* m_nextInLiveResourcesList;
390 Resource* m_prevInLiveResourcesList;
391
392 // If this field is non-null we are using the resource as a proxy for checki ng whether an existing resource is still up to date 383 // If this field is non-null we are using the resource as a proxy for checki ng whether an existing resource is still up to date
393 // using HTTP If-Modified-Since/If-None-Match headers. If the response is 30 4 all clients of this resource are moved 384 // using HTTP If-Modified-Since/If-None-Match headers. If the response is 30 4 all clients of this resource are moved
394 // to to be clients of m_resourceToRevalidate and the resource is deleted. I f not, the field is zeroed and this 385 // to to be clients of m_resourceToRevalidate and the resource is deleted. I f not, the field is zeroed and this
395 // resources becomes normal resource load. 386 // resources becomes normal resource load.
396 Resource* m_resourceToRevalidate; 387 Resource* m_resourceToRevalidate;
397 388
398 // If this field is non-null, the resource has a proxy for checking whether it is still up to date (see m_resourceToRevalidate). 389 // If this field is non-null, the resource has a proxy for checking whether it is still up to date (see m_resourceToRevalidate).
399 Resource* m_proxyResource; 390 Resource* m_proxyResource;
400 391
401 // These handles will need to be updated to point to the m_resourceToRevalid ate in case we get 304 response. 392 // These handles will need to be updated to point to the m_resourceToRevalid ate in case we get 304 response.
402 HashSet<ResourcePtrBase*> m_handlesToRevalidate; 393 HashSet<ResourcePtrBase*> m_handlesToRevalidate;
403 394
404 // Ordered list of all redirects followed while fetching this resource. 395 // Ordered list of all redirects followed while fetching this resource.
405 Vector<RedirectPair> m_redirectChain; 396 Vector<RedirectPair> m_redirectChain;
406 }; 397 };
407 398
408 #if !LOG_DISABLED 399 #if !LOG_DISABLED
409 // Intended to be used in LOG statements. 400 // Intended to be used in LOG statements.
410 const char* ResourceTypeName(Resource::Type); 401 const char* ResourceTypeName(Resource::Type);
411 #endif 402 #endif
412 403
413 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ 404 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \
414 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->type() = = Resource::typeName, resource.type() == Resource::typeName); \ 405 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->type() = = Resource::typeName, resource.type() == Resource::typeName); \
415 inline typeName##Resource* to##typeName##Resource(const ResourcePtr<Resource >& ptr) { return to##typeName##Resource(ptr.get()); } 406 inline typeName##Resource* to##typeName##Resource(const ResourcePtr<Resource >& ptr) { return to##typeName##Resource(ptr.get()); }
416 407
417 } 408 }
418 409
419 #endif 410 #endif
OLDNEW
« no previous file with comments | « Source/core/fetch/MemoryCacheTest.cpp ('k') | Source/core/fetch/Resource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698