|
Krita Source Code Documentation
|
#include <kis_tile_hash_table2.h>
Classes | |
| struct | MemoryReclaimer |
Public Types | |
| typedef T | TileType |
| typedef KisSharedPtr< T > | TileTypeSP |
| typedef KisWeakSharedPtr< T > | TileTypeWSP |
Public Member Functions | |
| void | addTile (TileTypeSP tile) |
| void | clear () |
| void | debugMaxListLength (qint32 &min, qint32 &max) |
| void | debugPrintInfo () |
| KisTileData * | defaultTileData () |
| bool | deleteTile (qint32 col, qint32 row) |
| bool | deleteTile (TileTypeSP tile) |
| TileTypeSP | getExistingTile (qint32 col, qint32 row) |
| TileTypeSP | getReadOnlyTileLazy (qint32 col, qint32 row, bool &existingTile) |
| TileTypeSP | getTileLazy (qint32 col, qint32 row, bool &newTile) |
| bool | isEmpty () |
| KisTileHashTableTraits2 (const KisTileHashTableTraits2< T > &ht, KisMementoManager *mm) | |
| KisTileHashTableTraits2 (KisMementoManager *mm) | |
| qint32 | numTiles () |
| KisTileData * | refAndFetchDefaultTileData () |
| void | setDefaultTileData (KisTileData *defaultTileData) |
| bool | tileExists (qint32 col, qint32 row) |
| ~KisTileHashTableTraits2 () | |
Private Types | |
| typedef ConcurrentMap< quint32, TileType * > | LockFreeTileMap |
| typedef LockFreeTileMap::Mutator | LockFreeTileMapMutator |
Private Member Functions | |
| quint32 | calculateHash (qint32 col, qint32 row) |
| quint32 | calculateHashImpl (qint32 col, qint32 row) |
| quint32 | calculateHashSafe (qint32 col, qint32 row) |
| bool | erase (quint32 idx) |
| void | insert (quint32 idx, TileTypeSP item) |
| Q_STATIC_ASSERT_X (isInherited, "Template must inherit KisShared") | |
Private Attributes | |
| QReadWriteLock | m_defaultPixelDataLock |
| KisTileData * | m_defaultTileData |
| QReadWriteLock | m_iteratorLock |
| LockFreeTileMap | m_map |
| KisMementoManager * | m_mementoManager |
| QAtomicInt | m_numTiles |
Static Private Attributes | |
| static constexpr bool | isInherited = std::is_convertible<T*, KisShared*>::value |
Friends | |
| class | KisTileHashTableIteratorTraits2< T > |
Definition at line 35 of file kis_tile_hash_table2.h.
|
private |
Definition at line 200 of file kis_tile_hash_table2.h.
|
private |
Definition at line 201 of file kis_tile_hash_table2.h.
| typedef T KisTileHashTableTraits2< T >::TileType |
Definition at line 41 of file kis_tile_hash_table2.h.
| typedef KisSharedPtr<T> KisTileHashTableTraits2< T >::TileTypeSP |
Definition at line 42 of file kis_tile_hash_table2.h.
| typedef KisWeakSharedPtr<T> KisTileHashTableTraits2< T >::TileTypeWSP |
Definition at line 43 of file kis_tile_hash_table2.h.
| KisTileHashTableTraits2< T >::KisTileHashTableTraits2 | ( | KisMementoManager * | mm | ) |
Definition at line 272 of file kis_tile_hash_table2.h.
| KisTileHashTableTraits2< T >::KisTileHashTableTraits2 | ( | const KisTileHashTableTraits2< T > & | ht, |
| KisMementoManager * | mm ) |
Definition at line 278 of file kis_tile_hash_table2.h.
References ConcurrentMap< K, V, KT, VT >::Iterator::getKey(), ConcurrentMap< K, V, KT, VT >::Iterator::getValue(), KisTileHashTableTraits2< T >::insert(), ConcurrentMap< K, V, KT, VT >::Iterator::isValid(), KisTileHashTableTraits2< T >::m_defaultTileData, KisTileHashTableTraits2< T >::m_iteratorLock, KisTileHashTableTraits2< T >::m_map, KisTileHashTableTraits2< T >::m_mementoManager, ConcurrentMap< K, V, KT, VT >::Iterator::next(), and KisTileHashTableTraits2< T >::setDefaultTileData().
| KisTileHashTableTraits2< T >::~KisTileHashTableTraits2 | ( | ) |
Definition at line 294 of file kis_tile_hash_table2.h.
| void KisTileHashTableTraits2< T >::addTile | ( | TileTypeSP | tile | ) |
Definition at line 437 of file kis_tile_hash_table2.h.
|
inlineprivate |
Definition at line 136 of file kis_tile_hash_table2.h.
References KisTileHashTableTraits2< T >::calculateHashImpl(), and KIS_ASSERT_RECOVER_NOOP.
|
inlineprivate |
Definition at line 126 of file kis_tile_hash_table2.h.
|
inlineprivate |
A version of the hash function that returns an invalid hash in case the requested tile is out of range
Definition at line 149 of file kis_tile_hash_table2.h.
References KisTileHashTableTraits2< T >::calculateHashImpl(), and KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE.
| void KisTileHashTableTraits2< T >::clear | ( | ) |
Definition at line 462 of file kis_tile_hash_table2.h.
References ConcurrentMap< K, V, KT, VT >::Iterator::getKey(), ConcurrentMap< K, V, KT, VT >::Iterator::isValid(), and ConcurrentMap< K, V, KT, VT >::Iterator::next().
| void KisTileHashTableTraits2< T >::debugMaxListLength | ( | qint32 & | min, |
| qint32 & | max ) |
Definition at line 528 of file kis_tile_hash_table2.h.
| void KisTileHashTableTraits2< T >::debugPrintInfo | ( | ) |
Definition at line 523 of file kis_tile_hash_table2.h.
|
inline |
Definition at line 507 of file kis_tile_hash_table2.h.
| bool KisTileHashTableTraits2< T >::deleteTile | ( | qint32 | col, |
| qint32 | row ) |
when invalid tile index is requested, just do nothing
Definition at line 450 of file kis_tile_hash_table2.h.
| bool KisTileHashTableTraits2< T >::deleteTile | ( | TileTypeSP | tile | ) |
Definition at line 444 of file kis_tile_hash_table2.h.
|
inlineprivate |
Definition at line 178 of file kis_tile_hash_table2.h.
References KisTileHashTableTraits2< T >::MemoryReclaimer::destroy(), QSBR::enqueue(), ConcurrentMap< K, V, KT, VT >::erase(), ConcurrentMap< K, V, KT, VT >::getGC(), QSBR::lockRawPointerAccess(), KisTileHashTableTraits2< T >::m_map, KisTileHashTableTraits2< T >::m_numTiles, QSBR::unlockRawPointerAccess(), and QSBR::update().
| KisTileHashTableTraits2< T >::TileTypeSP KisTileHashTableTraits2< T >::getExistingTile | ( | qint32 | col, |
| qint32 | row ) |
Returns a tile in position (col,row). If no tile exists, returns null.
| col | column of the tile |
| row | row of the tile |
a tile with invalid index obviously doesn't exist
Definition at line 307 of file kis_tile_hash_table2.h.
| KisTileHashTableTraits2< T >::TileTypeSP KisTileHashTableTraits2< T >::getReadOnlyTileLazy | ( | qint32 | col, |
| qint32 | row, | ||
| bool & | existingTile ) |
Returns a tile in position (col,row). If no tile exists, creates nothing, but returns shared default tile object of the table. Be careful, this object has column and row parameters set to (qint32_MIN, qint32_MIN).
| col | column of the tile |
| row | row of the tile |
| existingTile | returns true if the tile actually exists in the table and it is not a lazily created default wrapper tile |
when invalid tile index is requested, just return a detached tile with the default data
we pretend as if this tile hasn't existed, it will allow the calling code to avoid modifying the extent manager (note, that is opposite to what happens in getTileLazy())
Definition at line 404 of file kis_tile_hash_table2.h.
| KisTileHashTableTraits2< T >::TileTypeSP KisTileHashTableTraits2< T >::getTileLazy | ( | qint32 | col, |
| qint32 | row, | ||
| bool & | newTile ) |
Returns a tile in position (col,row). If no tile exists, creates a new one, attaches it to the list and returns.
| col | column of the tile |
| row | row of the tile |
| newTile | out-parameter, returns true if a new tile was created |
when invalid tile index is requested, just return a detached tile with the default data
we pretend as if this tile has already existed, it will allow the calling code to avoid modifying the extent manager
Definition at line 324 of file kis_tile_hash_table2.h.
References KisSharedPtr< T >::data(), and newTile().
|
inlineprivate |
Definition at line 155 of file kis_tile_hash_table2.h.
References ConcurrentMap< K, V, KT, VT >::assign(), KisSharedPtr< T >::data(), KisTileHashTableTraits2< T >::MemoryReclaimer::destroy(), QSBR::enqueue(), ConcurrentMap< K, V, KT, VT >::getGC(), QSBR::lockRawPointerAccess(), KisTileHashTableTraits2< T >::m_iteratorLock, KisTileHashTableTraits2< T >::m_map, KisTileHashTableTraits2< T >::m_numTiles, KisSharedPtr< T >::ref(), QSBR::unlockRawPointerAccess(), and QSBR::update().
|
inline |
Definition at line 49 of file kis_tile_hash_table2.h.
References KisTileHashTableTraits2< T >::m_numTiles.
|
inline |
Definition at line 102 of file kis_tile_hash_table2.h.
References KisTileHashTableTraits2< T >::m_numTiles.
|
private |
|
inline |
Returns a pointer to the default tile data object with ref counter increased by one. Make sure you call deref() after you finished using this object.
Definition at line 514 of file kis_tile_hash_table2.h.
|
inline |
Definition at line 491 of file kis_tile_hash_table2.h.
References KisTileData::acquire().
| bool KisTileHashTableTraits2< T >::tileExists | ( | qint32 | col, |
| qint32 | row ) |
Definition at line 301 of file kis_tile_hash_table2.h.
|
friend |
Definition at line 108 of file kis_tile_hash_table2.h.
|
staticconstexprprivate |
Definition at line 37 of file kis_tile_hash_table2.h.
|
private |
We still need something to guard changes in m_defaultTileData, otherwise there will be concurrent read/writes, resulting in broken memory.
Definition at line 208 of file kis_tile_hash_table2.h.
|
private |
Definition at line 212 of file kis_tile_hash_table2.h.
|
mutableprivate |
Definition at line 209 of file kis_tile_hash_table2.h.
|
mutableprivate |
Definition at line 202 of file kis_tile_hash_table2.h.
|
private |
Definition at line 213 of file kis_tile_hash_table2.h.
|
private |
Definition at line 211 of file kis_tile_hash_table2.h.