Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/JsContext.cpp

Issue 29361562: Issue 3594 - remove circular references JsEngine-JsValue-JsEngine (Closed)
Patch Set: Created Nov. 3, 2016, 11:26 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/JsContext.cpp
diff --git a/src/JsContext.cpp b/src/JsContext.cpp
index dd8faf6ff4b8c765a18831ebd5dee6d377db7bef..e56ca7fb258b2d38675fe171d1a74cb6ebf973e7 100644
--- a/src/JsContext.cpp
+++ b/src/JsContext.cpp
@@ -16,10 +16,13 @@
*/
#include "JsContext.h"
+#include "Utils.h"
-AdblockPlus::JsContext::JsContext(const JsEnginePtr jsEngine)
- : locker(jsEngine->GetIsolate()), isolateScope(jsEngine->GetIsolate()),
- handleScope(jsEngine->GetIsolate()),
- contextScope(v8::Local<v8::Context>::New(jsEngine->GetIsolate(), *jsEngine->context))
+AdblockPlus::JsContext::JsContext(const std::weak_ptr<JsEngine>& jsEngine)
+ : m_jsEngine(Utils::lockJsEngine(jsEngine))
+ , m_locker(m_jsEngine->GetIsolate())
+ , m_isolateScope(m_jsEngine->GetIsolate())
+ , m_handleScope(m_jsEngine->GetIsolate())
+ , m_contextScope(v8::Local<v8::Context>::New(m_jsEngine->GetIsolate(), *m_jsEngine->context))
{
}

Powered by Google App Engine
This is Rietveld