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

Unified Diff: src/JsEngine.cpp

Issue 10124007: Thread-safe JS execution (Closed)
Patch Set: Created April 5, 2013, 1:35 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
« no previous file with comments | « src/GlobalJsObject.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/JsEngine.cpp
===================================================================
--- a/src/JsEngine.cpp
+++ b/src/JsEngine.cpp
@@ -8,6 +8,7 @@
v8::Handle<v8::Context> CreateContext(
AdblockPlus::ErrorCallback& errorCallback)
{
+ const v8::Locker locker(v8::Isolate::GetCurrent());
const v8::HandleScope handleScope;
const v8::Handle<v8::ObjectTemplate> global =
AdblockPlus::GlobalJsObject::Create(errorCallback);
@@ -69,6 +70,7 @@
void AdblockPlus::JsEngine::Evaluate(const char* source, const char* filename)
{
+ const v8::Locker locker(v8::Isolate::GetCurrent());
const v8::HandleScope handleScope;
const v8::Context::Scope contextScope(context);
const v8::TryCatch tryCatch;
@@ -94,6 +96,7 @@
std::string AdblockPlus::JsEngine::Call(const std::string& functionName)
{
+ const v8::Locker locker(v8::Isolate::GetCurrent());
const v8::HandleScope handleScope;
const v8::Context::Scope contextScope(context);
const v8::Local<v8::Object> global = context->Global();
« no previous file with comments | « src/GlobalJsObject.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld