urlmon: Use BSCF_ values passed to report_data to keep track of download state.
This commit is contained in:
parent
a63419bc2c
commit
978f6b98c9
|
@ -67,12 +67,6 @@ typedef struct {
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
} ProtocolStream;
|
} ProtocolStream;
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
BEFORE_DOWNLOAD,
|
|
||||||
DOWNLOADING,
|
|
||||||
END_DOWNLOAD
|
|
||||||
} download_state_t;
|
|
||||||
|
|
||||||
struct Binding {
|
struct Binding {
|
||||||
const IBindingVtbl *lpBindingVtbl;
|
const IBindingVtbl *lpBindingVtbl;
|
||||||
const IInternetProtocolSinkVtbl *lpInternetProtocolSinkVtbl;
|
const IInternetProtocolSinkVtbl *lpInternetProtocolSinkVtbl;
|
||||||
|
@ -94,7 +88,6 @@ struct Binding {
|
||||||
BOOL report_mime;
|
BOOL report_mime;
|
||||||
DWORD continue_call;
|
DWORD continue_call;
|
||||||
BOOL request_locked;
|
BOOL request_locked;
|
||||||
download_state_t download_state;
|
|
||||||
|
|
||||||
DWORD apartment_thread;
|
DWORD apartment_thread;
|
||||||
HWND notif_hwnd;
|
HWND notif_hwnd;
|
||||||
|
@ -912,12 +905,10 @@ static HRESULT WINAPI InternetProtocolSink_ReportProgress(IInternetProtocolSink
|
||||||
static void report_data(Binding *This, DWORD bscf, ULONG progress, ULONG progress_max)
|
static void report_data(Binding *This, DWORD bscf, ULONG progress, ULONG progress_max)
|
||||||
{
|
{
|
||||||
FORMATETC formatetc = {0, NULL, 1, -1, TYMED_ISTREAM};
|
FORMATETC formatetc = {0, NULL, 1, -1, TYMED_ISTREAM};
|
||||||
|
BOOL end_download = FALSE;
|
||||||
|
|
||||||
TRACE("(%p)->(%d %u %u)\n", This, bscf, progress, progress_max);
|
TRACE("(%p)->(%d %u %u)\n", This, bscf, progress, progress_max);
|
||||||
|
|
||||||
if(This->download_state == END_DOWNLOAD)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(GetCurrentThreadId() != This->apartment_thread)
|
if(GetCurrentThreadId() != This->apartment_thread)
|
||||||
FIXME("called from worked hread\n");
|
FIXME("called from worked hread\n");
|
||||||
|
|
||||||
|
@ -935,15 +926,17 @@ static void report_data(Binding *This, DWORD bscf, ULONG progress, ULONG progres
|
||||||
BINDSTATUS_MIMETYPEAVAILABLE, mime);
|
BINDSTATUS_MIMETYPEAVAILABLE, mime);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(This->download_state == BEFORE_DOWNLOAD) {
|
if(bscf & BSCF_FIRSTDATANOTIFICATION) {
|
||||||
fill_stream_buffer(This->stream);
|
fill_stream_buffer(This->stream);
|
||||||
|
|
||||||
This->download_state = DOWNLOADING;
|
|
||||||
IBindStatusCallback_OnProgress(This->callback, progress, progress_max,
|
IBindStatusCallback_OnProgress(This->callback, progress, progress_max,
|
||||||
BINDSTATUS_BEGINDOWNLOADDATA, This->url);
|
BINDSTATUS_BEGINDOWNLOADDATA, This->url);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(This->stream->hres == S_FALSE || (bscf & BSCF_LASTDATANOTIFICATION)) {
|
if((bscf & BSCF_LASTDATANOTIFICATION) ||
|
||||||
|
(bscf & BSCF_DATAFULLYAVAILABLE) ||
|
||||||
|
progress == progress_max) {
|
||||||
|
end_download = TRUE;
|
||||||
IBindStatusCallback_OnProgress(This->callback, progress, progress_max,
|
IBindStatusCallback_OnProgress(This->callback, progress, progress_max,
|
||||||
BINDSTATUS_ENDDOWNLOADDATA, This->url);
|
BINDSTATUS_ENDDOWNLOADDATA, This->url);
|
||||||
}
|
}
|
||||||
|
@ -958,8 +951,7 @@ static void report_data(Binding *This, DWORD bscf, ULONG progress, ULONG progres
|
||||||
IBindStatusCallback_OnDataAvailable(This->callback, bscf, This->stream->buf_size,
|
IBindStatusCallback_OnDataAvailable(This->callback, bscf, This->stream->buf_size,
|
||||||
&formatetc, &This->stgmed);
|
&formatetc, &This->stgmed);
|
||||||
|
|
||||||
if(This->stream->hres == S_FALSE) {
|
if(end_download) {
|
||||||
This->download_state = END_DOWNLOAD;
|
|
||||||
IBindStatusCallback_OnStopBinding(This->callback, S_OK, NULL);
|
IBindStatusCallback_OnStopBinding(This->callback, S_OK, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1312,7 +1304,6 @@ static HRESULT Binding_Create(LPCWSTR url, IBindCtx *pbc, REFIID riid, Binding *
|
||||||
ret->report_mime = TRUE;
|
ret->report_mime = TRUE;
|
||||||
ret->continue_call = 0;
|
ret->continue_call = 0;
|
||||||
ret->request_locked = FALSE;
|
ret->request_locked = FALSE;
|
||||||
ret->download_state = BEFORE_DOWNLOAD;
|
|
||||||
ret->task_queue_head = ret->task_queue_tail = NULL;
|
ret->task_queue_head = ret->task_queue_tail = NULL;
|
||||||
|
|
||||||
memset(&ret->bindinfo, 0, sizeof(BINDINFO));
|
memset(&ret->bindinfo, 0, sizeof(BINDINFO));
|
||||||
|
|
Loading…
Reference in New Issue