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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 152 |
153 virtual bool isImage() const { return false; } | 153 virtual bool isImage() const { return false; } |
154 bool ignoreForRequestCount() const | 154 bool ignoreForRequestCount() const |
155 { | 155 { |
156 return type() == MainResource | 156 return type() == MainResource |
157 || type() == LinkPrefetch | 157 || type() == LinkPrefetch |
158 || type() == LinkSubresource | 158 || type() == LinkSubresource |
159 || type() == Raw; | 159 || type() == Raw; |
160 } | 160 } |
161 | 161 |
162 void updateForAccess(); | |
163 unsigned accessCount() const { return m_accessCount; } | |
164 | |
165 // Computes the status of an object after loading. | 162 // Computes the status of an object after loading. |
166 // Updates the expire date on the cache entry file | 163 // Updates the expire date on the cache entry file |
167 void finish(double finishTime = 0.0); | 164 void finish(double finishTime = 0.0); |
168 | 165 |
169 // FIXME: Remove the stringless variant once all the callsites' error messag
es are updated. | 166 // FIXME: Remove the stringless variant once all the callsites' error messag
es are updated. |
170 bool passesAccessControlCheck(SecurityOrigin*); | 167 bool passesAccessControlCheck(SecurityOrigin*); |
171 bool passesAccessControlCheck(SecurityOrigin*, String& errorDescription); | 168 bool passesAccessControlCheck(SecurityOrigin*, String& errorDescription); |
172 | 169 |
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 | |
175 // if the number of clients observing it ever drops to 0. | |
176 // The resource can be brought back to cache after successful revalidation. | |
177 void setInCache(bool inCache) { m_inCache = inCache; } | |
178 bool inCache() const { return m_inCache; } | |
179 | |
180 void setCacheLiveResourcePriority(CacheLiveResourcePriority); | 170 void setCacheLiveResourcePriority(CacheLiveResourcePriority); |
181 unsigned cacheLiveResourcePriority() const { return m_cacheLiveResourcePrior
ity; } | 171 unsigned cacheLiveResourcePriority() const { return m_cacheLiveResourcePrior
ity; } |
182 | 172 |
183 void clearLoader(); | 173 void clearLoader(); |
184 | 174 |
185 SharedBuffer* resourceBuffer() const { return m_data.get(); } | 175 SharedBuffer* resourceBuffer() const { return m_data.get(); } |
186 void setResourceBuffer(PassRefPtr<SharedBuffer>); | 176 void setResourceBuffer(PassRefPtr<SharedBuffer>); |
187 | 177 |
188 virtual void willSendRequest(ResourceRequest&, const ResourceResponse&); | 178 virtual void willSendRequest(ResourceRequest&, const ResourceResponse&); |
189 | 179 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 | 340 |
351 ResourceError m_error; | 341 ResourceError m_error; |
352 | 342 |
353 double m_lastDecodedAccessTime; // Used as a "thrash guard" in the cache | 343 double m_lastDecodedAccessTime; // Used as a "thrash guard" in the cache |
354 double m_loadFinishTime; | 344 double m_loadFinishTime; |
355 | 345 |
356 unsigned long m_identifier; | 346 unsigned long m_identifier; |
357 | 347 |
358 size_t m_encodedSize; | 348 size_t m_encodedSize; |
359 size_t m_decodedSize; | 349 size_t m_decodedSize; |
360 unsigned m_accessCount; | |
361 unsigned m_handleCount; | 350 unsigned m_handleCount; |
362 unsigned m_preloadCount; | 351 unsigned m_preloadCount; |
363 unsigned m_protectorCount; | 352 unsigned m_protectorCount; |
364 | 353 |
365 unsigned m_preloadResult : 2; // PreloadResult | 354 unsigned m_preloadResult : 2; // PreloadResult |
366 unsigned m_cacheLiveResourcePriority : 2; // CacheLiveResourcePriority | 355 unsigned m_cacheLiveResourcePriority : 2; // CacheLiveResourcePriority |
367 unsigned m_requestedFromNetworkingLayer : 1; | 356 unsigned m_requestedFromNetworkingLayer : 1; |
368 | 357 |
369 unsigned m_inCache : 1; | |
370 unsigned m_loading : 1; | 358 unsigned m_loading : 1; |
371 | 359 |
372 unsigned m_switchingClientsToRevalidatedResource : 1; | 360 unsigned m_switchingClientsToRevalidatedResource : 1; |
373 | 361 |
374 unsigned m_type : 4; // Type | 362 unsigned m_type : 4; // Type |
375 unsigned m_status : 3; // Status | 363 unsigned m_status : 3; // Status |
376 | 364 |
377 unsigned m_wasPurged : 1; | 365 unsigned m_wasPurged : 1; |
378 | 366 |
379 unsigned m_needsSynchronousCacheHit : 1; | 367 unsigned m_needsSynchronousCacheHit : 1; |
(...skipping 23 matching lines...) Expand all Loading... |
403 const char* ResourceTypeName(Resource::Type); | 391 const char* ResourceTypeName(Resource::Type); |
404 #endif | 392 #endif |
405 | 393 |
406 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ | 394 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ |
407 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->type() =
= Resource::typeName, resource.type() == Resource::typeName); \ | 395 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->type() =
= Resource::typeName, resource.type() == Resource::typeName); \ |
408 inline typeName##Resource* to##typeName##Resource(const ResourcePtr<Resource
>& ptr) { return to##typeName##Resource(ptr.get()); } | 396 inline typeName##Resource* to##typeName##Resource(const ResourcePtr<Resource
>& ptr) { return to##typeName##Resource(ptr.get()); } |
409 | 397 |
410 } | 398 } |
411 | 399 |
412 #endif | 400 #endif |
OLD | NEW |