|
Krita Source Code Documentation
|
#include <kis_update_scheduler.h>
Inheritance diagram for KisUpdateScheduler:Public Attributes | |
| qreal | defaultBalancingRatio = 1.0 |
| bool | processingBlocked = false |
| KisQueuesProgressUpdater * | progressUpdater = 0 |
| KisProjectionUpdateListener * | projectionUpdateListener |
| KisUpdateScheduler * | q |
| KisStrokesQueue | strokesQueue |
| KisUpdaterContext | updaterContext |
| KisLazyWaitCondition | updatesFinishedCondition |
| QAtomicInt | updatesLockCounter |
| KisSimpleUpdateQueue | updatesQueue |
| QReadWriteLock | updatesStartLock |
Public Attributes inherited from Private | |
| KisCanvas2 * | canvas |
| int | displayedFrame |
| int | intendedFrame |
Protected Slots | |
| void | updateSettings () |
Protected Member Functions | |
| void | connectSignals () |
| KisUpdateScheduler () | |
| void | processQueues () |
Protected Attributes | |
| Private *const | m_d |
Private Member Functions | |
| bool | haveUpdatesRunning () |
| void | progressUpdate () |
| void | tryProcessUpdatesQueue () |
| void | wakeUpWaitingThreads () |
Friends | |
| class | UpdatesBlockTester |
Definition at line 38 of file kis_update_scheduler.cpp.
| KisUpdateScheduler::KisUpdateScheduler | ( | KisProjectionUpdateListener * | projectionUpdateListener, |
| QObject * | parent = 0 ) |
Definition at line 65 of file kis_update_scheduler.cpp.
References connectSignals(), and updateSettings().
|
override |
Definition at line 78 of file kis_update_scheduler.cpp.
References m_d.
|
protected |
Definition at line 73 of file kis_update_scheduler.cpp.
|
overridevirtual |
Implements KisStrokesFacade.
Definition at line 181 of file kis_update_scheduler.cpp.
References m_d, and processQueues().
| void KisUpdateScheduler::addSpontaneousJob | ( | KisSpontaneousJob * | spontaneousJob | ) |
Definition at line 163 of file kis_update_scheduler.cpp.
References m_d, and processQueues().
|
inline |
Definition at line 59 of file kis_update_scheduler.cpp.
References KisStrokesQueue::balancingRatioOverride.
| void KisUpdateScheduler::barrierLock | ( | ) |
Waits until the queues become empty, then blocks the processing. To unblock processing you should use unlock().
If some other thread adds jobs in parallel, then you may wait forever. If you don't want it, consider lock() instead.
Definition at line 346 of file kis_update_scheduler.cpp.
References m_d, and processQueues().
| void KisUpdateScheduler::blockUpdates | ( | ) |
Blocks all the updates from execution. It doesn't affect strokes execution in any way. This type of lock is supposed to be held by the strokes themselves when they need a short access to some parts of the projection of the image.
From all the other places you should use usual lock()/unlock() methods
Definition at line 388 of file kis_update_scheduler.cpp.
References haveUpdatesRunning(), and m_d.
|
overridevirtual |
Implements KisStrokesFacade.
Definition at line 193 of file kis_update_scheduler.cpp.
References m_d, and processQueues().
|
protected |
Definition at line 106 of file kis_update_scheduler.cpp.
References connect(), KisImageConfigNotifier::instance(), and updateSettings().
| void KisUpdateScheduler::continueUpdate | ( | const QRect & | rect | ) |
Definition at line 431 of file kis_update_scheduler.cpp.
References m_d.
| int KisUpdateScheduler::currentLevelOfDetail | ( | ) | const |
Definition at line 240 of file kis_update_scheduler.cpp.
References m_d.
| void KisUpdateScheduler::doSomeUsefulWork | ( | ) |
Definition at line 437 of file kis_update_scheduler.cpp.
References m_d.
|
overridevirtual |
Implements KisStrokesFacade.
Definition at line 187 of file kis_update_scheduler.cpp.
References m_d, and processQueues().
| void KisUpdateScheduler::explicitRegenerateLevelOfDetail | ( | ) |
Explicitly start regeneration of LoD planes of all the devices in the image. This call should be performed when the user is idle, just to make the quality of image updates better.
Definition at line 232 of file kis_update_scheduler.cpp.
References m_d, and processQueues().
| void KisUpdateScheduler::fullRefreshAsync | ( | KisNodeSP | root, |
| const QRect & | rc, | ||
| const QRect & | cropRect ) |
Definition at line 158 of file kis_update_scheduler.cpp.
References fullRefreshAsync(), and None.
| void KisUpdateScheduler::fullRefreshAsync | ( | KisNodeSP | root, |
| const QVector< QRect > & | rects, | ||
| const QRect & | cropRect, | ||
| KisProjectionUpdateFlags | flags ) |
Definition at line 147 of file kis_update_scheduler.cpp.
References currentLevelOfDetail(), m_d, and processQueues().
| bool KisUpdateScheduler::hasUpdatesRunning | ( | ) | const |
Definition at line 169 of file kis_update_scheduler.cpp.
References m_d.
|
private |
Definition at line 421 of file kis_update_scheduler.cpp.
References m_d.
| void KisUpdateScheduler::immediateLockForReadOnly | ( | ) |
Blocks processing of the queues. The function will wait until all the executing jobs are finished. NOTE: you may add new jobs while the block held, but they will be delayed until unlock() is called.
Definition at line 289 of file kis_update_scheduler.cpp.
References m_d.
| bool KisUpdateScheduler::isIdle | ( | ) |
Tells if there are no strokes or updates are running at the moment. Internally calls to tryBarrierLock(), so it is not O(1).
Definition at line 309 of file kis_update_scheduler.cpp.
References tryBarrierLock(), and unlock().
| KisPostExecutionUndoAdapter * KisUpdateScheduler::lodNPostExecutionUndoAdapter | ( | ) | const |
Definition at line 276 of file kis_update_scheduler.cpp.
References m_d.
| KisLodPreferences KisUpdateScheduler::lodPreferences | ( | ) | const |
Return current lod preferences loaded in the strokes queue
Definition at line 227 of file kis_update_scheduler.cpp.
References m_d.
|
inline |
Definition at line 39 of file kis_update_scheduler.cpp.
|
protected |
Definition at line 356 of file kis_update_scheduler.cpp.
References DEBUG_BALANCING_METRICS, m_d, progressUpdate(), tryProcessUpdatesQueue(), and wakeUpWaitingThreads().
|
private |
Definition at line 119 of file kis_update_scheduler.cpp.
References m_d.
| void KisUpdateScheduler::setLod0ToNStrokeStrategyFactory | ( | const KisLodSyncStrokeStrategyFactory & | factory | ) |
Install a factory of a stroke strategy, that will be started every time when the scheduler needs to synchronize LOD caches of all the paint devices of the image.
Definition at line 256 of file kis_update_scheduler.cpp.
References m_d.
| void KisUpdateScheduler::setLodPreferences | ( | const KisLodPreferences & | value | ) |
Sets the desired level of detail preferences on which the strokes should work. Please note that this configuration will be applied starting from the next stroke. Please also note that this value is not guaranteed to coincide with the one returned by currentLevelOfDetail()
The queue might have started an internal stroke for cache synchronization. Process the queues to execute it if needed.
Definition at line 215 of file kis_update_scheduler.cpp.
References m_d, processQueues(), and value().
| void KisUpdateScheduler::setPostSyncLod0GUIPlaneRequestForResumeCallback | ( | const std::function< void()> & | callback | ) |
Sets a callback that is called bu the scheduler when it thinks that Lod0 tiles in the GUI should be refetched by the GUI. Such situation happens in cases when a Lod0 stroke has been cancelled, after its LodN buddy has managed to do some manipulations on the canvas. Without this call the GUI will still contain LodN tiles active.
Definition at line 271 of file kis_update_scheduler.cpp.
References m_d.
| void KisUpdateScheduler::setProgressProxy | ( | KoProgressProxy * | progressProxy | ) |
Sets the proxy that is going to be notified about the progress of processing of the queues. If you want to switch the proxy on runtime, you should do it under the lock held.
Definition at line 112 of file kis_update_scheduler.cpp.
References m_d.
Sets a callback that is called by the scheduler in the beginning of every stroke that declared the necessity of the redo state clearance.
Definition at line 266 of file kis_update_scheduler.cpp.
References m_d.
| void KisUpdateScheduler::setSuspendResumeUpdatesStrokeStrategyFactory | ( | const KisSuspendResumeStrategyPairFactory & | factory | ) |
Install a factory of a stroke strategies, that will be started every time when the scheduler needs to postpone/resume all the updates of the LOD0 strokes.
Definition at line 261 of file kis_update_scheduler.cpp.
References m_d.
| void KisUpdateScheduler::setThreadsLimit | ( | int | value | ) |
Set the number of threads used by the scheduler
Thread limit can be changed without the full-featured barrier lock, we can avoid waiting for all the jobs to complete. We should just ensure there is no more jobs in the updater context.
Definition at line 84 of file kis_update_scheduler.cpp.
References immediateLockForReadOnly(), KIS_SAFE_ASSERT_RECOVER_RETURN, m_d, unlock(), and value().
| void KisUpdateScheduler::spareThreadAppeared | ( | ) |
Definition at line 442 of file kis_update_scheduler.cpp.
References processQueues().
|
overridevirtual |
Implements KisStrokesFacade.
Definition at line 174 of file kis_update_scheduler.cpp.
References m_d, and processQueues().
| int KisUpdateScheduler::threadsLimit | ( | ) | const |
Return the number of threads available to the scheduler
Definition at line 100 of file kis_update_scheduler.cpp.
References m_d.
| bool KisUpdateScheduler::tryBarrierLock | ( | ) |
Works like barrier lock, but returns false immediately if barrierLock can't be acquired.
Definition at line 329 of file kis_update_scheduler.cpp.
References m_d, and processQueues().
| bool KisUpdateScheduler::tryCancelCurrentStrokeAsync | ( | ) |
tryCancelCurrentStrokeAsync() checks whether there is a running stroke (which is being executed at this very moment) which is not still open by the owner (endStroke() or cancelStroke() have already been called) and cancels it.
Definition at line 200 of file kis_update_scheduler.cpp.
References m_d.
|
private |
| UndoResult KisUpdateScheduler::tryUndoLastStrokeAsync | ( | ) |
Definition at line 205 of file kis_update_scheduler.cpp.
References m_d.
| void KisUpdateScheduler::unblockUpdates | ( | ) |
Unblocks updates from execution previously locked by blockUpdates()
Definition at line 400 of file kis_update_scheduler.cpp.
References m_d, and processQueues().
| void KisUpdateScheduler::unlock | ( | bool | resetLodLevels = true | ) |
Unblocks the process and calls processQueues()
Legacy strokes may have changed the image while we didn't control it. Notify the queue to take it into account.
Definition at line 295 of file kis_update_scheduler.cpp.
References m_d, and processQueues().
| void KisUpdateScheduler::updateProjection | ( | KisNodeSP | node, |
| const QRect & | rc, | ||
| const QRect & | cropRect ) |
Definition at line 153 of file kis_update_scheduler.cpp.
References None, and updateProjection().
| void KisUpdateScheduler::updateProjection | ( | KisNodeSP | node, |
| const QVector< QRect > & | rects, | ||
| const QRect & | cropRect, | ||
| KisProjectionUpdateFlags | flags ) |
Definition at line 141 of file kis_update_scheduler.cpp.
References currentLevelOfDetail(), m_d, and processQueues().
|
protectedslot |
Called when it is necessary to reread configuration
Definition at line 281 of file kis_update_scheduler.cpp.
References m_d, KisImageConfig::maxNumberOfThreads(), KisImageConfig::schedulerBalancingRatio(), and setThreadsLimit().
| void KisUpdateScheduler::waitForDone | ( | ) |
Waits until all the running jobs are finished.
If some other thread adds jobs in parallel, then you may wait forever. If you don't want it, consider lock() instead.
Definition at line 321 of file kis_update_scheduler.cpp.
References m_d, and processQueues().
|
private |
Definition at line 406 of file kis_update_scheduler.cpp.
References haveUpdatesRunning(), and m_d.
| bool KisUpdateScheduler::wrapAroundModeSupported | ( | ) | const |
Definition at line 210 of file kis_update_scheduler.cpp.
References m_d.
|
friend |
Definition at line 236 of file kis_update_scheduler.h.
| qreal KisUpdateScheduler::defaultBalancingRatio = 1.0 |
Definition at line 51 of file kis_update_scheduler.cpp.
|
protected |
Definition at line 245 of file kis_update_scheduler.h.
| bool KisUpdateScheduler::processingBlocked = false |
Definition at line 50 of file kis_update_scheduler.cpp.
| KisQueuesProgressUpdater* KisUpdateScheduler::progressUpdater = 0 |
Definition at line 53 of file kis_update_scheduler.cpp.
| KisProjectionUpdateListener* KisUpdateScheduler::projectionUpdateListener |
Definition at line 52 of file kis_update_scheduler.cpp.
| KisUpdateScheduler* KisUpdateScheduler::q |
Definition at line 45 of file kis_update_scheduler.cpp.
| KisStrokesQueue KisUpdateScheduler::strokesQueue |
Definition at line 48 of file kis_update_scheduler.cpp.
| KisUpdaterContext KisUpdateScheduler::updaterContext |
Definition at line 49 of file kis_update_scheduler.cpp.
| KisLazyWaitCondition KisUpdateScheduler::updatesFinishedCondition |
Definition at line 57 of file kis_update_scheduler.cpp.
| QAtomicInt KisUpdateScheduler::updatesLockCounter |
Definition at line 55 of file kis_update_scheduler.cpp.
| KisSimpleUpdateQueue KisUpdateScheduler::updatesQueue |
Definition at line 47 of file kis_update_scheduler.cpp.
| QReadWriteLock KisUpdateScheduler::updatesStartLock |
Definition at line 56 of file kis_update_scheduler.cpp.