Changeset View
Changeset View
Standalone View
Standalone View
libs/image/kis_update_job_item.h
Context not available. | |||||
28 | #include "kis_spontaneous_job.h" | 28 | #include "kis_spontaneous_job.h" | ||
---|---|---|---|---|---|
29 | #include "kis_base_rects_walker.h" | 29 | #include "kis_base_rects_walker.h" | ||
30 | #include "kis_async_merger.h" | 30 | #include "kis_async_merger.h" | ||
31 | #include "kis_updater_context.h" | ||||
31 | 32 | | |||
32 | 33 | | |||
33 | class KisUpdateJobItem : public QObject, public QRunnable | 34 | class KisUpdateJobItem : public QObject, public QRunnable | ||
Context not available. | |||||
43 | }; | 44 | }; | ||
44 | 45 | | |||
45 | public: | 46 | public: | ||
46 | KisUpdateJobItem(QReadWriteLock *exclusiveJobLock) | 47 | KisUpdateJobItem(KisUpdaterContext *updaterContext) | ||
47 | : m_exclusiveJobLock(exclusiveJobLock), | 48 | : m_updaterContext(updaterContext), | ||
48 | m_atomicType(Type::EMPTY), | 49 | m_atomicType(Type::EMPTY), | ||
49 | m_runnableJob(0) | 50 | m_runnableJob(0) | ||
50 | { | 51 | { | ||
Context not available. | |||||
76 | KIS_SAFE_ASSERT_RECOVER_RETURN(isRunning()); | 77 | KIS_SAFE_ASSERT_RECOVER_RETURN(isRunning()); | ||
77 | 78 | | |||
78 | if(m_exclusive) { | 79 | if(m_exclusive) { | ||
79 | m_exclusiveJobLock->lockForWrite(); | 80 | m_updaterContext->m_exclusiveJobLock.lockForWrite(); | ||
80 | } else { | 81 | } else { | ||
81 | m_exclusiveJobLock->lockForRead(); | 82 | m_updaterContext->m_exclusiveJobLock.lockForRead(); | ||
82 | } | 83 | } | ||
83 | 84 | | |||
84 | if(m_atomicType == Type::MERGE) { | 85 | if(m_atomicType == Type::MERGE) { | ||
Context not available. | |||||
93 | setDone(); | 94 | setDone(); | ||
94 | 95 | | |||
95 | 96 | | |||
96 | emit sigDoSomeUsefulWork(); | 97 | m_updaterContext->doSomeUsefulWork(); | ||
97 | 98 | | |||
98 | // may flip the current state from Waiting -> Running again | 99 | // may flip the current state from Waiting -> Running again | ||
99 | emit sigJobFinished(); | 100 | m_updaterContext->jobFinished(); | ||
100 | 101 | | |||
101 | m_exclusiveJobLock->unlock(); | 102 | m_updaterContext->m_exclusiveJobLock.unlock(); | ||
102 | 103 | | |||
103 | // try to exit the loop. Please note, that no one can flip the state from | 104 | // try to exit the loop. Please note, that no one can flip the state from | ||
104 | // WAITING to EMPTY except ourselves! | 105 | // WAITING to EMPTY except ourselves! | ||
Context not available. | |||||
117 | m_merger.startMerge(*m_walker); | 118 | m_merger.startMerge(*m_walker); | ||
118 | 119 | | |||
119 | QRect changeRect = m_walker->changeRect(); | 120 | QRect changeRect = m_walker->changeRect(); | ||
120 | emit sigContinueUpdate(changeRect); | 121 | m_updaterContext->continueUpdate(changeRect); | ||
121 | } | 122 | } | ||
122 | 123 | | |||
123 | // return true if the thread should actually be started | 124 | // return true if the thread should actually be started | ||
Context not available. | |||||
191 | return m_strokeJobSequentiality; | 192 | return m_strokeJobSequentiality; | ||
192 | } | 193 | } | ||
193 | 194 | | |||
194 | Q_SIGNALS: | | |||
195 | void sigContinueUpdate(const QRect& rc); | | |||
196 | void sigDoSomeUsefulWork(); | | |||
197 | void sigJobFinished(); | | |||
198 | | ||||
199 | private: | 195 | private: | ||
200 | /** | 196 | /** | ||
201 | * Open walker and stroke job for the testing suite. | 197 | * Open walker and stroke job for the testing suite. | ||
Context not available. | |||||
222 | } | 218 | } | ||
223 | 219 | | |||
224 | private: | 220 | private: | ||
225 | /** | 221 | KisUpdaterContext *m_updaterContext; | ||
226 | * \see KisUpdaterContext::m_exclusiveJobLock | | |||
227 | */ | | |||
228 | QReadWriteLock *m_exclusiveJobLock; | | |||
229 | 222 | | |||
230 | bool m_exclusive; | 223 | bool m_exclusive; | ||
231 | 224 | | |||
Context not available. |