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

Unified Diff: src/JsEngine.cpp

Issue 6233220328718336: Issue #3593, #1197- fix isolate management (Closed)
Patch Set: Created June 11, 2015, 12:45 p.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
« include/AdblockPlus/JsEngine.h ('K') | « include/AdblockPlus/JsEngine.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/JsEngine.cpp
diff --git a/src/JsEngine.cpp b/src/JsEngine.cpp
index 98e0e1b0eadf1929f5d536dd400f9f34a4e30633..232cb398541f5cde25eeebedb648bd1b69150f97 100644
--- a/src/JsEngine.cpp
+++ b/src/JsEngine.cpp
@@ -65,8 +65,18 @@ namespace
};
}
+AdblockPlus::ScopedV8Isolate::ScopedV8Isolate()
+ : isolate(v8::Isolate::New())
Eric 2015/08/05 22:29:16 This is changing the behavior non-trivially, since
sergei 2015/11/16 16:52:09 There is no any default isolate. It `v8::Isolate::
Eric 2015/11/17 21:27:43 Sure there is. See isolate.cc:340 Isolate* Iso
+{
+}
+
+AdblockPlus::ScopedV8Isolate::~ScopedV8Isolate()
+{
+ isolate->Dispose();
Eric 2015/08/05 22:29:16 If we initialize with 'New()' rather than 'GetCurr
sergei 2015/11/16 16:52:09 Do you mean we should create a typedef on `std::sh
Eric 2015/11/17 21:27:43 No.
+ isolate = nullptr;
+}
+
AdblockPlus::JsEngine::JsEngine()
- : isolate(v8::Isolate::GetCurrent())
{
}
@@ -76,7 +86,8 @@ AdblockPlus::JsEnginePtr AdblockPlus::JsEngine::New(const AppInfo& appInfo)
JsEnginePtr result(new JsEngine());
const v8::Locker locker(result->isolate);
- const v8::HandleScope handleScope;
+ const v8::Isolate::Scope isolateScope(result->isolate);
+ const v8::HandleScope handleScope(result->isolate);
result->context.reset(result->isolate, v8::Context::New(result->isolate));
v8::Local<v8::Object> globalContext = v8::Local<v8::Context>::New(
« include/AdblockPlus/JsEngine.h ('K') | « include/AdblockPlus/JsEngine.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld