Jacek Caban : shdocvw: Store task list in DocHost object instead of using LPARAM.

Alexandre Julliard julliard at winehq.org
Thu May 26 10:56:29 CDT 2011


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu May 26 17:01:42 2011 +0200

shdocvw: Store task list in DocHost object instead of using LPARAM.

---

 dlls/shdocvw/dochost.c   |   27 +++++++++++++++++----------
 dlls/shdocvw/iexplore.c  |    2 +-
 dlls/shdocvw/oleobject.c |    2 +-
 dlls/shdocvw/shdocvw.h   |    5 ++++-
 4 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/dlls/shdocvw/dochost.c b/dlls/shdocvw/dochost.c
index 6d6c1e6..407bbf9 100644
--- a/dlls/shdocvw/dochost.c
+++ b/dlls/shdocvw/dochost.c
@@ -33,26 +33,32 @@ static ATOM doc_view_atom = 0;
 
 void push_dochost_task(DocHost *This, task_header_t *task, task_proc_t proc, task_destr_t destr, BOOL send)
 {
+    BOOL is_empty;
+
     task->proc = proc;
     task->destr = destr;
 
-    /* FIXME: Don't use lParam */
+    is_empty = list_empty(&This->task_queue);
+    list_add_tail(&This->task_queue, &task->entry);
+
     if(send)
-        SendMessageW(This->frame_hwnd, WM_DOCHOSTTASK, 0, (LPARAM)task);
-    else
-        PostMessageW(This->frame_hwnd, WM_DOCHOSTTASK, 0, (LPARAM)task);
+        SendMessageW(This->frame_hwnd, WM_DOCHOSTTASK, 0, 0);
+    else if(is_empty)
+        PostMessageW(This->frame_hwnd, WM_DOCHOSTTASK, 0, 0);
 }
 
-LRESULT process_dochost_task(DocHost *This, LPARAM lparam)
+LRESULT process_dochost_tasks(DocHost *This)
 {
-    task_header_t *task = (task_header_t*)lparam;
+    task_header_t *task;
 
-    task->proc(This, task);
+    while(!list_empty(&This->task_queue)) {
+        task = LIST_ENTRY(This->task_queue.next, task_header_t, entry);
+        list_remove(&task->entry);
 
-    if(task->destr)
+        task->proc(This, task);
         task->destr(task);
-    else
-        heap_free(task);
+    }
+
     return 0;
 }
 
@@ -860,6 +866,7 @@ void DocHost_Init(DocHost *This, IDispatch *disp, const IDocHostContainerVtbl* c
     This->container_vtbl = container;
 
     This->ready_state = READYSTATE_UNINITIALIZED;
+    list_init(&This->task_queue);
 
     DocHost_ClientSite_Init(This);
     DocHost_Frame_Init(This);
diff --git a/dlls/shdocvw/iexplore.c b/dlls/shdocvw/iexplore.c
index f079e62..0ad1e89 100644
--- a/dlls/shdocvw/iexplore.c
+++ b/dlls/shdocvw/iexplore.c
@@ -649,7 +649,7 @@ ie_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
     case WM_NOTIFY:
         return iewnd_OnNotify(This, wparam, lparam);
     case WM_DOCHOSTTASK:
-        return process_dochost_task(&This->doc_host->doc_host, lparam);
+        return process_dochost_tasks(&This->doc_host->doc_host);
     case WM_UPDATEADDRBAR:
         return update_addrbar(This, lparam);
     }
diff --git a/dlls/shdocvw/oleobject.c b/dlls/shdocvw/oleobject.c
index df06028..b116486 100644
--- a/dlls/shdocvw/oleobject.c
+++ b/dlls/shdocvw/oleobject.c
@@ -63,7 +63,7 @@ static LRESULT WINAPI shell_embedding_proc(HWND hwnd, UINT msg, WPARAM wParam, L
     case WM_SIZE:
         return resize_window(This, LOWORD(lParam), HIWORD(lParam));
     case WM_DOCHOSTTASK:
-        return process_dochost_task(&This->doc_host, lParam);
+        return process_dochost_tasks(&This->doc_host);
     }
 
     return DefWindowProcW(hwnd, msg, wParam, lParam);
diff --git a/dlls/shdocvw/shdocvw.h b/dlls/shdocvw/shdocvw.h
index 118dafb..b127ec3 100644
--- a/dlls/shdocvw/shdocvw.h
+++ b/dlls/shdocvw/shdocvw.h
@@ -83,6 +83,7 @@ typedef void (*task_proc_t)(DocHost*, struct _task_header_t*);
 typedef void (*task_destr_t)(struct _task_header_t*);
 
 typedef struct _task_header_t {
+    struct list entry;
     task_proc_t proc;
     task_destr_t destr;
 } task_header_t;
@@ -126,6 +127,8 @@ struct DocHost {
     HWND hwnd;
     HWND frame_hwnd;
 
+    struct list task_queue;
+
     LPOLESTR url;
 
     VARIANT_BOOL silent;
@@ -247,7 +250,7 @@ void handle_navigation_error(DocHost*,HRESULT,BSTR,IHTMLWindow2*) DECLSPEC_HIDDE
 
 #define WM_DOCHOSTTASK (WM_USER+0x300)
 void push_dochost_task(DocHost*,task_header_t*,task_proc_t,task_destr_t,BOOL) DECLSPEC_HIDDEN;
-LRESULT  process_dochost_task(DocHost*,LPARAM) DECLSPEC_HIDDEN;
+LRESULT  process_dochost_tasks(DocHost*) DECLSPEC_HIDDEN;
 
 HRESULT InternetExplorer_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
 void InternetExplorer_WebBrowser_Init(InternetExplorer*) DECLSPEC_HIDDEN;




More information about the wine-cvs mailing list