Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
079e3822
Commit
079e3822
authored
Feb 07, 2007
by
Jacek Caban
Committed by
Alexandre Julliard
Feb 07, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
urlmon: Use proc instead of enum in task queue.
parent
e8d2b543
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
101 deletions
+88
-101
binding.c
dlls/urlmon/binding.c
+88
-101
No files found.
dlls/urlmon/binding.c
View file @
079e3822
...
@@ -36,11 +36,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
...
@@ -36,11 +36,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
typedef
struct
Binding
Binding
;
typedef
struct
Binding
Binding
;
enum
task_enum
{
struct
_task_t
;
TASK_ON_PROGRESS
,
TASK_SWITCH
,
typedef
void
(
*
task_proc_t
)(
Binding
*
,
struct
_task_t
*
);
TASK_DATA_AVAILABLE
};
typedef
struct
{
typedef
struct
{
Binding
*
binding
;
Binding
*
binding
;
...
@@ -51,7 +49,7 @@ typedef struct {
...
@@ -51,7 +49,7 @@ typedef struct {
}
on_progress_data
;
}
on_progress_data
;
typedef
struct
_task_t
{
typedef
struct
_task_t
{
enum
task_enum
task
;
task_proc_t
proc
;
struct
_task_t
*
next
;
struct
_task_t
*
next
;
union
{
union
{
on_progress_data
on_progress
;
on_progress_data
on_progress
;
...
@@ -159,69 +157,14 @@ static void fill_stream_buffer(ProtocolStream *This)
...
@@ -159,69 +157,14 @@ static void fill_stream_buffer(ProtocolStream *This)
}
}
}
}
static
void
on_data_available
(
Binding
*
binding
,
DWORD
bscf
)
{
FORMATETC
formatetc
=
{
0
,
NULL
,
1
,
-
1
,
TYMED_ISTREAM
};
if
(
GetCurrentThreadId
()
!=
binding
->
apartment_thread
)
FIXME
(
"called from worked hread
\n
"
);
if
(
binding
->
continue_call
)
{
task_t
*
task
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
task_t
));
task
->
task
=
TASK_DATA_AVAILABLE
;
task
->
data
.
bscf
=
bscf
;
push_task
(
binding
,
task
);
return
;
}
fill_stream_buffer
(
binding
->
stream
);
IBindStatusCallback_OnDataAvailable
(
binding
->
callback
,
bscf
,
binding
->
stream
->
buf_size
,
&
formatetc
,
&
binding
->
stgmed
);
}
static
void
do_task
(
Binding
*
binding
,
task_t
*
task
)
{
switch
(
task
->
task
)
{
case
TASK_ON_PROGRESS
:
{
on_progress_data
*
data
=
&
task
->
data
.
on_progress
;
IBindStatusCallback_OnProgress
(
binding
->
callback
,
data
->
progress
,
data
->
progress_max
,
data
->
status_code
,
data
->
status_text
);
HeapFree
(
GetProcessHeap
(),
0
,
data
->
status_text
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
break
;
}
case
TASK_SWITCH
:
binding
->
continue_call
++
;
IInternetProtocol_Continue
(
binding
->
protocol
,
task
->
data
.
protocol_data
);
binding
->
continue_call
--
;
break
;
case
TASK_DATA_AVAILABLE
:
on_data_available
(
binding
,
task
->
data
.
bscf
);
}
}
static
void
do_tasks
(
Binding
*
This
)
{
task_t
*
task
;
while
((
task
=
pop_task
(
This
)))
do_task
(
This
,
task
);
}
static
LRESULT
WINAPI
notif_wnd_proc
(
HWND
hwnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
static
LRESULT
WINAPI
notif_wnd_proc
(
HWND
hwnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
{
if
(
msg
==
WM_MK_CONTINUE
)
{
if
(
msg
==
WM_MK_CONTINUE
)
{
Binding
*
binding
=
(
Binding
*
)
lParam
;
Binding
*
binding
=
(
Binding
*
)
lParam
;
task_t
*
task
;
do_tasks
(
binding
);
while
((
task
=
pop_task
(
binding
)))
task
->
proc
(
binding
,
task
);
IBinding_Release
(
BINDING
(
binding
));
IBinding_Release
(
BINDING
(
binding
));
return
0
;
return
0
;
...
@@ -264,41 +207,6 @@ static HWND get_notif_hwnd(void)
...
@@ -264,41 +207,6 @@ static HWND get_notif_hwnd(void)
return
hwnd
;
return
hwnd
;
}
}
static
void
on_progress
(
Binding
*
This
,
ULONG
progress
,
ULONG
progress_max
,
ULONG
status_code
,
LPCWSTR
status_text
)
{
task_t
*
task
;
if
(
GetCurrentThreadId
()
==
This
->
apartment_thread
&&
!
This
->
continue_call
)
{
IBindStatusCallback_OnProgress
(
This
->
callback
,
progress
,
progress_max
,
status_code
,
status_text
);
return
;
}
task
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
task_t
));
task
->
task
=
TASK_ON_PROGRESS
;
task
->
data
.
on_progress
.
progress
=
progress
;
task
->
data
.
on_progress
.
progress_max
=
progress_max
;
task
->
data
.
on_progress
.
status_code
=
status_code
;
if
(
status_text
)
{
DWORD
size
=
(
strlenW
(
status_text
)
+
1
)
*
sizeof
(
WCHAR
);
task
->
data
.
on_progress
.
status_text
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
memcpy
(
task
->
data
.
on_progress
.
status_text
,
status_text
,
size
);
}
else
{
task
->
data
.
on_progress
.
status_text
=
NULL
;
}
push_task
(
This
,
task
);
if
(
GetCurrentThreadId
()
!=
This
->
apartment_thread
)
{
IBinding_AddRef
(
BINDING
(
This
));
PostMessageW
(
This
->
notif_hwnd
,
WM_MK_CONTINUE
,
0
,
(
LPARAM
)
This
);
}
}
static
void
dump_BINDINFO
(
BINDINFO
*
bi
)
static
void
dump_BINDINFO
(
BINDINFO
*
bi
)
{
{
static
const
char
*
const
BINDINFOF_str
[]
=
{
static
const
char
*
const
BINDINFOF_str
[]
=
{
...
@@ -788,6 +696,13 @@ static ULONG WINAPI InternetProtocolSink_Release(IInternetProtocolSink *iface)
...
@@ -788,6 +696,13 @@ static ULONG WINAPI InternetProtocolSink_Release(IInternetProtocolSink *iface)
return
IBinding_Release
(
BINDING
(
This
));
return
IBinding_Release
(
BINDING
(
This
));
}
}
static
void
switch_proc
(
Binding
*
binding
,
task_t
*
t
)
{
IInternetProtocol_Continue
(
binding
->
protocol
,
t
->
data
.
protocol_data
);
HeapFree
(
GetProcessHeap
(),
0
,
t
);
}
static
HRESULT
WINAPI
InternetProtocolSink_Switch
(
IInternetProtocolSink
*
iface
,
static
HRESULT
WINAPI
InternetProtocolSink_Switch
(
IInternetProtocolSink
*
iface
,
PROTOCOLDATA
*
pProtocolData
)
PROTOCOLDATA
*
pProtocolData
)
{
{
...
@@ -797,7 +712,7 @@ static HRESULT WINAPI InternetProtocolSink_Switch(IInternetProtocolSink *iface,
...
@@ -797,7 +712,7 @@ static HRESULT WINAPI InternetProtocolSink_Switch(IInternetProtocolSink *iface,
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
pProtocolData
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
pProtocolData
);
task
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
task_t
));
task
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
task_t
));
task
->
task
=
TASK_SWITCH
;
task
->
proc
=
switch_proc
;
task
->
data
.
protocol_data
=
pProtocolData
;
task
->
data
.
protocol_data
=
pProtocolData
;
push_task
(
This
,
task
);
push_task
(
This
,
task
);
...
@@ -808,6 +723,50 @@ static HRESULT WINAPI InternetProtocolSink_Switch(IInternetProtocolSink *iface,
...
@@ -808,6 +723,50 @@ static HRESULT WINAPI InternetProtocolSink_Switch(IInternetProtocolSink *iface,
return
S_OK
;
return
S_OK
;
}
}
static
void
on_progress_proc
(
Binding
*
This
,
task_t
*
t
)
{
IBindStatusCallback_OnProgress
(
This
->
callback
,
t
->
data
.
on_progress
.
progress
,
t
->
data
.
on_progress
.
progress_max
,
t
->
data
.
on_progress
.
status_code
,
t
->
data
.
on_progress
.
status_text
);
HeapFree
(
GetProcessHeap
(),
0
,
t
->
data
.
on_progress
.
status_text
);
HeapFree
(
GetProcessHeap
(),
0
,
t
);
}
static
void
on_progress
(
Binding
*
This
,
ULONG
progress
,
ULONG
progress_max
,
ULONG
status_code
,
LPCWSTR
status_text
)
{
task_t
*
task
;
if
(
GetCurrentThreadId
()
==
This
->
apartment_thread
&&
!
This
->
continue_call
)
{
IBindStatusCallback_OnProgress
(
This
->
callback
,
progress
,
progress_max
,
status_code
,
status_text
);
return
;
}
task
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
task_t
));
task
->
proc
=
on_progress_proc
;
task
->
data
.
on_progress
.
progress
=
progress
;
task
->
data
.
on_progress
.
progress_max
=
progress_max
;
task
->
data
.
on_progress
.
status_code
=
status_code
;
if
(
status_text
)
{
DWORD
size
=
(
strlenW
(
status_text
)
+
1
)
*
sizeof
(
WCHAR
);
task
->
data
.
on_progress
.
status_text
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
memcpy
(
task
->
data
.
on_progress
.
status_text
,
status_text
,
size
);
}
else
{
task
->
data
.
on_progress
.
status_text
=
NULL
;
}
push_task
(
This
,
task
);
if
(
GetCurrentThreadId
()
!=
This
->
apartment_thread
)
{
IBinding_AddRef
(
BINDING
(
This
));
PostMessageW
(
This
->
notif_hwnd
,
WM_MK_CONTINUE
,
0
,
(
LPARAM
)
This
);
}
}
static
HRESULT
WINAPI
InternetProtocolSink_ReportProgress
(
IInternetProtocolSink
*
iface
,
static
HRESULT
WINAPI
InternetProtocolSink_ReportProgress
(
IInternetProtocolSink
*
iface
,
ULONG
ulStatusCode
,
LPCWSTR
szStatusText
)
ULONG
ulStatusCode
,
LPCWSTR
szStatusText
)
{
{
...
@@ -845,6 +804,23 @@ static HRESULT WINAPI InternetProtocolSink_ReportProgress(IInternetProtocolSink
...
@@ -845,6 +804,23 @@ static HRESULT WINAPI InternetProtocolSink_ReportProgress(IInternetProtocolSink
return
S_OK
;
return
S_OK
;
}
}
static
void
report_data
(
Binding
*
This
,
DWORD
bscf
)
{
FORMATETC
formatetc
=
{
0
,
NULL
,
1
,
-
1
,
TYMED_ISTREAM
};
fill_stream_buffer
(
This
->
stream
);
IBindStatusCallback_OnDataAvailable
(
This
->
callback
,
bscf
,
This
->
stream
->
buf_size
,
&
formatetc
,
&
This
->
stgmed
);
}
static
void
report_data_proc
(
Binding
*
binding
,
task_t
*
t
)
{
report_data
(
binding
,
t
->
data
.
bscf
);
HeapFree
(
GetProcessHeap
(),
0
,
t
);
}
static
HRESULT
WINAPI
InternetProtocolSink_ReportData
(
IInternetProtocolSink
*
iface
,
static
HRESULT
WINAPI
InternetProtocolSink_ReportData
(
IInternetProtocolSink
*
iface
,
DWORD
grfBSCF
,
ULONG
ulProgress
,
ULONG
ulProgressMax
)
DWORD
grfBSCF
,
ULONG
ulProgress
,
ULONG
ulProgressMax
)
{
{
...
@@ -852,6 +828,9 @@ static HRESULT WINAPI InternetProtocolSink_ReportData(IInternetProtocolSink *ifa
...
@@ -852,6 +828,9 @@ static HRESULT WINAPI InternetProtocolSink_ReportData(IInternetProtocolSink *ifa
TRACE
(
"(%p)->(%d %u %u)
\n
"
,
This
,
grfBSCF
,
ulProgress
,
ulProgressMax
);
TRACE
(
"(%p)->(%d %u %u)
\n
"
,
This
,
grfBSCF
,
ulProgress
,
ulProgressMax
);
if
(
GetCurrentThreadId
()
!=
This
->
apartment_thread
)
FIXME
(
"called from worked hread
\n
"
);
if
(
!
This
->
verified_mime
)
{
if
(
!
This
->
verified_mime
)
{
LPWSTR
mime
;
LPWSTR
mime
;
...
@@ -877,7 +856,15 @@ static HRESULT WINAPI InternetProtocolSink_ReportData(IInternetProtocolSink *ifa
...
@@ -877,7 +856,15 @@ static HRESULT WINAPI InternetProtocolSink_ReportData(IInternetProtocolSink *ifa
This
->
request_locked
=
SUCCEEDED
(
hres
);
This
->
request_locked
=
SUCCEEDED
(
hres
);
}
}
on_data_available
(
This
,
grfBSCF
);
if
(
This
->
continue_call
)
{
task_t
*
task
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
task_t
));
task
->
proc
=
report_data_proc
;
task
->
data
.
bscf
=
grfBSCF
;
push_task
(
This
,
task
);
}
else
{
report_data
(
This
,
grfBSCF
);
}
if
(
grfBSCF
&
BSCF_LASTDATANOTIFICATION
)
if
(
grfBSCF
&
BSCF_LASTDATANOTIFICATION
)
IBindStatusCallback_OnStopBinding
(
This
->
callback
,
S_OK
,
NULL
);
IBindStatusCallback_OnStopBinding
(
This
->
callback
,
S_OK
,
NULL
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment