Chromium Code Reviews| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 enum Status { | 75 enum Status { |
| 76 Unknown, // let cache decide what to do with it | 76 Unknown, // let cache decide what to do with it |
| 77 Pending, // only partially loaded | 77 Pending, // only partially loaded |
| 78 Cached, // regular case | 78 Cached, // regular case |
| 79 LoadError, | 79 LoadError, |
| 80 DecodeError | 80 DecodeError |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 enum DecodePriority { | |
|
Justin Novosad
2013/07/23 16:55:12
Hmmm... this name sounds like it determines which
| |
| 84 DecodePriorityLow = 0, | |
| 85 DecodePriorityMedium, | |
| 86 DecodePriorityHigh | |
| 87 }; | |
| 88 | |
| 83 CachedResource(const ResourceRequest&, Type); | 89 CachedResource(const ResourceRequest&, Type); |
| 84 virtual ~CachedResource(); | 90 virtual ~CachedResource(); |
| 85 | 91 |
| 86 virtual void load(CachedResourceLoader*, const ResourceLoaderOptions&); | 92 virtual void load(CachedResourceLoader*, const ResourceLoaderOptions&); |
| 87 | 93 |
| 88 virtual void setEncoding(const String&) { } | 94 virtual void setEncoding(const String&) { } |
| 89 virtual String encoding() const { return String(); } | 95 virtual String encoding() const { return String(); } |
| 90 virtual void appendData(const char*, int); | 96 virtual void appendData(const char*, int); |
| 91 virtual void error(CachedResource::Status); | 97 virtual void error(CachedResource::Status); |
| 92 | 98 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 bool passesAccessControlCheck(SecurityOrigin*, String& errorDescription); | 168 bool passesAccessControlCheck(SecurityOrigin*, String& errorDescription); |
| 163 bool canBeAccessedBy(SecurityOrigin*, String& error); | 169 bool canBeAccessedBy(SecurityOrigin*, String& error); |
| 164 | 170 |
| 165 // Called by the cache if the object has been removed from the cache | 171 // Called by the cache if the object has been removed from the cache |
| 166 // while still being referenced. This means the object should delete itself | 172 // while still being referenced. This means the object should delete itself |
| 167 // if the number of clients observing it ever drops to 0. | 173 // if the number of clients observing it ever drops to 0. |
| 168 // The resource can be brought back to cache after successful revalidation. | 174 // The resource can be brought back to cache after successful revalidation. |
| 169 void setInCache(bool inCache) { m_inCache = inCache; } | 175 void setInCache(bool inCache) { m_inCache = inCache; } |
| 170 bool inCache() const { return m_inCache; } | 176 bool inCache() const { return m_inCache; } |
| 171 | 177 |
| 178 void setDecodePriority(DecodePriority); | |
| 179 DecodePriority decodePriority() const { return m_decodePriority; } | |
| 172 bool inLiveDecodedResourcesList() { return m_inLiveDecodedResourcesList; } | 180 bool inLiveDecodedResourcesList() { return m_inLiveDecodedResourcesList; } |
| 173 | 181 |
| 174 void clearLoader(); | 182 void clearLoader(); |
| 175 | 183 |
| 176 SharedBuffer* resourceBuffer() const { ASSERT(!m_purgeableData); return m_da ta.get(); } | 184 SharedBuffer* resourceBuffer() const { ASSERT(!m_purgeableData); return m_da ta.get(); } |
| 177 | 185 |
| 178 virtual void willSendRequest(ResourceRequest&, const ResourceResponse&) { m_ requestedFromNetworkingLayer = true; } | 186 virtual void willSendRequest(ResourceRequest&, const ResourceResponse&) { m_ requestedFromNetworkingLayer = true; } |
| 179 virtual void responseReceived(const ResourceResponse&); | 187 virtual void responseReceived(const ResourceResponse&); |
| 180 void setResponse(const ResourceResponse& response) { m_response = response; } | 188 void setResponse(const ResourceResponse& response) { m_response = response; } |
| 181 const ResourceResponse& response() const { return m_response; } | 189 const ResourceResponse& response() const { return m_response; } |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 310 unsigned long m_identifier; | 318 unsigned long m_identifier; |
| 311 | 319 |
| 312 unsigned m_encodedSize; | 320 unsigned m_encodedSize; |
| 313 unsigned m_decodedSize; | 321 unsigned m_decodedSize; |
| 314 unsigned m_accessCount; | 322 unsigned m_accessCount; |
| 315 unsigned m_handleCount; | 323 unsigned m_handleCount; |
| 316 unsigned m_preloadCount; | 324 unsigned m_preloadCount; |
| 317 | 325 |
| 318 unsigned m_preloadResult : 2; // PreloadResult | 326 unsigned m_preloadResult : 2; // PreloadResult |
| 319 | 327 |
| 328 DecodePriority m_decodePriority; | |
| 320 bool m_inLiveDecodedResourcesList : 1; | 329 bool m_inLiveDecodedResourcesList : 1; |
| 321 bool m_requestedFromNetworkingLayer : 1; | 330 bool m_requestedFromNetworkingLayer : 1; |
| 322 | 331 |
| 323 bool m_inCache : 1; | 332 bool m_inCache : 1; |
| 324 bool m_loading : 1; | 333 bool m_loading : 1; |
| 325 | 334 |
| 326 bool m_switchingClientsToRevalidatedResource : 1; | 335 bool m_switchingClientsToRevalidatedResource : 1; |
| 327 | 336 |
| 328 unsigned m_type : 4; // Type | 337 unsigned m_type : 4; // Type |
| 329 unsigned m_status : 3; // Status | 338 unsigned m_status : 3; // Status |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 348 // If this field is non-null, the resource has a proxy for checking whether it is still up to date (see m_resourceToRevalidate). | 357 // If this field is non-null, the resource has a proxy for checking whether it is still up to date (see m_resourceToRevalidate). |
| 349 CachedResource* m_proxyResource; | 358 CachedResource* m_proxyResource; |
| 350 | 359 |
| 351 // These handles will need to be updated to point to the m_resourceToRevalid ate in case we get 304 response. | 360 // These handles will need to be updated to point to the m_resourceToRevalid ate in case we get 304 response. |
| 352 HashSet<CachedResourceHandleBase*> m_handlesToRevalidate; | 361 HashSet<CachedResourceHandleBase*> m_handlesToRevalidate; |
| 353 }; | 362 }; |
| 354 | 363 |
| 355 } | 364 } |
| 356 | 365 |
| 357 #endif | 366 #endif |
| OLD | NEW |