mshtml: Make HTMLInnerWindow the owner of timers.

This commit is contained in:
Jacek Caban 2012-10-17 12:19:34 +02:00 committed by Alexandre Julliard
parent d1c1f9e830
commit 4a491ea7e4
3 changed files with 11 additions and 11 deletions

View File

@ -567,7 +567,7 @@ static HRESULT WINAPI HTMLWindow2_clearTimeout(IHTMLWindow2 *iface, LONG timerID
TRACE("(%p)->(%d)\n", This, timerID); TRACE("(%p)->(%d)\n", This, timerID);
return clear_task_timer(&This->inner_window->doc->basedoc, FALSE, timerID); return clear_task_timer(This->inner_window, FALSE, timerID);
} }
#define MAX_MESSAGE_LEN 2000 #define MAX_MESSAGE_LEN 2000
@ -1243,7 +1243,7 @@ static HRESULT WINAPI HTMLWindow2_clearInterval(IHTMLWindow2 *iface, LONG timerI
TRACE("(%p)->(%d)\n", This, timerID); TRACE("(%p)->(%d)\n", This, timerID);
return clear_task_timer(&This->inner_window->doc->basedoc, TRUE, timerID); return clear_task_timer(This->inner_window, TRUE, timerID);
} }
static HRESULT WINAPI HTMLWindow2_put_offscreenBuffering(IHTMLWindow2 *iface, VARIANT v) static HRESULT WINAPI HTMLWindow2_put_offscreenBuffering(IHTMLWindow2 *iface, VARIANT v)
@ -1563,7 +1563,7 @@ static HRESULT window_set_timer(HTMLInnerWindow *This, VARIANT *expr, LONG msec,
if(!disp) if(!disp)
return E_FAIL; return E_FAIL;
*timer_id = set_task_timer(&This->doc->basedoc, msec, interval, disp); *timer_id = set_task_timer(This, msec, interval, disp);
IDispatch_Release(disp); IDispatch_Release(disp);
return S_OK; return S_OK;

View File

@ -980,8 +980,8 @@ LONG get_task_target_magic(void) DECLSPEC_HIDDEN;
void push_task(task_t*,task_proc_t,task_proc_t,LONG) DECLSPEC_HIDDEN; void push_task(task_t*,task_proc_t,task_proc_t,LONG) DECLSPEC_HIDDEN;
void remove_target_tasks(LONG) DECLSPEC_HIDDEN; void remove_target_tasks(LONG) DECLSPEC_HIDDEN;
DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*) DECLSPEC_HIDDEN; DWORD set_task_timer(HTMLInnerWindow*,DWORD,BOOL,IDispatch*) DECLSPEC_HIDDEN;
HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD) DECLSPEC_HIDDEN; HRESULT clear_task_timer(HTMLInnerWindow*,BOOL,DWORD) DECLSPEC_HIDDEN;
const char *debugstr_variant(const VARIANT*) DECLSPEC_HIDDEN; const char *debugstr_variant(const VARIANT*) DECLSPEC_HIDDEN;

View File

@ -38,7 +38,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
#define TIMER_ID 0x3000 #define TIMER_ID 0x3000
typedef struct { typedef struct {
HTMLDocument *doc; HTMLInnerWindow *window;
DWORD id; DWORD id;
DWORD time; DWORD time;
DWORD interval; DWORD interval;
@ -107,7 +107,7 @@ void remove_target_tasks(LONG target)
LIST_FOR_EACH_SAFE(liter, ltmp, &thread_data->timer_list) { LIST_FOR_EACH_SAFE(liter, ltmp, &thread_data->timer_list) {
timer = LIST_ENTRY(liter, task_timer_t, entry); timer = LIST_ENTRY(liter, task_timer_t, entry);
if(timer->doc->task_magic == target) if(timer->window->task_magic == target)
release_task_timer(thread_data->thread_hwnd, timer); release_task_timer(thread_data->thread_hwnd, timer);
} }
@ -163,7 +163,7 @@ static BOOL queue_timer(thread_data_t *thread_data, task_timer_t *timer)
return FALSE; return FALSE;
} }
DWORD set_task_timer(HTMLDocument *doc, DWORD msec, BOOL interval, IDispatch *disp) DWORD set_task_timer(HTMLInnerWindow *window, DWORD msec, BOOL interval, IDispatch *disp)
{ {
thread_data_t *thread_data = get_thread_data(TRUE); thread_data_t *thread_data = get_thread_data(TRUE);
task_timer_t *timer; task_timer_t *timer;
@ -173,7 +173,7 @@ DWORD set_task_timer(HTMLDocument *doc, DWORD msec, BOOL interval, IDispatch *di
timer = heap_alloc(sizeof(task_timer_t)); timer = heap_alloc(sizeof(task_timer_t));
timer->id = id_cnt++; timer->id = id_cnt++;
timer->doc = doc; timer->window = window;
timer->time = tc + msec; timer->time = tc + msec;
timer->interval = interval ? msec : 0; timer->interval = interval ? msec : 0;
list_init(&timer->entry); list_init(&timer->entry);
@ -187,7 +187,7 @@ DWORD set_task_timer(HTMLDocument *doc, DWORD msec, BOOL interval, IDispatch *di
return timer->id; return timer->id;
} }
HRESULT clear_task_timer(HTMLDocument *doc, BOOL interval, DWORD id) HRESULT clear_task_timer(HTMLInnerWindow *window, BOOL interval, DWORD id)
{ {
thread_data_t *thread_data = get_thread_data(FALSE); thread_data_t *thread_data = get_thread_data(FALSE);
task_timer_t *iter; task_timer_t *iter;
@ -196,7 +196,7 @@ HRESULT clear_task_timer(HTMLDocument *doc, BOOL interval, DWORD id)
return S_OK; return S_OK;
LIST_FOR_EACH_ENTRY(iter, &thread_data->timer_list, task_timer_t, entry) { LIST_FOR_EACH_ENTRY(iter, &thread_data->timer_list, task_timer_t, entry) {
if(iter->id == id && iter->doc == doc && (iter->interval == 0) == !interval) { if(iter->id == id && iter->window == window && !iter->interval == !interval) {
release_task_timer(thread_data->thread_hwnd, iter); release_task_timer(thread_data->thread_hwnd, iter);
return S_OK; return S_OK;
} }