Krita Source Code Documentation
Loading...
Searching...
No Matches
KisSafeNodeProjectionStoreBase Class Reference

#include <KisSafeNodeProjectionStore.h>

+ Inheritance diagram for KisSafeNodeProjectionStoreBase:

Classes

struct  Private
 

Signals

void internalInitiateProjectionsCleanup ()
 

Public Member Functions

 KisSafeNodeProjectionStoreBase (const KisSafeNodeProjectionStoreBase &rhs)
 
void releaseDevice ()
 
void setImage (KisImageWSP image)
 
 ~KisSafeNodeProjectionStoreBase ()
 
- Public Member Functions inherited from KisShared
bool deref ()
 
bool ref ()
 
int refCount ()
 
QAtomicInt * sharedWeakReference ()
 

Protected Member Functions

 KisSafeNodeProjectionStoreBase (StoreImplementationInterface *storeImpl)
 
- Protected Member Functions inherited from KisShared
 KisShared ()
 
 ~KisShared ()
 

Protected Attributes

QScopedPointer< Privatem_d
 

Private Slots

void slotInitiateProjectionsCleanup ()
 

Private Member Functions

void discardCaches ()
 
void recycleProjectionsInSafety ()
 

Friends

class KisRecycleProjectionsJob
 

Detailed Description

Definition at line 21 of file KisSafeNodeProjectionStore.h.

Constructor & Destructor Documentation

◆ KisSafeNodeProjectionStoreBase() [1/2]

KisSafeNodeProjectionStoreBase::KisSafeNodeProjectionStoreBase ( const KisSafeNodeProjectionStoreBase & rhs)

Definition at line 162 of file KisSafeNodeProjectionStore.cpp.

163 : QObject(),
164 KisShared(),
165 m_d(new Private)
166{
167 {
168 QMutexLocker rhsLocker(&rhs.m_d->lock);
169
170 m_d->image = rhs.m_d->image;
171 m_d->store.reset(rhs.m_d->store->clone());
172 }
173
174 moveToThread(qApp->thread());
176}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))

References connect(), internalInitiateProjectionsCleanup(), m_d, and slotInitiateProjectionsCleanup().

◆ ~KisSafeNodeProjectionStoreBase()

KisSafeNodeProjectionStoreBase::~KisSafeNodeProjectionStoreBase ( )

Definition at line 178 of file KisSafeNodeProjectionStore.cpp.

179{
180}

◆ KisSafeNodeProjectionStoreBase() [2/2]

KisSafeNodeProjectionStoreBase::KisSafeNodeProjectionStoreBase ( StoreImplementationInterface * storeImpl)
protected

Definition at line 154 of file KisSafeNodeProjectionStore.cpp.

155 : m_d(new Private)
156{
157 m_d->store.reset(storeImpl);
158 moveToThread(qApp->thread());
160}

References connect(), internalInitiateProjectionsCleanup(), m_d, and slotInitiateProjectionsCleanup().

Member Function Documentation

◆ discardCaches()

void KisSafeNodeProjectionStoreBase::discardCaches ( )
private

Definition at line 215 of file KisSafeNodeProjectionStore.cpp.

216{
217 QMutexLocker locker(&m_d->lock);
218 m_d->store->discardCaches();
219}

References m_d.

◆ internalInitiateProjectionsCleanup

void KisSafeNodeProjectionStoreBase::internalInitiateProjectionsCleanup ( )
signal

◆ recycleProjectionsInSafety()

void KisSafeNodeProjectionStoreBase::recycleProjectionsInSafety ( )
private

Definition at line 221 of file KisSafeNodeProjectionStore.cpp.

222{
223 QMutexLocker locker(&m_d->lock);
224 m_d->store->recycleProjectionsInSafety();
225}

References m_d.

◆ releaseDevice()

void KisSafeNodeProjectionStoreBase::releaseDevice ( )

Notify the store that current projection device can be safely dropped. The store will try to recycle the device (taking ABA problem into account).

Definition at line 182 of file KisSafeNodeProjectionStore.cpp.

183{
184 QMutexLocker locker(&m_d->lock);
185 if (m_d->store->releaseDevice()) {
186 locker.unlock();
188 }
189}

References internalInitiateProjectionsCleanup(), and m_d.

◆ setImage()

void KisSafeNodeProjectionStoreBase::setImage ( KisImageWSP image)

Definition at line 191 of file KisSafeNodeProjectionStore.cpp.

192{
193 m_d->image = image;
194}

References m_d.

◆ slotInitiateProjectionsCleanup

void KisSafeNodeProjectionStoreBase::slotInitiateProjectionsCleanup ( )
privateslot

After the projection has been used, we should clean it. But we cannot clean it until all the workers accessing it have completed their job.

Therefore we just schedule an exclusive job that will execute the recycling action in an exclusive context, when no jobs are running.

Definition at line 196 of file KisSafeNodeProjectionStore.cpp.

197{
206 KisImageSP image = m_d->image;
207
208 if (image) {
210 } else {
212 }
213}
void addSpontaneousJob(KisSpontaneousJob *spontaneousJob)

References KisImage::addSpontaneousJob(), discardCaches(), KisRecycleProjectionsJob, and m_d.

Friends And Related Symbol Documentation

◆ KisRecycleProjectionsJob

friend class KisRecycleProjectionsJob
friend

Definition at line 50 of file KisSafeNodeProjectionStore.h.

Member Data Documentation

◆ m_d

QScopedPointer<Private> KisSafeNodeProjectionStoreBase::m_d
protected

Definition at line 55 of file KisSafeNodeProjectionStore.h.


The documentation for this class was generated from the following files: