| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 void ImageDecodingStore::insertDecoder(const ImageFrameGenerator* generator, Pas
sOwnPtr<ImageDecoder> decoder) | 93 void ImageDecodingStore::insertDecoder(const ImageFrameGenerator* generator, Pas
sOwnPtr<ImageDecoder> decoder) |
| 94 { | 94 { |
| 95 // Prune old cache entries to give space for the new one. | 95 // Prune old cache entries to give space for the new one. |
| 96 prune(); | 96 prune(); |
| 97 | 97 |
| 98 OwnPtr<DecoderCacheEntry> newCacheEntry = DecoderCacheEntry::create(generato
r, std::move(decoder)); | 98 OwnPtr<DecoderCacheEntry> newCacheEntry = DecoderCacheEntry::create(generato
r, std::move(decoder)); |
| 99 | 99 |
| 100 MutexLocker lock(m_mutex); | 100 MutexLocker lock(m_mutex); |
| 101 ASSERT(!m_decoderCacheMap.contains(newCacheEntry->cacheKey())); | 101 ASSERT(!m_decoderCacheMap.contains(newCacheEntry->cacheKey())); |
| 102 insertCacheInternal(newCacheEntry.release(), &m_decoderCacheMap, &m_decoderC
acheKeyMap); | 102 insertCacheInternal(std::move(newCacheEntry), &m_decoderCacheMap, &m_decoder
CacheKeyMap); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void ImageDecodingStore::removeDecoder(const ImageFrameGenerator* generator, con
st ImageDecoder* decoder) | 105 void ImageDecodingStore::removeDecoder(const ImageFrameGenerator* generator, con
st ImageDecoder* decoder) |
| 106 { | 106 { |
| 107 Vector<OwnPtr<CacheEntry>> cacheEntriesToDelete; | 107 Vector<OwnPtr<CacheEntry>> cacheEntriesToDelete; |
| 108 { | 108 { |
| 109 MutexLocker lock(m_mutex); | 109 MutexLocker lock(m_mutex); |
| 110 DecoderCacheMap::iterator iter = m_decoderCacheMap.find(DecoderCacheEntr
y::makeCacheKey(generator, decoder)); | 110 DecoderCacheMap::iterator iter = m_decoderCacheMap.find(DecoderCacheEntr
y::makeCacheKey(generator, decoder)); |
| 111 ASSERT_WITH_SECURITY_IMPLICATION(iter != m_decoderCacheMap.end()); | 111 ASSERT_WITH_SECURITY_IMPLICATION(iter != m_decoderCacheMap.end()); |
| 112 | 112 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 } | 275 } |
| 276 } | 276 } |
| 277 | 277 |
| 278 void ImageDecodingStore::removeFromCacheListInternal(const Vector<OwnPtr<CacheEn
try>>& deletionList) | 278 void ImageDecodingStore::removeFromCacheListInternal(const Vector<OwnPtr<CacheEn
try>>& deletionList) |
| 279 { | 279 { |
| 280 for (size_t i = 0; i < deletionList.size(); ++i) | 280 for (size_t i = 0; i < deletionList.size(); ++i) |
| 281 m_orderedCacheList.remove(deletionList[i].get()); | 281 m_orderedCacheList.remove(deletionList[i].get()); |
| 282 } | 282 } |
| 283 | 283 |
| 284 } // namespace blink | 284 } // namespace blink |
| OLD | NEW |