Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
c6ab933b
Commit
c6ab933b
authored
May 03, 2022
by
Bernhard Kölbl
Committed by
Alexandre Julliard
May 24, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windows.media.speech: Make IAsyncAction concurrent.
Signed-off-by:
Bernhard Kölbl
<
besentv@gmail.com
>
parent
1438b1b6
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
5 deletions
+80
-5
async.c
dlls/windows.media.speech/async.c
+72
-3
private.h
dlls/windows.media.speech/private.h
+2
-1
recognizer.c
dlls/windows.media.speech/recognizer.c
+6
-1
No files found.
dlls/windows.media.speech/async.c
View file @
c6ab933b
...
@@ -40,6 +40,11 @@ struct async_void
...
@@ -40,6 +40,11 @@ struct async_void
IAsyncActionCompletedHandler
*
handler
;
IAsyncActionCompletedHandler
*
handler
;
async_action_callback
callback
;
TP_WORK
*
async_run_work
;
IInspectable
*
invoker
;
CRITICAL_SECTION
cs
;
AsyncStatus
status
;
AsyncStatus
status
;
HRESULT
hr
;
HRESULT
hr
;
};
};
...
@@ -116,6 +121,7 @@ HRESULT WINAPI async_void_put_Completed( IAsyncAction *iface, IAsyncActionComple
...
@@ -116,6 +121,7 @@ HRESULT WINAPI async_void_put_Completed( IAsyncAction *iface, IAsyncActionComple
TRACE
(
"iface %p, handler %p.
\n
"
,
iface
,
handler
);
TRACE
(
"iface %p, handler %p.
\n
"
,
iface
,
handler
);
EnterCriticalSection
(
&
impl
->
cs
);
if
(
impl
->
status
==
Closed
)
if
(
impl
->
status
==
Closed
)
hr
=
E_ILLEGAL_METHOD_CALL
;
hr
=
E_ILLEGAL_METHOD_CALL
;
else
if
(
impl
->
handler
!=
HANDLER_NOT_SET
)
else
if
(
impl
->
handler
!=
HANDLER_NOT_SET
)
...
@@ -133,11 +139,15 @@ HRESULT WINAPI async_void_put_Completed( IAsyncAction *iface, IAsyncActionComple
...
@@ -133,11 +139,15 @@ HRESULT WINAPI async_void_put_Completed( IAsyncAction *iface, IAsyncActionComple
IAsyncAction
*
action
=
&
impl
->
IAsyncAction_iface
;
IAsyncAction
*
action
=
&
impl
->
IAsyncAction_iface
;
AsyncStatus
status
=
impl
->
status
;
AsyncStatus
status
=
impl
->
status
;
impl
->
handler
=
NULL
;
/* Prevent concurrent invoke. */
impl
->
handler
=
NULL
;
/* Prevent concurrent invoke. */
LeaveCriticalSection
(
&
impl
->
cs
);
IAsyncActionCompletedHandler_Invoke
(
handler
,
action
,
status
);
IAsyncActionCompletedHandler_Invoke
(
handler
,
action
,
status
);
IAsyncActionCompletedHandler_Release
(
handler
);
IAsyncActionCompletedHandler_Release
(
handler
);
return
S_OK
;
}
}
}
}
LeaveCriticalSection
(
&
impl
->
cs
);
return
hr
;
return
hr
;
}
}
...
@@ -149,9 +159,11 @@ HRESULT WINAPI async_void_get_Completed( IAsyncAction *iface, IAsyncActionComple
...
@@ -149,9 +159,11 @@ HRESULT WINAPI async_void_get_Completed( IAsyncAction *iface, IAsyncActionComple
FIXME
(
"iface %p, handler %p semi stub!
\n
"
,
iface
,
handler
);
FIXME
(
"iface %p, handler %p semi stub!
\n
"
,
iface
,
handler
);
EnterCriticalSection
(
&
impl
->
cs
);
if
(
impl
->
status
==
Closed
)
if
(
impl
->
status
==
Closed
)
hr
=
E_ILLEGAL_METHOD_CALL
;
hr
=
E_ILLEGAL_METHOD_CALL
;
*
handler
=
(
impl
->
handler
!=
HANDLER_NOT_SET
)
?
impl
->
handler
:
NULL
;
*
handler
=
(
impl
->
handler
!=
HANDLER_NOT_SET
)
?
impl
->
handler
:
NULL
;
LeaveCriticalSection
(
&
impl
->
cs
);
return
hr
;
return
hr
;
}
}
...
@@ -200,9 +212,11 @@ static HRESULT WINAPI async_void_info_get_Status( IAsyncInfo *iface, AsyncStatus
...
@@ -200,9 +212,11 @@ static HRESULT WINAPI async_void_info_get_Status( IAsyncInfo *iface, AsyncStatus
TRACE
(
"iface %p, status %p.
\n
"
,
iface
,
status
);
TRACE
(
"iface %p, status %p.
\n
"
,
iface
,
status
);
EnterCriticalSection
(
&
impl
->
cs
);
if
(
impl
->
status
==
Closed
)
if
(
impl
->
status
==
Closed
)
hr
=
E_ILLEGAL_METHOD_CALL
;
hr
=
E_ILLEGAL_METHOD_CALL
;
*
status
=
impl
->
status
;
*
status
=
impl
->
status
;
LeaveCriticalSection
(
&
impl
->
cs
);
return
hr
;
return
hr
;
}
}
...
@@ -214,10 +228,12 @@ static HRESULT WINAPI async_void_info_get_ErrorCode( IAsyncInfo *iface, HRESULT
...
@@ -214,10 +228,12 @@ static HRESULT WINAPI async_void_info_get_ErrorCode( IAsyncInfo *iface, HRESULT
TRACE
(
"iface %p, error_code %p.
\n
"
,
iface
,
error_code
);
TRACE
(
"iface %p, error_code %p.
\n
"
,
iface
,
error_code
);
EnterCriticalSection
(
&
impl
->
cs
);
if
(
impl
->
status
==
Closed
)
if
(
impl
->
status
==
Closed
)
*
error_code
=
hr
=
E_ILLEGAL_METHOD_CALL
;
*
error_code
=
hr
=
E_ILLEGAL_METHOD_CALL
;
else
else
*
error_code
=
impl
->
hr
;
*
error_code
=
impl
->
hr
;
LeaveCriticalSection
(
&
impl
->
cs
);
return
hr
;
return
hr
;
}
}
...
@@ -229,10 +245,12 @@ static HRESULT WINAPI async_void_info_Cancel( IAsyncInfo *iface )
...
@@ -229,10 +245,12 @@ static HRESULT WINAPI async_void_info_Cancel( IAsyncInfo *iface )
TRACE
(
"iface %p.
\n
"
,
iface
);
TRACE
(
"iface %p.
\n
"
,
iface
);
EnterCriticalSection
(
&
impl
->
cs
);
if
(
impl
->
status
==
Closed
)
if
(
impl
->
status
==
Closed
)
hr
=
E_ILLEGAL_METHOD_CALL
;
hr
=
E_ILLEGAL_METHOD_CALL
;
else
if
(
impl
->
status
==
Started
)
else
if
(
impl
->
status
==
Started
)
impl
->
status
=
Canceled
;
impl
->
status
=
Canceled
;
LeaveCriticalSection
(
&
impl
->
cs
);
return
hr
;
return
hr
;
}
}
...
@@ -244,10 +262,16 @@ static HRESULT WINAPI async_void_info_Close( IAsyncInfo *iface )
...
@@ -244,10 +262,16 @@ static HRESULT WINAPI async_void_info_Close( IAsyncInfo *iface )
TRACE
(
"iface %p.
\n
"
,
iface
);
TRACE
(
"iface %p.
\n
"
,
iface
);
EnterCriticalSection
(
&
impl
->
cs
);
if
(
impl
->
status
==
Started
)
if
(
impl
->
status
==
Started
)
hr
=
E_ILLEGAL_STATE_CHANGE
;
hr
=
E_ILLEGAL_STATE_CHANGE
;
else
if
(
impl
->
status
!=
Closed
)
else
if
(
impl
->
status
!=
Closed
)
{
CloseThreadpoolWork
(
impl
->
async_run_work
);
impl
->
async_run_work
=
NULL
;
impl
->
status
=
Closed
;
impl
->
status
=
Closed
;
}
LeaveCriticalSection
(
&
impl
->
cs
);
return
hr
;
return
hr
;
}
}
...
@@ -270,11 +294,40 @@ static const struct IAsyncInfoVtbl async_void_info_vtbl =
...
@@ -270,11 +294,40 @@ static const struct IAsyncInfoVtbl async_void_info_vtbl =
async_void_info_Close
async_void_info_Close
};
};
HRESULT
async_action_create
(
IAsyncAction
**
out
)
static
void
CALLBACK
async_void_run_cb
(
TP_CALLBACK_INSTANCE
*
instance
,
void
*
data
,
TP_WORK
*
work
)
{
IAsyncAction
*
action
=
data
;
struct
async_void
*
impl
=
impl_from_IAsyncAction
(
action
);
HRESULT
hr
;
hr
=
impl
->
callback
(
impl
->
invoker
);
EnterCriticalSection
(
&
impl
->
cs
);
if
(
impl
->
status
<
Closed
)
impl
->
status
=
FAILED
(
hr
)
?
Error
:
Completed
;
impl
->
hr
=
hr
;
if
(
impl
->
handler
!=
NULL
&&
impl
->
handler
!=
HANDLER_NOT_SET
)
{
IAsyncActionCompletedHandler
*
handler
=
impl
->
handler
;
AsyncStatus
status
=
impl
->
status
;
impl
->
handler
=
NULL
;
/* Prevent concurrent invoke. */
LeaveCriticalSection
(
&
impl
->
cs
);
IAsyncActionCompletedHandler_Invoke
(
handler
,
action
,
status
);
IAsyncActionCompletedHandler_Release
(
handler
);
}
else
LeaveCriticalSection
(
&
impl
->
cs
);
IAsyncAction_Release
(
action
);
}
HRESULT
async_action_create
(
IInspectable
*
invoker
,
async_action_callback
callback
,
IAsyncAction
**
out
)
{
{
struct
async_void
*
impl
;
struct
async_void
*
impl
;
TRACE
(
"
out %p.
\n
"
,
out
);
TRACE
(
"
invoker %p, callback %p, out %p.
\n
"
,
invoker
,
callback
,
out
);
if
(
!
(
impl
=
calloc
(
1
,
sizeof
(
*
impl
))))
if
(
!
(
impl
=
calloc
(
1
,
sizeof
(
*
impl
))))
{
{
...
@@ -287,7 +340,23 @@ HRESULT async_action_create( IAsyncAction **out )
...
@@ -287,7 +340,23 @@ HRESULT async_action_create( IAsyncAction **out )
impl
->
ref
=
1
;
impl
->
ref
=
1
;
impl
->
handler
=
HANDLER_NOT_SET
;
impl
->
handler
=
HANDLER_NOT_SET
;
impl
->
status
=
Completed
;
impl
->
callback
=
callback
;
impl
->
status
=
Started
;
if
(
!
(
impl
->
async_run_work
=
CreateThreadpoolWork
(
async_void_run_cb
,
&
impl
->
IAsyncAction_iface
,
NULL
)))
{
free
(
impl
);
return
HRESULT_FROM_WIN32
(
GetLastError
());
}
if
(
invoker
)
IInspectable_AddRef
((
impl
->
invoker
=
invoker
));
InitializeCriticalSection
(
&
impl
->
cs
);
impl
->
cs
.
DebugInfo
->
Spare
[
0
]
=
(
DWORD_PTR
)(
__FILE__
": async_action.cs"
);
/* AddRef to keep the obj alive in the callback. */
IAsyncAction_AddRef
(
&
impl
->
IAsyncAction_iface
);
SubmitThreadpoolWork
(
impl
->
async_run_work
);
*
out
=
&
impl
->
IAsyncAction_iface
;
*
out
=
&
impl
->
IAsyncAction_iface
;
TRACE
(
"created %p
\n
"
,
*
out
);
TRACE
(
"created %p
\n
"
,
*
out
);
...
...
dlls/windows.media.speech/private.h
View file @
c6ab933b
...
@@ -69,9 +69,10 @@ struct vector_iids
...
@@ -69,9 +69,10 @@ struct vector_iids
const
GUID
*
view
;
const
GUID
*
view
;
};
};
typedef
HRESULT
(
WINAPI
*
async_action_callback
)(
IInspectable
*
invoker
);
typedef
HRESULT
(
WINAPI
*
async_operation_inspectable_callback
)(
IInspectable
*
invoker
,
IInspectable
**
result
);
typedef
HRESULT
(
WINAPI
*
async_operation_inspectable_callback
)(
IInspectable
*
invoker
,
IInspectable
**
result
);
HRESULT
async_action_create
(
IAsyncAction
**
out
);
HRESULT
async_action_create
(
I
Inspectable
*
invoker
,
async_action_callback
callback
,
I
AsyncAction
**
out
);
HRESULT
async_operation_inspectable_create
(
const
GUID
*
iid
,
IInspectable
*
invoker
,
async_operation_inspectable_callback
callback
,
HRESULT
async_operation_inspectable_create
(
const
GUID
*
iid
,
IInspectable
*
invoker
,
async_operation_inspectable_callback
callback
,
IAsyncOperation_IInspectable
**
out
);
IAsyncOperation_IInspectable
**
out
);
...
...
dlls/windows.media.speech/recognizer.c
View file @
c6ab933b
...
@@ -244,10 +244,15 @@ static HRESULT WINAPI session_set_AutoStopSilenceTimeout( ISpeechContinuousRecog
...
@@ -244,10 +244,15 @@ static HRESULT WINAPI session_set_AutoStopSilenceTimeout( ISpeechContinuousRecog
return
E_NOTIMPL
;
return
E_NOTIMPL
;
}
}
static
HRESULT
WINAPI
start_callback
(
IInspectable
*
invoker
)
{
return
S_OK
;
}
static
HRESULT
WINAPI
session_StartAsync
(
ISpeechContinuousRecognitionSession
*
iface
,
IAsyncAction
**
action
)
static
HRESULT
WINAPI
session_StartAsync
(
ISpeechContinuousRecognitionSession
*
iface
,
IAsyncAction
**
action
)
{
{
FIXME
(
"iface %p, action %p stub!
\n
"
,
iface
,
action
);
FIXME
(
"iface %p, action %p stub!
\n
"
,
iface
,
action
);
return
async_action_create
(
action
);
return
async_action_create
(
NULL
,
start_callback
,
action
);
}
}
static
HRESULT
WINAPI
session_StartWithModeAsync
(
ISpeechContinuousRecognitionSession
*
iface
,
static
HRESULT
WINAPI
session_StartWithModeAsync
(
ISpeechContinuousRecognitionSession
*
iface
,
...
...
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