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
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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 173 |
174 // Called by the cache if the object has been removed from the cache | 174 // Called by the cache if the object has been removed from the cache |
175 // while still being referenced. This means the object should delete itself | 175 // while still being referenced. This means the object should delete itself |
176 // if the number of clients observing it ever drops to 0. | 176 // if the number of clients observing it ever drops to 0. |
177 // The resource can be brought back to cache after successful revalidation. | 177 // The resource can be brought back to cache after successful revalidation. |
178 void setInCache(bool inCache) { m_inCache = inCache; } | 178 void setInCache(bool inCache) { m_inCache = inCache; } |
179 bool inCache() const { return m_inCache; } | 179 bool inCache() const { return m_inCache; } |
180 | 180 |
181 void setCacheLiveResourcePriority(CacheLiveResourcePriority); | 181 void setCacheLiveResourcePriority(CacheLiveResourcePriority); |
182 unsigned cacheLiveResourcePriority() const { return m_cacheLiveResourcePrior
ity; } | 182 unsigned cacheLiveResourcePriority() const { return m_cacheLiveResourcePrior
ity; } |
183 bool inLiveDecodedResourcesList() { return m_inLiveDecodedResourcesList; } | |
184 | 183 |
185 void clearLoader(); | 184 void clearLoader(); |
186 | 185 |
187 SharedBuffer* resourceBuffer() const { ASSERT(!m_purgeableData); return m_da
ta.get(); } | 186 SharedBuffer* resourceBuffer() const { ASSERT(!m_purgeableData); return m_da
ta.get(); } |
188 void setResourceBuffer(PassRefPtr<SharedBuffer>); | 187 void setResourceBuffer(PassRefPtr<SharedBuffer>); |
189 | 188 |
190 virtual void willSendRequest(ResourceRequest&, const ResourceResponse&); | 189 virtual void willSendRequest(ResourceRequest&, const ResourceResponse&); |
191 | 190 |
192 virtual void updateRequest(const ResourceRequest&) { } | 191 virtual void updateRequest(const ResourceRequest&) { } |
193 virtual void responseReceived(const ResourceResponse&); | 192 virtual void responseReceived(const ResourceResponse&); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 | 357 |
359 size_t m_encodedSize; | 358 size_t m_encodedSize; |
360 size_t m_decodedSize; | 359 size_t m_decodedSize; |
361 unsigned m_accessCount; | 360 unsigned m_accessCount; |
362 unsigned m_handleCount; | 361 unsigned m_handleCount; |
363 unsigned m_preloadCount; | 362 unsigned m_preloadCount; |
364 unsigned m_protectorCount; | 363 unsigned m_protectorCount; |
365 | 364 |
366 unsigned m_preloadResult : 2; // PreloadResult | 365 unsigned m_preloadResult : 2; // PreloadResult |
367 unsigned m_cacheLiveResourcePriority : 2; // CacheLiveResourcePriority | 366 unsigned m_cacheLiveResourcePriority : 2; // CacheLiveResourcePriority |
368 unsigned m_inLiveDecodedResourcesList : 1; | |
369 unsigned m_requestedFromNetworkingLayer : 1; | 367 unsigned m_requestedFromNetworkingLayer : 1; |
370 | 368 |
371 unsigned m_inCache : 1; | 369 unsigned m_inCache : 1; |
372 unsigned m_loading : 1; | 370 unsigned m_loading : 1; |
373 | 371 |
374 unsigned m_switchingClientsToRevalidatedResource : 1; | 372 unsigned m_switchingClientsToRevalidatedResource : 1; |
375 | 373 |
376 unsigned m_type : 4; // Type | 374 unsigned m_type : 4; // Type |
377 unsigned m_status : 3; // Status | 375 unsigned m_status : 3; // Status |
378 | 376 |
379 unsigned m_wasPurged : 1; | 377 unsigned m_wasPurged : 1; |
380 | 378 |
381 unsigned m_needsSynchronousCacheHit : 1; | 379 unsigned m_needsSynchronousCacheHit : 1; |
382 | 380 |
383 #ifndef NDEBUG | 381 #ifndef NDEBUG |
384 bool m_deleted; | 382 bool m_deleted; |
385 unsigned m_lruIndex; | |
386 #endif | 383 #endif |
387 | 384 |
388 Resource* m_nextInAllResourcesList; | |
389 Resource* m_prevInAllResourcesList; | |
390 | |
391 Resource* m_nextInLiveResourcesList; | |
392 Resource* m_prevInLiveResourcesList; | |
393 | |
394 // 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 | 385 // 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 |
395 // using HTTP If-Modified-Since/If-None-Match headers. If the response is 30
4 all clients of this resource are moved | 386 // using HTTP If-Modified-Since/If-None-Match headers. If the response is 30
4 all clients of this resource are moved |
396 // to to be clients of m_resourceToRevalidate and the resource is deleted. I
f not, the field is zeroed and this | 387 // to to be clients of m_resourceToRevalidate and the resource is deleted. I
f not, the field is zeroed and this |
397 // resources becomes normal resource load. | 388 // resources becomes normal resource load. |
398 Resource* m_resourceToRevalidate; | 389 Resource* m_resourceToRevalidate; |
399 | 390 |
400 // If this field is non-null, the resource has a proxy for checking whether
it is still up to date (see m_resourceToRevalidate). | 391 // If this field is non-null, the resource has a proxy for checking whether
it is still up to date (see m_resourceToRevalidate). |
401 Resource* m_proxyResource; | 392 Resource* m_proxyResource; |
402 | 393 |
403 // These handles will need to be updated to point to the m_resourceToRevalid
ate in case we get 304 response. | 394 // These handles will need to be updated to point to the m_resourceToRevalid
ate in case we get 304 response. |
404 HashSet<ResourcePtrBase*> m_handlesToRevalidate; | 395 HashSet<ResourcePtrBase*> m_handlesToRevalidate; |
405 | 396 |
406 // Ordered list of all redirects followed while fetching this resource. | 397 // Ordered list of all redirects followed while fetching this resource. |
407 Vector<RedirectPair> m_redirectChain; | 398 Vector<RedirectPair> m_redirectChain; |
408 }; | 399 }; |
409 | 400 |
410 #if !LOG_DISABLED | 401 #if !LOG_DISABLED |
411 // Intended to be used in LOG statements. | 402 // Intended to be used in LOG statements. |
412 const char* ResourceTypeName(Resource::Type); | 403 const char* ResourceTypeName(Resource::Type); |
413 #endif | 404 #endif |
414 | 405 |
415 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ | 406 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ |
416 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->type() =
= Resource::typeName, resource.type() == Resource::typeName); \ | 407 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->type() =
= Resource::typeName, resource.type() == Resource::typeName); \ |
417 inline typeName##Resource* to##typeName##Resource(const ResourcePtr<Resource
>& ptr) { return to##typeName##Resource(ptr.get()); } | 408 inline typeName##Resource* to##typeName##Resource(const ResourcePtr<Resource
>& ptr) { return to##typeName##Resource(ptr.get()); } |
418 | 409 |
419 } | 410 } |
420 | 411 |
421 #endif | 412 #endif |
OLD | NEW |