mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-13 13:42:30 +00:00
* Replaced TaskScheduler with rak::priority_queue.
* Fixed an exception caused by initial hash check not properly cleaning up HashQueue when canceling. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@606 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -98,7 +98,12 @@ void
|
||||
Manager::do_update() {
|
||||
Canvas::refresh_std();
|
||||
|
||||
displayScheduler.execute(cachedTime);
|
||||
std::list<rak::priority_item*> workQueue;
|
||||
|
||||
std::copy(rak::queue_popper(displayScheduler, rak::priority_ready(cachedTime)), rak::queue_popper(), std::back_inserter(workQueue));
|
||||
std::for_each(workQueue.begin(), workQueue.end(), std::mem_fun(&rak::priority_item::clear_time));
|
||||
std::for_each(workQueue.begin(), workQueue.end(), std::mem_fun(&rak::priority_item::call));
|
||||
|
||||
std::for_each(begin(), end(), rak::if_then(std::mem_fun(&Window::is_active), std::mem_fun(&Window::refresh)));
|
||||
|
||||
Canvas::do_update();
|
||||
|
||||
@@ -50,7 +50,6 @@ Window::Window(Canvas* c, bool d, int h) :
|
||||
m_dynamic(d),
|
||||
m_minHeight(h) {
|
||||
|
||||
m_taskUpdate.set_iterator(displayScheduler.end());
|
||||
m_taskUpdate.set_slot(rak::mem_fn(this, &Window::redraw));
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
|
||||
bool is_active() { return m_active; }
|
||||
bool is_dynamic() { return m_dynamic; }
|
||||
bool is_dirty() { return displayScheduler.is_scheduled(&m_taskUpdate); }
|
||||
bool is_dirty() { return m_taskUpdate.is_queued(); }
|
||||
|
||||
//utils::rak::timer get_next_draw() { return m_nextDraw; }
|
||||
|
||||
@@ -87,13 +87,13 @@ protected:
|
||||
bool m_dynamic;
|
||||
int m_minHeight;
|
||||
|
||||
utils::TaskItem m_taskUpdate;
|
||||
rak::priority_item m_taskUpdate;
|
||||
};
|
||||
|
||||
inline void
|
||||
Window::mark_dirty() {
|
||||
displayScheduler.erase(&m_taskUpdate);
|
||||
displayScheduler.insert(&m_taskUpdate, cachedTime);
|
||||
displayScheduler.push(m_taskUpdate.prepare(cachedTime));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ WindowDownloadList::~WindowDownloadList() {
|
||||
|
||||
void
|
||||
WindowDownloadList::redraw() {
|
||||
displayScheduler.insert(&m_taskUpdate, (cachedTime + 1000000).round_seconds());
|
||||
displayScheduler.push(m_taskUpdate.prepare((cachedTime + 1000000).round_seconds()));
|
||||
|
||||
m_canvas->erase();
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ WindowDownloadStatusbar::WindowDownloadStatusbar(core::Download* d) :
|
||||
|
||||
void
|
||||
WindowDownloadStatusbar::redraw() {
|
||||
displayScheduler.insert(&m_taskUpdate, (cachedTime + 1000000).round_seconds());
|
||||
displayScheduler.push(m_taskUpdate.prepare((cachedTime + 1000000).round_seconds()));
|
||||
|
||||
m_canvas->erase();
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ WindowFileList::WindowFileList(core::Download* d, unsigned int* focus) :
|
||||
|
||||
void
|
||||
WindowFileList::redraw() {
|
||||
displayScheduler.insert(&m_taskUpdate, (cachedTime + 10 * 1000000).round_seconds());
|
||||
displayScheduler.push(m_taskUpdate.prepare((cachedTime + 10 * 1000000).round_seconds()));
|
||||
m_canvas->erase();
|
||||
|
||||
if (m_download->get_download().size_file_entries() == 0 ||
|
||||
|
||||
@@ -58,7 +58,7 @@ WindowHttpQueue::WindowHttpQueue(core::HttpQueue* q) :
|
||||
|
||||
void
|
||||
WindowHttpQueue::redraw() {
|
||||
displayScheduler.insert(&m_taskUpdate, (cachedTime + 1000000).round_seconds());
|
||||
displayScheduler.push(m_taskUpdate.prepare((cachedTime + 1000000).round_seconds()));
|
||||
|
||||
cleanup_list();
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ WindowPeerInfo::WindowPeerInfo(core::Download* d, PList* l, PList::iterator* f)
|
||||
|
||||
void
|
||||
WindowPeerInfo::redraw() {
|
||||
displayScheduler.insert(&m_taskUpdate, (cachedTime + 1000000).round_seconds());
|
||||
displayScheduler.push(m_taskUpdate.prepare((cachedTime + 1000000).round_seconds()));
|
||||
m_canvas->erase();
|
||||
|
||||
int y = 0;
|
||||
|
||||
@@ -56,7 +56,7 @@ WindowPeerList::WindowPeerList(core::Download* d, PList* l, PList::iterator* f)
|
||||
|
||||
void
|
||||
WindowPeerList::redraw() {
|
||||
displayScheduler.insert(&m_taskUpdate, (cachedTime + 1000000).round_seconds());
|
||||
displayScheduler.push(m_taskUpdate.prepare((cachedTime + 1000000).round_seconds()));
|
||||
m_canvas->erase();
|
||||
|
||||
int x = 2;
|
||||
|
||||
@@ -56,7 +56,7 @@ WindowStatusbar::WindowStatusbar(core::Manager* c) :
|
||||
|
||||
void
|
||||
WindowStatusbar::redraw() {
|
||||
displayScheduler.insert(&m_taskUpdate, (cachedTime + 1000000).round_seconds());
|
||||
displayScheduler.push(m_taskUpdate.prepare((cachedTime + 1000000).round_seconds()));
|
||||
|
||||
m_canvas->erase();
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ WindowTitle::WindowTitle(const std::string& s) :
|
||||
|
||||
void
|
||||
WindowTitle::redraw() {
|
||||
displayScheduler.insert(&m_taskUpdate, (cachedTime + 1000000).round_seconds());
|
||||
displayScheduler.push(m_taskUpdate.prepare((cachedTime + 1000000).round_seconds()));
|
||||
m_canvas->erase();
|
||||
|
||||
m_canvas->print(std::max(0, (m_canvas->get_width() - (int)m_title.size()) / 2 - 4), 0,
|
||||
|
||||
@@ -55,7 +55,7 @@ WindowTrackerList::WindowTrackerList(core::Download* d, unsigned int* focus) :
|
||||
void
|
||||
WindowTrackerList::redraw() {
|
||||
// TODO: Make this depend on tracker signal.
|
||||
displayScheduler.insert(&m_taskUpdate, (cachedTime + 10 * 1000000).round_seconds());
|
||||
displayScheduler.push(m_taskUpdate.prepare((cachedTime + 10 * 1000000).round_seconds()));
|
||||
m_canvas->erase();
|
||||
|
||||
int pos = 0;
|
||||
|
||||
Reference in New Issue
Block a user