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

oldstable
Jacek Caban 2011-05-26 17:01:42 +02:00 committed by Alexandre Julliard
parent d9f49ba223
commit 826f7c0c75
4 changed files with 23 additions and 13 deletions

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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;