mshtml: Moved asynchronous document binding to separated function.

This commit is contained in:
Jacek Caban 2010-03-03 14:53:32 +01:00 committed by Alexandre Julliard
parent 6938378be3
commit 0bccfa873d
3 changed files with 33 additions and 19 deletions

View File

@ -740,6 +740,7 @@ void add_nsevent_listener(HTMLDocumentNode*,LPCWSTR);
void set_window_bscallback(HTMLWindow*,nsChannelBSC*);
void set_current_mon(HTMLWindow*,IMoniker*);
HRESULT start_binding(HTMLWindow*,HTMLDocumentNode*,BSCallback*,IBindCtx*);
HRESULT async_start_doc_binding(HTMLWindow*,nsChannelBSC*);
void abort_document_bindings(HTMLDocumentNode*);
HRESULT bind_mon_to_buffer(HTMLDocumentNode*,IMoniker*,void**,DWORD*);

View File

@ -1148,6 +1148,36 @@ void set_window_bscallback(HTMLWindow *window, nsChannelBSC *callback)
}
}
typedef struct {
task_t header;
HTMLWindow *window;
nsChannelBSC *bscallback;
} start_doc_binding_task_t;
static void start_doc_binding_proc(task_t *_task)
{
start_doc_binding_task_t *task = (start_doc_binding_task_t*)_task;
start_binding(task->window, NULL, (BSCallback*)task->bscallback, NULL);
IBindStatusCallback_Release(STATUSCLB(&task->bscallback->bsc));
}
HRESULT async_start_doc_binding(HTMLWindow *window, nsChannelBSC *bscallback)
{
start_doc_binding_task_t *task;
task = heap_alloc(sizeof(start_doc_binding_task_t));
if(!task)
return E_OUTOFMEMORY;
task->window = window;
task->bscallback = bscallback;
IBindStatusCallback_AddRef(STATUSCLB(&bscallback->bsc));
push_task(&task->header, start_doc_binding_proc, window->task_magic);
return S_OK;
}
void abort_document_bindings(HTMLDocumentNode *doc)
{
BSCallback *iter;

View File

@ -808,19 +808,7 @@ static void start_binding_proc(task_t *_task)
start_binding_task_t *task = (start_binding_task_t*)_task;
start_binding(NULL, task->doc, (BSCallback*)task->bscallback, NULL);
}
typedef struct {
task_t header;
HTMLWindow *window;
nsChannelBSC *bscallback;
} start_doc_binding_task_t;
static void start_doc_binding_proc(task_t *_task)
{
start_doc_binding_task_t *task = (start_doc_binding_task_t*)_task;
start_binding(task->window, NULL, (BSCallback*)task->bscallback, NULL);
IUnknown_Release((IUnknown*)task->bscallback);
}
@ -844,14 +832,9 @@ static nsresult async_open(nsChannel *This, HTMLWindow *window, BOOL is_doc_chan
channelbsc_set_channel(bscallback, This, listener, context);
if(is_doc_channel) {
start_doc_binding_task_t *task;
set_window_bscallback(window, bscallback);
task = heap_alloc(sizeof(start_doc_binding_task_t));
task->window = window;
task->bscallback = bscallback;
push_task(&task->header, start_doc_binding_proc, window->task_magic);
async_start_doc_binding(window, bscallback);
IUnknown_Release((IUnknown*)bscallback);
}else {
start_binding_task_t *task = heap_alloc(sizeof(start_binding_task_t));