-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconcurrentDispatchWrapper.cpp
177 lines (142 loc) · 7.48 KB
/
concurrentDispatchWrapper.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#include "concurrentDispatchWrapper.hpp"
//we don't need this because this is causing problems
tjs_error PatchResult(tjs_error hr, iTJSDispatch2** result) {
/*if (hr == TJS_S_OK && result != NULL) {
iTJSDispatch2* obj = *result;
if (getMember(obj, L"isConcurrent").AsInteger() != 1)
*result = (iTJSDispatch2*)new concurrentiTJSDispatch2(obj);
}*/
return hr;
}
tjs_error PatchResult(tjs_error hr, tTJSVariant* result) {
/*if (hr == TJS_S_OK && result != NULL && result->Type() == tvtObject) {
iTJSDispatch2* obj = result->AsObject();
if (getMember(obj, L"isConcurrent").AsInteger() != 1)
*result = (iTJSDispatch2*)new concurrentiTJSDispatch2(obj);
}*/
return hr;
}
inline iTJSDispatch2* concurrentiTJSDispatch2::TransferThis(iTJSDispatch2* objthis)
{
return objthis==this?wrappedobj:objthis;
}
concurrentiTJSDispatch2::concurrentiTJSDispatch2(iTJSDispatch2* obj) :wrappedobj(obj) {}
tjs_uint TJS_INTF_METHOD concurrentiTJSDispatch2::AddRef(void) {
LOCK;
return wrappedobj->AddRef();
}
tjs_uint TJS_INTF_METHOD concurrentiTJSDispatch2::Release(void) {
LOCK;
return wrappedobj->Release();
}
/*Locked function call,we wrap the result*/
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::FuncCall(tjs_uint32 flag, const tjs_char* membername, tjs_uint32* hint, tTJSVariant* result, tjs_int numparams, tTJSVariant** param, iTJSDispatch2* objthis) {
LOCK;
return PatchResult(wrappedobj->FuncCall(flag, membername, hint, result, numparams, param, TransferThis(objthis)), result);
}
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::FuncCallByNum(tjs_uint32 flag, tjs_int num, tTJSVariant* result, tjs_int numparams, tTJSVariant** param, iTJSDispatch2* objthis) {
LOCK;
return PatchResult(wrappedobj->FuncCallByNum(flag, num, result, numparams, param, TransferThis(objthis)), result);
}
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::PropGet(tjs_uint32 flag, const tjs_char* membername, tjs_uint32* hint, tTJSVariant* result, iTJSDispatch2* objthis) {
LOCK;
if(membername)
if (!wcscmp(membername, L"isConcurrent")) {
*result = 1;
return TJS_S_OK;
}
return PatchResult(wrappedobj->PropGet(flag, membername, hint, result, TransferThis(objthis)), result);
}
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::PropGetByNum(tjs_uint32 flag, tjs_int num, tTJSVariant* result, iTJSDispatch2* objthis) {
LOCK;
return PatchResult(wrappedobj->PropGetByNum(flag, num, result, TransferThis(objthis)), result);
}
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::PropSet(tjs_uint32 flag, const tjs_char* membername, tjs_uint32* hint, const tTJSVariant* param, iTJSDispatch2* objthis) {
LOCK;
return wrappedobj->PropSet(flag, membername, hint, param, TransferThis(objthis));
}
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::PropSetByNum(tjs_uint32 flag, tjs_int num, const tTJSVariant* param, iTJSDispatch2* objthis) {
LOCK;
return wrappedobj->PropSetByNum(flag, num, param, TransferThis(objthis));
}
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::GetCount(tjs_int* result, const tjs_char* membername, tjs_uint32* hint, iTJSDispatch2* objthis) {
LOCK;
return wrappedobj->GetCount(result, membername, hint, TransferThis(objthis));
}
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::GetCountByNum(tjs_int* result, tjs_int num, iTJSDispatch2* objthis) {
LOCK;
return wrappedobj->GetCountByNum(result, num, TransferThis(objthis));
}
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::PropSetByVS(tjs_uint32 flag, tTJSVariantString* membername, const tTJSVariant* param, iTJSDispatch2* objthis) {
LOCK;
return wrappedobj->PropSetByVS(flag, membername, param, TransferThis(objthis));
}
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::EnumMembers(tjs_uint32 flag, tTJSVariantClosure* callback, iTJSDispatch2* objthis) {
LOCK;
return wrappedobj->EnumMembers(flag, callback, TransferThis(objthis));
}
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::DeleteMember(tjs_uint32 flag, const tjs_char* membername, tjs_uint32* hint, iTJSDispatch2* objthis) {
LOCK;
return wrappedobj->DeleteMember(flag, membername, hint, TransferThis(objthis));
}
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::DeleteMemberByNum(tjs_uint32 flag, tjs_int num, iTJSDispatch2* objthis) {
LOCK;
return wrappedobj->DeleteMemberByNum(flag, num, TransferThis(objthis));
}
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::Invalidate(tjs_uint32 flag, const tjs_char* membername, tjs_uint32* hint, iTJSDispatch2* objthis) {
LOCK;
return wrappedobj->Invalidate(flag, membername, hint, TransferThis(objthis));
}
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::InvalidateByNum(tjs_uint32 flag, tjs_int num, iTJSDispatch2* objthis) {
LOCK;
return wrappedobj->InvalidateByNum(flag, num, TransferThis(objthis));
}
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::IsValid(tjs_uint32 flag, const tjs_char* membername, tjs_uint32* hint, iTJSDispatch2* objthis) {
LOCK;
return wrappedobj->IsValid(flag, membername, hint, TransferThis(objthis));
}
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::IsValidByNum(tjs_uint32 flag, tjs_int num, iTJSDispatch2* objthis) {
LOCK;
return wrappedobj->IsValidByNum(flag, num, TransferThis(objthis));
}
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::CreateNew(tjs_uint32 flag, const tjs_char* membername, tjs_uint32* hint, iTJSDispatch2** result, tjs_int numparams, tTJSVariant** param, iTJSDispatch2* objthis) {
LOCK;
return PatchResult(wrappedobj->CreateNew(flag, membername, hint, result, numparams, param, TransferThis(objthis)), result);
}
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::CreateNewByNum(tjs_uint32 flag, tjs_int num, iTJSDispatch2** result, tjs_int numparams, tTJSVariant** param, iTJSDispatch2* objthis) {
LOCK;
return PatchResult(wrappedobj->CreateNewByNum(flag, num, result, numparams, param, TransferThis(objthis)), result);
}
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::Reserved1() {
return TJS_E_NOTIMPL;
}
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::IsInstanceOf(tjs_uint32 flag, const tjs_char* membername, tjs_uint32* hint, const tjs_char* classname, iTJSDispatch2* objthis) {
LOCK;
return wrappedobj->IsInstanceOf(flag, membername, hint, classname, TransferThis(objthis));
}
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::IsInstanceOfByNum(tjs_uint32 flag, tjs_int num, const tjs_char* classname, iTJSDispatch2* objthis) {
LOCK;
return wrappedobj->IsInstanceOfByNum(flag, num, classname, TransferThis(objthis));
}
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::Operation(tjs_uint32 flag, const tjs_char* membername, tjs_uint32* hint, tTJSVariant* result, const tTJSVariant* param, iTJSDispatch2* objthis) {
LOCK;
return PatchResult(wrappedobj->Operation(flag, membername, hint, result, param, TransferThis(objthis)), result);
}
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::OperationByNum(tjs_uint32 flag, tjs_int num, tTJSVariant* result, const tTJSVariant* param, iTJSDispatch2* objthis) {
LOCK;
return PatchResult(wrappedobj->OperationByNum(flag, num, result, param, TransferThis(objthis)), result);
}
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::NativeInstanceSupport(tjs_uint32 flag, tjs_int32 classid, iTJSNativeInstance** pointer) {
LOCK;
return wrappedobj->NativeInstanceSupport(flag, classid, pointer);
}
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::ClassInstanceInfo(tjs_uint32 flag, tjs_uint num, tTJSVariant* value) {
LOCK;
return wrappedobj->ClassInstanceInfo(flag, num, value);
}
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::Reserved2() {
return TJS_E_NOTIMPL;
}
tjs_error TJS_INTF_METHOD concurrentiTJSDispatch2::Reserved3() {
return TJS_E_NOTIMPL;
}