Index: include/AdblockPlus/JsEngine.h |
diff --git a/include/AdblockPlus/JsEngine.h b/include/AdblockPlus/JsEngine.h |
index c82ae02d5b24cae3c40737c19286968388dc7615..0bb0b89df2d904d1845bb010a72a05bb885d4567 100644 |
--- a/include/AdblockPlus/JsEngine.h |
+++ b/include/AdblockPlus/JsEngine.h |
@@ -52,13 +52,28 @@ namespace AdblockPlus |
typedef std::tr1::shared_ptr<JsEngine> JsEnginePtr; |
/** |
+ * Scope based isolate manager. Creates a new isolate instance on |
+ * constructing and disposes it on destructing. |
+ */ |
+ class ScopedV8Isolate |
Eric
2015/08/05 22:29:16
There's no need for this class. Member constructio
sergei
2015/11/16 16:52:09
Thanks for explanation but this class and construc
|
+ { |
+ public: |
+ ScopedV8Isolate(); |
+ ~ScopedV8Isolate(); |
+ protected: |
+ v8::Isolate* isolate; |
+ }; |
+ |
+ /** |
* JavaScript engine used by `FilterEngine`, wraps v8. |
+ * |
+ * It's inherited from ScopedV8Isolate to have isolate disposed only after |
+ * disposing of all objects which are using it. |
*/ |
Eric
2015/08/05 22:29:16
Keep this comment (after a rewrite) at the declara
sergei
2015/11/16 16:52:09
I've inherited because it's more reliable than the
Eric
2015/11/17 21:27:43
Whatever other reason you might want for it, argui
|
- class JsEngine : public std::tr1::enable_shared_from_this<JsEngine> |
+ class JsEngine : public std::tr1::enable_shared_from_this<JsEngine>, protected ScopedV8Isolate |
{ |
friend class JsValue; |
friend class JsContext; |
- |
public: |
/** |
* Event callback function. |
@@ -213,11 +228,9 @@ namespace AdblockPlus |
private: |
JsEngine(); |
- |
FileSystemPtr fileSystem; |
WebRequestPtr webRequest; |
LogSystemPtr logSystem; |
- v8::Isolate* isolate; |
Eric
2015/08/05 22:29:16
Declared fourth, not first. Just fix it here.
|
V8ValueHolder<v8::Context> context; |
EventMap eventCallbacks; |
}; |