summaryrefslogtreecommitdiff
path: root/fxjs/fxjs_v8.h
diff options
context:
space:
mode:
Diffstat (limited to 'fxjs/fxjs_v8.h')
-rw-r--r--fxjs/fxjs_v8.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/fxjs/fxjs_v8.h b/fxjs/fxjs_v8.h
index 0592847bb2..2c53b65d3a 100644
--- a/fxjs/fxjs_v8.h
+++ b/fxjs/fxjs_v8.h
@@ -14,6 +14,7 @@
#ifndef FXJS_FXJS_V8_H_
#define FXJS_FXJS_V8_H_
+#include <functional>
#include <map>
#include <memory>
#include <vector>
@@ -131,17 +132,21 @@ class CFXJS_Engine : public CJS_V8 {
explicit CFXJS_Engine(v8::Isolate* pIsolate);
~CFXJS_Engine() override;
- using Constructor = void (*)(CFXJS_Engine* pEngine,
- v8::Local<v8::Object> obj);
- using Destructor = void (*)(CFXJS_Engine* pEngine, v8::Local<v8::Object> obj);
+ using Constructor =
+ std::function<void(CFXJS_Engine* pEngine, v8::Local<v8::Object> obj)>;
+ using Destructor = std::function<void(v8::Local<v8::Object> obj)>;
static CFXJS_Engine* EngineFromIsolateCurrentContext(v8::Isolate* pIsolate);
static CFXJS_Engine* EngineFromContext(v8::Local<v8::Context> pContext);
- static void SetEngineInContext(CFXJS_Engine* pEngine,
- v8::Local<v8::Context> pContext);
static int GetObjDefnID(v8::Local<v8::Object> pObj);
+ static void SetObjectPrivate(v8::Local<v8::Object> pObj,
+ std::unique_ptr<CJS_Object> p);
+ static void FreeObjectPrivate(v8::Local<v8::Object> pObj);
+
+ void SetIntoContext(v8::Local<v8::Context> pContext);
+
// Always returns a valid, newly-created objDefnID.
int DefineObj(const char* sObjName,
FXJSOBJTYPE eObjType,
@@ -178,12 +183,8 @@ class CFXJS_Engine : public CJS_V8 {
v8::Local<v8::Object> GetThisObj();
v8::Local<v8::Object> NewFXJSBoundObject(int nObjDefnID,
bool bStatic = false);
-
- // Native object binding.
- void SetObjectPrivate(v8::Local<v8::Object> pObj,
- std::unique_ptr<CJS_Object> p);
+ // Retrieve native object binding.
CJS_Object* GetObjectPrivate(v8::Local<v8::Object> pObj);
- static void FreeObjectPrivate(v8::Local<v8::Object> pObj);
void Error(const WideString& message);