Commit 052de3f9 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

mstask: COM cleanup for the ITaskScheduler iface.

parent 73b6d21a
...@@ -35,12 +35,6 @@ typedef struct ClassFactoryImpl ClassFactoryImpl; ...@@ -35,12 +35,6 @@ typedef struct ClassFactoryImpl ClassFactoryImpl;
extern ClassFactoryImpl MSTASK_ClassFactory; extern ClassFactoryImpl MSTASK_ClassFactory;
extern HRESULT TaskTriggerConstructor(LPVOID *ppObj); extern HRESULT TaskTriggerConstructor(LPVOID *ppObj);
typedef struct
{
const ITaskSchedulerVtbl *lpVtbl;
LONG ref;
} TaskSchedulerImpl;
extern HRESULT TaskSchedulerConstructor(LPVOID *ppObj); extern HRESULT TaskSchedulerConstructor(LPVOID *ppObj);
typedef struct typedef struct
......
...@@ -22,6 +22,17 @@ ...@@ -22,6 +22,17 @@
WINE_DEFAULT_DEBUG_CHANNEL(mstask); WINE_DEFAULT_DEBUG_CHANNEL(mstask);
typedef struct
{
ITaskScheduler ITaskScheduler_iface;
LONG ref;
} TaskSchedulerImpl;
static inline TaskSchedulerImpl *impl_from_ITaskScheduler(ITaskScheduler *iface)
{
return CONTAINING_RECORD(iface, TaskSchedulerImpl, ITaskScheduler_iface);
}
static void TaskSchedulerDestructor(TaskSchedulerImpl *This) static void TaskSchedulerDestructor(TaskSchedulerImpl *This)
{ {
TRACE("%p\n", This); TRACE("%p\n", This);
...@@ -34,14 +45,14 @@ static HRESULT WINAPI MSTASK_ITaskScheduler_QueryInterface( ...@@ -34,14 +45,14 @@ static HRESULT WINAPI MSTASK_ITaskScheduler_QueryInterface(
REFIID riid, REFIID riid,
void **ppvObject) void **ppvObject)
{ {
TaskSchedulerImpl * This = (TaskSchedulerImpl *)iface; TaskSchedulerImpl * This = impl_from_ITaskScheduler(iface);
TRACE("IID: %s\n", debugstr_guid(riid)); TRACE("IID: %s\n", debugstr_guid(riid));
if (IsEqualGUID(riid, &IID_IUnknown) || if (IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_ITaskScheduler)) IsEqualGUID(riid, &IID_ITaskScheduler))
{ {
*ppvObject = &This->lpVtbl; *ppvObject = &This->ITaskScheduler_iface;
ITaskScheduler_AddRef(iface); ITaskScheduler_AddRef(iface);
return S_OK; return S_OK;
} }
...@@ -53,7 +64,7 @@ static HRESULT WINAPI MSTASK_ITaskScheduler_QueryInterface( ...@@ -53,7 +64,7 @@ static HRESULT WINAPI MSTASK_ITaskScheduler_QueryInterface(
static ULONG WINAPI MSTASK_ITaskScheduler_AddRef( static ULONG WINAPI MSTASK_ITaskScheduler_AddRef(
ITaskScheduler* iface) ITaskScheduler* iface)
{ {
TaskSchedulerImpl *This = (TaskSchedulerImpl *)iface; TaskSchedulerImpl *This = impl_from_ITaskScheduler(iface);
TRACE("\n"); TRACE("\n");
return InterlockedIncrement(&This->ref); return InterlockedIncrement(&This->ref);
} }
...@@ -61,7 +72,7 @@ static ULONG WINAPI MSTASK_ITaskScheduler_AddRef( ...@@ -61,7 +72,7 @@ static ULONG WINAPI MSTASK_ITaskScheduler_AddRef(
static ULONG WINAPI MSTASK_ITaskScheduler_Release( static ULONG WINAPI MSTASK_ITaskScheduler_Release(
ITaskScheduler* iface) ITaskScheduler* iface)
{ {
TaskSchedulerImpl * This = (TaskSchedulerImpl *)iface; TaskSchedulerImpl * This = impl_from_ITaskScheduler(iface);
ULONG ref; ULONG ref;
TRACE("\n"); TRACE("\n");
ref = InterlockedDecrement(&This->ref); ref = InterlockedDecrement(&This->ref);
...@@ -178,10 +189,10 @@ HRESULT TaskSchedulerConstructor(LPVOID *ppObj) ...@@ -178,10 +189,10 @@ HRESULT TaskSchedulerConstructor(LPVOID *ppObj)
if (!This) if (!This)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->lpVtbl = &MSTASK_ITaskSchedulerVtbl; This->ITaskScheduler_iface.lpVtbl = &MSTASK_ITaskSchedulerVtbl;
This->ref = 1; This->ref = 1;
*ppObj = &This->lpVtbl; *ppObj = &This->ITaskScheduler_iface;
InterlockedIncrement(&dll_ref); InterlockedIncrement(&dll_ref);
return S_OK; return S_OK;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment