}
-void LoaderQueue::loadNext()
+void LoaderQueue::loadNext()
{
emptyBucket();
lyxerr[Debug::GRAPHICS] << "LoaderQueue: "
<< cache_queue_.size()
- << " items in the queue" << endl;
+ << " items in the queue" << endl;
int counter = s_numimages_;
while (cache_queue_.size() && counter--) {
if(cache_queue_.front()->status() == WaitingToLoad)
s_millisecs_ = millisecs;
lyxerr[Debug::GRAPHICS] << "LoaderQueue: priority set to "
<< s_numimages_ << " images at a time, "
- << s_millisecs_ << " milliseconds between calls"
+ << s_millisecs_ << " milliseconds between calls"
<< endl;
}
-
-LoaderQueue::LoaderQueue() : timer(s_millisecs_, Timeout::ONETIME),
+
+LoaderQueue::LoaderQueue() : timer(s_millisecs_, Timeout::ONETIME),
running_(false)
{
timer.timeout.connect(boost::bind(&LoaderQueue::loadNext, this));
}
-
+
void LoaderQueue::emptyBucket()
{
- lyxerr[Debug::GRAPHICS] << "LoaderQueue: emptying bucket"
+ lyxerr[Debug::GRAPHICS] << "LoaderQueue: emptying bucket"
<< endl;
while (! bucket_.empty()) {
addToQueue(bucket_.front());
void LoaderQueue::addToQueue(Cache::ItemPtr const & item)
{
if (! cache_set_.insert(item).second) {
- list<Cache::ItemPtr>::iterator
+ list<Cache::ItemPtr>::iterator
it = cache_queue_.begin();
- list<Cache::ItemPtr>::iterator
+ list<Cache::ItemPtr>::iterator
end = cache_queue_.end();
-
+
it = std::find(it, end, item);
if (it != end)
cache_queue_.erase(it);
- }
+ }
cache_queue_.push_front(item);
}
*
* \author Alfredo Braunstein
*
- * Full author contact details are available in file CREDITS.
+ * Full author contact details are available in file CREDITS.
*
* This implements a threaded service queue which loads images on background.
* In order to request an image loading you call touch() with the pointer to
- * the cached image. Then it will try to satisfy the request as soon as
+ * the cached image. Then it will try to satisfy the request as soon as
* posible (that's it: after finishing an eventual loading on progress)
* touch() returns inmediately, in order not tu disrupt the flow of the main
* thread.
in_progress_.erase(git);
// Tell the outside world
- std::list<PreviewImagePtr>::const_reverse_iterator
+ std::list<PreviewImagePtr>::const_reverse_iterator
nit = newimages.rbegin();
- std::list<PreviewImagePtr>::const_reverse_iterator
+ std::list<PreviewImagePtr>::const_reverse_iterator
nend = newimages.rend();
for (; nit != nend; ++nit) {
imageReady(*nit->get());