Jacek Caban : mshtml: Make HTMLInnerWindow the owner of timers.

Alexandre Julliard julliard at winehq.org
Wed Oct 17 14:32:28 CDT 2012


Module: wine
Branch: master
Commit: 4a491ea7e48a3a5f03f765f981fd5db0f0f2848a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4a491ea7e48a3a5f03f765f981fd5db0f0f2848a

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Oct 17 12:19:34 2012 +0200

mshtml: Make HTMLInnerWindow the owner of timers.

---

 dlls/mshtml/htmlwindow.c     |    6 +++---
 dlls/mshtml/mshtml_private.h |    4 ++--
 dlls/mshtml/task.c           |   12 ++++++------
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index f9995d7..209a649 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -567,7 +567,7 @@ static HRESULT WINAPI HTMLWindow2_clearTimeout(IHTMLWindow2 *iface, LONG 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
@@ -1243,7 +1243,7 @@ static HRESULT WINAPI HTMLWindow2_clearInterval(IHTMLWindow2 *iface, LONG timerI
 
     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)
@@ -1563,7 +1563,7 @@ static HRESULT window_set_timer(HTMLInnerWindow *This, VARIANT *expr, LONG msec,
     if(!disp)
         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);
 
     return S_OK;
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 737731f..c54a865 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -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 remove_target_tasks(LONG) DECLSPEC_HIDDEN;
 
-DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*) DECLSPEC_HIDDEN;
-HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD) DECLSPEC_HIDDEN;
+DWORD set_task_timer(HTMLInnerWindow*,DWORD,BOOL,IDispatch*) DECLSPEC_HIDDEN;
+HRESULT clear_task_timer(HTMLInnerWindow*,BOOL,DWORD) DECLSPEC_HIDDEN;
 
 const char *debugstr_variant(const VARIANT*) DECLSPEC_HIDDEN;
 
diff --git a/dlls/mshtml/task.c b/dlls/mshtml/task.c
index a38437c..0fea1ca 100644
--- a/dlls/mshtml/task.c
+++ b/dlls/mshtml/task.c
@@ -38,7 +38,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 #define TIMER_ID 0x3000
 
 typedef struct {
-    HTMLDocument *doc;
+    HTMLInnerWindow *window;
     DWORD id;
     DWORD time;
     DWORD interval;
@@ -107,7 +107,7 @@ void remove_target_tasks(LONG target)
 
     LIST_FOR_EACH_SAFE(liter, ltmp, &thread_data->timer_list) {
         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);
     }
 
@@ -163,7 +163,7 @@ static BOOL queue_timer(thread_data_t *thread_data, task_timer_t *timer)
     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);
     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->id = id_cnt++;
-    timer->doc = doc;
+    timer->window = window;
     timer->time = tc + msec;
     timer->interval = interval ? msec : 0;
     list_init(&timer->entry);
@@ -187,7 +187,7 @@ DWORD set_task_timer(HTMLDocument *doc, DWORD msec, BOOL interval, IDispatch *di
     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);
     task_timer_t *iter;
@@ -196,7 +196,7 @@ HRESULT clear_task_timer(HTMLDocument *doc, BOOL interval, DWORD id)
         return S_OK;
 
     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);
             return S_OK;
         }




More information about the wine-cvs mailing list