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) 2002 Waldo Bastian (bastian@kde.org) | 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) |
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
rights reserved. | 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 , m_cancelTimer(this, &CachedResource::cancelTimerFired) | 99 , m_cancelTimer(this, &CachedResource::cancelTimerFired) |
100 , m_lastDecodedAccessTime(0) | 100 , m_lastDecodedAccessTime(0) |
101 , m_loadFinishTime(0) | 101 , m_loadFinishTime(0) |
102 , m_identifier(0) | 102 , m_identifier(0) |
103 , m_encodedSize(0) | 103 , m_encodedSize(0) |
104 , m_decodedSize(0) | 104 , m_decodedSize(0) |
105 , m_accessCount(0) | 105 , m_accessCount(0) |
106 , m_handleCount(0) | 106 , m_handleCount(0) |
107 , m_preloadCount(0) | 107 , m_preloadCount(0) |
108 , m_preloadResult(PreloadNotReferenced) | 108 , m_preloadResult(PreloadNotReferenced) |
| 109 , m_cachePriority(CachePriorityLow) |
109 , m_inLiveDecodedResourcesList(false) | 110 , m_inLiveDecodedResourcesList(false) |
110 , m_requestedFromNetworkingLayer(false) | 111 , m_requestedFromNetworkingLayer(false) |
111 , m_inCache(false) | 112 , m_inCache(false) |
112 , m_loading(false) | 113 , m_loading(false) |
113 , m_switchingClientsToRevalidatedResource(false) | 114 , m_switchingClientsToRevalidatedResource(false) |
114 , m_type(type) | 115 , m_type(type) |
115 , m_status(Pending) | 116 , m_status(Pending) |
116 #ifndef NDEBUG | 117 #ifndef NDEBUG |
117 , m_deleted(false) | 118 , m_deleted(false) |
118 , m_lruIndex(0) | 119 , m_lruIndex(0) |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 WebKit::Platform::current()->cacheMetadata(m_response.url(), m_response.resp
onseTime(), serializedData.data(), serializedData.size()); | 337 WebKit::Platform::current()->cacheMetadata(m_response.url(), m_response.resp
onseTime(), serializedData.data(), serializedData.size()); |
337 } | 338 } |
338 | 339 |
339 CachedMetadata* CachedResource::cachedMetadata(unsigned dataTypeID) const | 340 CachedMetadata* CachedResource::cachedMetadata(unsigned dataTypeID) const |
340 { | 341 { |
341 if (!m_cachedMetadata || m_cachedMetadata->dataTypeID() != dataTypeID) | 342 if (!m_cachedMetadata || m_cachedMetadata->dataTypeID() != dataTypeID) |
342 return 0; | 343 return 0; |
343 return m_cachedMetadata.get(); | 344 return m_cachedMetadata.get(); |
344 } | 345 } |
345 | 346 |
| 347 void CachedResource::setCachePriority(CachePriority priority) |
| 348 { |
| 349 m_lastDecodedAccessTime = currentTime(); |
| 350 if (inCache()) { |
| 351 if (m_inLiveDecodedResourcesList && m_cachePriority != priority) { |
| 352 memoryCache()->removeFromLiveDecodedResourcesList(this); |
| 353 m_cachePriority = priority; |
| 354 memoryCache()->insertInLiveDecodedResourcesList(this); |
| 355 } |
| 356 memoryCache()->prune(); |
| 357 } |
| 358 } |
| 359 |
346 void CachedResource::clearLoader() | 360 void CachedResource::clearLoader() |
347 { | 361 { |
348 m_loader = 0; | 362 m_loader = 0; |
349 } | 363 } |
350 | 364 |
351 void CachedResource::addClient(CachedResourceClient* client) | 365 void CachedResource::addClient(CachedResourceClient* client) |
352 { | 366 { |
353 if (addClientToSet(client)) | 367 if (addClientToSet(client)) |
354 didAddClient(client); | 368 didAddClient(client); |
355 } | 369 } |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 if (m_callbackTimer.isActive()) | 832 if (m_callbackTimer.isActive()) |
819 m_callbackTimer.stop(); | 833 m_callbackTimer.stop(); |
820 } | 834 } |
821 | 835 |
822 void CachedResource::CachedResourceCallback::timerFired(Timer<CachedResourceCall
back>*) | 836 void CachedResource::CachedResourceCallback::timerFired(Timer<CachedResourceCall
back>*) |
823 { | 837 { |
824 m_resource->didAddClient(m_client); | 838 m_resource->didAddClient(m_client); |
825 } | 839 } |
826 | 840 |
827 } | 841 } |
| 842 |
OLD | NEW |