MCPcopy Create free account
hub / github.com/TeXworks/texworks / addPageProcessingRequest

Method addPageProcessingRequest

modules/QtPDF/src/PDFPageProcessingThread.cpp:51–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51void PDFPageProcessingThread::addPageProcessingRequest(PageProcessingRequest * request)
52{
53
54 if (!request)
55 return;
56
57 // `request` must live in the main (GUI) thread, or else destroying it later
58 // on will fail
59 Q_ASSERT(request->thread() == QCoreApplication::instance()->thread());
60
61 QMutexLocker locker(&(this->_mutex));
62 // Note: Commenting the "remove identical requests in the stack" code for now.
63 // This should be handled by the caching routine elsewhere automatically. If
64 // in doubt, it's better to render a tile twice than to not render it at all
65 // (thereby leaving the dummy image in the cache indefinitely)
66/*
67 // remove any instances of the given request type before adding the new one to
68 // avoid processing it several times
69 // **TODO:** Could it be that we require several concurrent versions of the
70 // same page?
71 int i;
72 for (i = _workStack.size() - 1; i >= 0; --i) {
73 if (*(_workStack[i]) == *request) {
74 // Using deleteLater() doesn't work because we have no event queue in this
75 // thread. However, since the object is still on the stack, it is still
76 // sleeping and directly deleting it should therefore be safe.
77 delete _workStack[i];
78 _workStack.remove(i);
79 }
80 }
81*/
82
83 _workStack.push(request);
84#ifdef DEBUG
85 qDebug() << "new request:" << *request;
86#endif
87
88 locker.unlock();
89 if (!isRunning())
90 start();
91 else
92 _waitCondition.wakeOne();
93}
94
95void PDFPageProcessingThread::run()
96{

Callers 2

asyncRenderToImageMethod · 0.80
asyncLoadLinksMethod · 0.80

Calls 1

unlockMethod · 0.45

Tested by

no test coverage detected