add thread mode & async call
This commit is contained in:
parent
24f7bb2498
commit
ceb08bfa1d
@ -1,10 +1,13 @@
|
||||
#ifndef INTERFACEDRIVER_H
|
||||
#define INTERFACEDRIVER_H
|
||||
|
||||
#include <QRunnable>
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
|
||||
#include "DoricRegistry.h"
|
||||
#include "async/DoricAsyncResult.h"
|
||||
#include "utils/DoricThreadMode.h"
|
||||
|
||||
class DoricInterfaceDriver {
|
||||
public:
|
||||
@ -13,6 +16,9 @@ public:
|
||||
|
||||
virtual void invokeDoricMethod(QString method, QVariantList args) = 0;
|
||||
|
||||
virtual DoricAsyncResult *asyncCall(QRunnable *runnable,
|
||||
DoricThreadMode mode) = 0;
|
||||
|
||||
virtual void createContext(QString contextId, QString script,
|
||||
QString source) = 0;
|
||||
|
||||
|
@ -19,6 +19,11 @@ void DoricNativeDriver::invokeDoricMethod(QString method, QVariantList args) {
|
||||
});
|
||||
}
|
||||
|
||||
DoricAsyncResult *DoricNativeDriver::asyncCall(QRunnable *runnable,
|
||||
DoricThreadMode mode) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void DoricNativeDriver::createContext(QString contextId, QString script,
|
||||
QString source) {
|
||||
DoricAsyncCall::ensureRunInThreadPool(
|
||||
|
@ -26,6 +26,8 @@ public:
|
||||
|
||||
void invokeDoricMethod(QString method, QVariantList args) override;
|
||||
|
||||
DoricAsyncResult * asyncCall(QRunnable *runnable, DoricThreadMode mode) override;
|
||||
|
||||
void createContext(QString contextId, QString script,
|
||||
QString source) override;
|
||||
|
||||
|
@ -76,4 +76,5 @@ HEADERS += \
|
||||
utils/DoricContextHolder.h \
|
||||
utils/DoricCountDownLatch.h \
|
||||
utils/DoricObjectFactory.h \
|
||||
utils/DoricThreadMode.h \
|
||||
utils/DoricUtils.h
|
||||
|
9
doric-Qt/doric/utils/DoricThreadMode.h
Normal file
9
doric-Qt/doric/utils/DoricThreadMode.h
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef DORICTHREADMODE_H
|
||||
#define DORICTHREADMODE_H
|
||||
|
||||
enum DoricThreadMode {
|
||||
UI,
|
||||
JS,
|
||||
};
|
||||
|
||||
#endif // DORICTHREADMODE_H
|
Reference in New Issue
Block a user