| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserv
ed. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserv
ed. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 // from this function as doing so might result in the destruction of this Im
ageLoader. | 457 // from this function as doing so might result in the destruction of this Im
ageLoader. |
| 458 updatedHasPendingEvent(); | 458 updatedHasPendingEvent(); |
| 459 } | 459 } |
| 460 | 460 |
| 461 void ImageLoader::addClient(ImageLoaderClient* client) | 461 void ImageLoader::addClient(ImageLoaderClient* client) |
| 462 { | 462 { |
| 463 if (client->requestsHighLiveResourceCachePriority()) { | 463 if (client->requestsHighLiveResourceCachePriority()) { |
| 464 if (m_image && !m_highPriorityClientCount++) | 464 if (m_image && !m_highPriorityClientCount++) |
| 465 memoryCache()->updateDecodedResource(m_image.get(), UpdateForPropert
yChange, MemoryCacheLiveResourcePriorityHigh); | 465 memoryCache()->updateDecodedResource(m_image.get(), UpdateForPropert
yChange, MemoryCacheLiveResourcePriorityHigh); |
| 466 } | 466 } |
| 467 #if ENABLE(OILPAN) | |
| 468 m_clients.add(client, adoptPtr(new ImageLoaderClientRemover(*this, *client))
); | |
| 469 #else | |
| 470 m_clients.add(client); | 467 m_clients.add(client); |
| 471 #endif | |
| 472 } | 468 } |
| 473 | 469 |
| 474 void ImageLoader::willRemoveClient(ImageLoaderClient& client) | 470 void ImageLoader::willRemoveClient(ImageLoaderClient& client) |
| 475 { | 471 { |
| 476 if (client.requestsHighLiveResourceCachePriority()) { | 472 if (client.requestsHighLiveResourceCachePriority()) { |
| 477 ASSERT(m_highPriorityClientCount); | 473 ASSERT(m_highPriorityClientCount); |
| 478 m_highPriorityClientCount--; | 474 m_highPriorityClientCount--; |
| 479 if (m_image && !m_highPriorityClientCount) | 475 if (m_image && !m_highPriorityClientCount) |
| 480 memoryCache()->updateDecodedResource(m_image.get(), UpdateForPropert
yChange, MemoryCacheLiveResourcePriorityLow); | 476 memoryCache()->updateDecodedResource(m_image.get(), UpdateForPropert
yChange, MemoryCacheLiveResourcePriorityLow); |
| 481 } | 477 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 500 void ImageLoader::elementDidMoveToNewDocument() | 496 void ImageLoader::elementDidMoveToNewDocument() |
| 501 { | 497 { |
| 502 if (m_loadDelayCounter) | 498 if (m_loadDelayCounter) |
| 503 m_loadDelayCounter->documentChanged(m_element->document()); | 499 m_loadDelayCounter->documentChanged(m_element->document()); |
| 504 clearFailedLoadURL(); | 500 clearFailedLoadURL(); |
| 505 setImage(0); | 501 setImage(0); |
| 506 } | 502 } |
| 507 | 503 |
| 508 void ImageLoader::sourceImageChanged() | 504 void ImageLoader::sourceImageChanged() |
| 509 { | 505 { |
| 510 #if ENABLE(OILPAN) | |
| 511 PersistentHeapHashMap<WeakMember<ImageLoaderClient>, OwnPtr<ImageLoaderClien
tRemover> >::iterator end = m_clients.end(); | |
| 512 for (PersistentHeapHashMap<WeakMember<ImageLoaderClient>, OwnPtr<ImageLoader
ClientRemover> >::iterator it = m_clients.begin(); it != end; ++it) { | |
| 513 it->key->notifyImageSourceChanged(); | |
| 514 } | |
| 515 #else | |
| 516 HashSet<ImageLoaderClient*>::iterator end = m_clients.end(); | 506 HashSet<ImageLoaderClient*>::iterator end = m_clients.end(); |
| 517 for (HashSet<ImageLoaderClient*>::iterator it = m_clients.begin(); it != end
; ++it) { | 507 for (HashSet<ImageLoaderClient*>::iterator it = m_clients.begin(); it != end
; ++it) { |
| 518 ImageLoaderClient* handle = *it; | 508 ImageLoaderClient* handle = *it; |
| 519 handle->notifyImageSourceChanged(); | 509 handle->notifyImageSourceChanged(); |
| 520 } | 510 } |
| 521 #endif | |
| 522 } | 511 } |
| 523 | 512 |
| 524 #if ENABLE(OILPAN) | |
| 525 ImageLoader::ImageLoaderClientRemover::~ImageLoaderClientRemover() | |
| 526 { | |
| 527 m_loader.willRemoveClient(m_client); | |
| 528 } | 513 } |
| 529 #endif | |
| 530 | |
| 531 } | |
| OLD | NEW |