add thread mode & async call
This commit is contained in:
parent
24f7bb2498
commit
ceb08bfa1d
@ -1,10 +1,13 @@
|
|||||||
#ifndef INTERFACEDRIVER_H
|
#ifndef INTERFACEDRIVER_H
|
||||||
#define INTERFACEDRIVER_H
|
#define INTERFACEDRIVER_H
|
||||||
|
|
||||||
|
#include <QRunnable>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
#include "DoricRegistry.h"
|
#include "DoricRegistry.h"
|
||||||
|
#include "async/DoricAsyncResult.h"
|
||||||
|
#include "utils/DoricThreadMode.h"
|
||||||
|
|
||||||
class DoricInterfaceDriver {
|
class DoricInterfaceDriver {
|
||||||
public:
|
public:
|
||||||
@ -13,6 +16,9 @@ public:
|
|||||||
|
|
||||||
virtual void invokeDoricMethod(QString method, QVariantList args) = 0;
|
virtual void invokeDoricMethod(QString method, QVariantList args) = 0;
|
||||||
|
|
||||||
|
virtual DoricAsyncResult *asyncCall(QRunnable *runnable,
|
||||||
|
DoricThreadMode mode) = 0;
|
||||||
|
|
||||||
virtual void createContext(QString contextId, QString script,
|
virtual void createContext(QString contextId, QString script,
|
||||||
QString source) = 0;
|
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,
|
void DoricNativeDriver::createContext(QString contextId, QString script,
|
||||||
QString source) {
|
QString source) {
|
||||||
DoricAsyncCall::ensureRunInThreadPool(
|
DoricAsyncCall::ensureRunInThreadPool(
|
||||||
|
@ -26,6 +26,8 @@ public:
|
|||||||
|
|
||||||
void invokeDoricMethod(QString method, QVariantList args) override;
|
void invokeDoricMethod(QString method, QVariantList args) override;
|
||||||
|
|
||||||
|
DoricAsyncResult * asyncCall(QRunnable *runnable, DoricThreadMode mode) override;
|
||||||
|
|
||||||
void createContext(QString contextId, QString script,
|
void createContext(QString contextId, QString script,
|
||||||
QString source) override;
|
QString source) override;
|
||||||
|
|
||||||
|
@ -76,4 +76,5 @@ HEADERS += \
|
|||||||
utils/DoricContextHolder.h \
|
utils/DoricContextHolder.h \
|
||||||
utils/DoricCountDownLatch.h \
|
utils/DoricCountDownLatch.h \
|
||||||
utils/DoricObjectFactory.h \
|
utils/DoricObjectFactory.h \
|
||||||
|
utils/DoricThreadMode.h \
|
||||||
utils/DoricUtils.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