-
Notifications
You must be signed in to change notification settings - Fork 1
/
AbstractOp.cpp
52 lines (33 loc) · 918 Bytes
/
AbstractOp.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
// Bring in platform-specific definitions.
#if defined(WIN32)
#include <windows.h>
#include <process.h>
#endif
#include "inc\op.h"
void TOnEnd(Op *op, CefRefPtr<CefProcessMessage> response) {
op->OnEnd(response);
//We can call ~Op now
op->Release();
}
// Bring in platform-specific definitions.
#if defined(WIN32)
void TRun(void *pArg) {
Op *op = static_cast<Op*>(pArg);
CefRefPtr<CefProcessMessage> response = op->Do();
response.get() ?
CefPostTask(TID_UI, NewCefRunnableFunction(TOnEnd, op, response))
:
//We can call ~Op now
op->Release()
;
_endthread();
}
#endif
void Op::RunOp(CefRefPtr<Op> op) {
// Make sure an additional ref is kept for the thread function so that ~Op is not called
op->AddRef();
// Bring in platform-specific definitions.
#if defined(WIN32)
_beginthread(TRun, 0, (void *)op.get());
#endif
}