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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 Unknown, // let cache decide what to do with it | 77 Unknown, // let cache decide what to do with it |
78 Pending, // only partially loaded | 78 Pending, // only partially loaded |
79 Cached, // regular case | 79 Cached, // regular case |
80 LoadError, | 80 LoadError, |
81 DecodeError | 81 DecodeError |
82 }; | 82 }; |
83 | 83 |
84 Resource(const ResourceRequest&, Type); | 84 Resource(const ResourceRequest&, Type); |
85 virtual ~Resource(); | 85 virtual ~Resource(); |
86 | 86 |
| 87 // Determines the order in which CachedResources are evicted |
| 88 // from the decoded resources cache. |
| 89 enum CacheLiveResourcePriority { |
| 90 CacheLiveResourcePriorityLow = 0, |
| 91 CacheLiveResourcePriorityHigh |
| 92 }; |
| 93 |
87 virtual void load(ResourceFetcher*, const ResourceLoaderOptions&); | 94 virtual void load(ResourceFetcher*, const ResourceLoaderOptions&); |
88 | 95 |
89 virtual void setEncoding(const String&) { } | 96 virtual void setEncoding(const String&) { } |
90 virtual String encoding() const { return String(); } | 97 virtual String encoding() const { return String(); } |
91 virtual void appendData(const char*, int); | 98 virtual void appendData(const char*, int); |
92 virtual void error(Resource::Status); | 99 virtual void error(Resource::Status); |
93 | 100 |
94 void setResourceError(const ResourceError& error) { m_error = error; } | 101 void setResourceError(const ResourceError& error) { m_error = error; } |
95 const ResourceError& resourceError() const { return m_error; } | 102 const ResourceError& resourceError() const { return m_error; } |
96 | 103 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 bool passesAccessControlCheck(SecurityOrigin*); | 168 bool passesAccessControlCheck(SecurityOrigin*); |
162 bool passesAccessControlCheck(SecurityOrigin*, String& errorDescription); | 169 bool passesAccessControlCheck(SecurityOrigin*, String& errorDescription); |
163 | 170 |
164 // 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 |
165 // while still being referenced. This means the object should delete itself | 172 // while still being referenced. This means the object should delete itself |
166 // if the number of clients observing it ever drops to 0. | 173 // if the number of clients observing it ever drops to 0. |
167 // The resource can be brought back to cache after successful revalidation. | 174 // The resource can be brought back to cache after successful revalidation. |
168 void setInCache(bool inCache) { m_inCache = inCache; } | 175 void setInCache(bool inCache) { m_inCache = inCache; } |
169 bool inCache() const { return m_inCache; } | 176 bool inCache() const { return m_inCache; } |
170 | 177 |
| 178 void setCacheLiveResourcePriority(CacheLiveResourcePriority); |
| 179 unsigned cacheLiveResourcePriority() const { return m_cacheLiveResourcePrior
ity; } |
171 bool inLiveDecodedResourcesList() { return m_inLiveDecodedResourcesList; } | 180 bool inLiveDecodedResourcesList() { return m_inLiveDecodedResourcesList; } |
172 | 181 |
173 void clearLoader(); | 182 void clearLoader(); |
174 | 183 |
175 SharedBuffer* resourceBuffer() const { ASSERT(!m_purgeableData); return m_da
ta.get(); } | 184 SharedBuffer* resourceBuffer() const { ASSERT(!m_purgeableData); return m_da
ta.get(); } |
176 | 185 |
177 virtual void willSendRequest(ResourceRequest&, const ResourceResponse&) { m_
requestedFromNetworkingLayer = true; } | 186 virtual void willSendRequest(ResourceRequest&, const ResourceResponse&) { m_
requestedFromNetworkingLayer = true; } |
178 virtual void responseReceived(const ResourceResponse&); | 187 virtual void responseReceived(const ResourceResponse&); |
179 void setResponse(const ResourceResponse& response) { m_response = response;
} | 188 void setResponse(const ResourceResponse& response) { m_response = response;
} |
180 const ResourceResponse& response() const { return m_response; } | 189 const ResourceResponse& response() const { return m_response; } |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 | 313 |
305 unsigned long m_identifier; | 314 unsigned long m_identifier; |
306 | 315 |
307 unsigned m_encodedSize; | 316 unsigned m_encodedSize; |
308 unsigned m_decodedSize; | 317 unsigned m_decodedSize; |
309 unsigned m_accessCount; | 318 unsigned m_accessCount; |
310 unsigned m_handleCount; | 319 unsigned m_handleCount; |
311 unsigned m_preloadCount; | 320 unsigned m_preloadCount; |
312 | 321 |
313 unsigned m_preloadResult : 2; // PreloadResult | 322 unsigned m_preloadResult : 2; // PreloadResult |
314 | 323 unsigned m_cacheLiveResourcePriority : 2; // CacheLiveResourcePriority |
315 unsigned m_inLiveDecodedResourcesList : 1; | 324 unsigned m_inLiveDecodedResourcesList : 1; |
316 unsigned m_requestedFromNetworkingLayer : 1; | 325 unsigned m_requestedFromNetworkingLayer : 1; |
317 | 326 |
318 unsigned m_inCache : 1; | 327 unsigned m_inCache : 1; |
319 unsigned m_loading : 1; | 328 unsigned m_loading : 1; |
320 | 329 |
321 unsigned m_switchingClientsToRevalidatedResource : 1; | 330 unsigned m_switchingClientsToRevalidatedResource : 1; |
322 | 331 |
323 unsigned m_type : 4; // Type | 332 unsigned m_type : 4; // Type |
324 unsigned m_status : 3; // Status | 333 unsigned m_status : 3; // Status |
(...skipping 18 matching lines...) Expand all Loading... |
343 // If this field is non-null, the resource has a proxy for checking whether
it is still up to date (see m_resourceToRevalidate). | 352 // If this field is non-null, the resource has a proxy for checking whether
it is still up to date (see m_resourceToRevalidate). |
344 Resource* m_proxyResource; | 353 Resource* m_proxyResource; |
345 | 354 |
346 // These handles will need to be updated to point to the m_resourceToRevalid
ate in case we get 304 response. | 355 // These handles will need to be updated to point to the m_resourceToRevalid
ate in case we get 304 response. |
347 HashSet<ResourcePtrBase*> m_handlesToRevalidate; | 356 HashSet<ResourcePtrBase*> m_handlesToRevalidate; |
348 }; | 357 }; |
349 | 358 |
350 } | 359 } |
351 | 360 |
352 #endif | 361 #endif |
OLD | NEW |