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 Apple Inc. All rights reserved. | 6 Copyright (C) 2004, 2005, 2006, 2007, 2008 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 return 0; | 256 return 0; |
257 return m_cachedMetadata.get(); | 257 return m_cachedMetadata.get(); |
258 } | 258 } |
259 | 259 |
260 void CachedResource::setRequest(CachedResourceRequest* request) | 260 void CachedResource::setRequest(CachedResourceRequest* request) |
261 { | 261 { |
262 if (request && !m_request) | 262 if (request && !m_request) |
263 m_status = Pending; | 263 m_status = Pending; |
264 m_request = request; | 264 m_request = request; |
265 | 265 |
| 266 CachedResourceHandle<CachedResource> protect(this); |
| 267 |
266 // All loads finish with data(allDataReceived = true) or error(), except for | 268 // All loads finish with data(allDataReceived = true) or error(), except for |
267 // canceled loads, which silently set our request to 0. Be sure to notify ou
r | 269 // canceled loads, which silently set our request to 0. Be sure to notify ou
r |
268 // client in that case, so we don't seem to continue loading forever. | 270 // client in that case, so we don't seem to continue loading forever. |
269 if (!m_request && isLoading()) { | 271 if (!m_request && isLoading()) { |
270 setLoading(false); | 272 setLoading(false); |
271 setStatus(Canceled); | 273 setStatus(Canceled); |
272 checkNotify(); | 274 checkNotify(); |
273 } | 275 } |
274 | |
275 if (canDelete() && !inCache()) | |
276 delete this; | |
277 } | 276 } |
278 | 277 |
279 void CachedResource::addClient(CachedResourceClient* client) | 278 void CachedResource::addClient(CachedResourceClient* client) |
280 { | 279 { |
281 addClientToSet(client); | 280 addClientToSet(client); |
282 didAddClient(client); | 281 didAddClient(client); |
283 } | 282 } |
284 | 283 |
285 void CachedResource::didAddClient(CachedResourceClient* c) | 284 void CachedResource::didAddClient(CachedResourceClient* c) |
286 { | 285 { |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 } | 622 } |
624 | 623 |
625 void CachedResource::setLoadPriority(ResourceLoadPriority loadPriority) | 624 void CachedResource::setLoadPriority(ResourceLoadPriority loadPriority) |
626 { | 625 { |
627 if (loadPriority == ResourceLoadPriorityUnresolved) | 626 if (loadPriority == ResourceLoadPriorityUnresolved) |
628 return; | 627 return; |
629 m_loadPriority = loadPriority; | 628 m_loadPriority = loadPriority; |
630 } | 629 } |
631 | 630 |
632 } | 631 } |
OLD | NEW |