Commit 94fcaad7 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Use standard list to store task queue.

parent 0c2b684c
......@@ -1018,7 +1018,7 @@ struct task_t {
LONG target_magic;
task_proc_t proc;
task_proc_t destr;
struct task_t *next;
struct list entry;
};
typedef struct {
......@@ -1028,8 +1028,7 @@ typedef struct {
typedef struct {
HWND thread_hwnd;
task_t *task_queue_head;
task_t *task_queue_tail;
struct list task_list;
struct list timer_list;
} thread_data_t;
......
......@@ -69,14 +69,8 @@ HRESULT push_task(task_t *task, task_proc_t proc, task_proc_t destr, LONG magic)
task->target_magic = magic;
task->proc = proc;
task->destr = destr ? destr : default_task_destr;
task->next = NULL;
if(thread_data->task_queue_tail)
thread_data->task_queue_tail->next = task;
else
thread_data->task_queue_head = task;
thread_data->task_queue_tail = task;
list_add_tail(&thread_data->task_list, &task->entry);
PostMessageW(thread_data->thread_hwnd, WM_PROCESSTASK, 0, 0);
return S_OK;
......@@ -91,14 +85,11 @@ static task_t *pop_task(void)
if(!thread_data)
return NULL;
task = thread_data->task_queue_head;
if(!task)
if(list_empty(&thread_data->task_list))
return NULL;
thread_data->task_queue_head = task->next;
if(!thread_data->task_queue_head)
thread_data->task_queue_tail = NULL;
task = LIST_ENTRY(thread_data->task_list.next, task_t, entry);
list_remove(&task->entry);
return task;
}
......@@ -116,7 +107,7 @@ void remove_target_tasks(LONG target)
thread_data_t *thread_data = get_thread_data(FALSE);
struct list *liter, *ltmp;
task_timer_t *timer;
task_t *iter, *tmp;
task_t *task;
if(!thread_data)
return;
......@@ -134,20 +125,12 @@ void remove_target_tasks(LONG target)
SetTimer(thread_data->thread_hwnd, TIMER_ID, max( (int)(timer->time - tc), 0 ), NULL);
}
while(thread_data->task_queue_head && thread_data->task_queue_head->target_magic == target) {
iter = pop_task();
iter->destr(iter);
}
for(iter = thread_data->task_queue_head; iter; iter = iter->next) {
while(iter->next && iter->next->target_magic == target) {
tmp = iter->next;
iter->next = tmp->next;
tmp->destr(tmp);
LIST_FOR_EACH_SAFE(liter, ltmp, &thread_data->task_list) {
task = LIST_ENTRY(liter, task_t, entry);
if(task->target_magic == target) {
list_remove(&task->entry);
task->destr(task);
}
if(!iter->next)
thread_data->task_queue_tail = iter;
}
}
......@@ -390,6 +373,7 @@ thread_data_t *get_thread_data(BOOL create)
return NULL;
TlsSetValue(mshtml_tls, thread_data);
list_init(&thread_data->task_list);
list_init(&thread_data->timer_list);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment