Index: src/JsEngine.cpp |
=================================================================== |
--- a/src/JsEngine.cpp |
+++ b/src/JsEngine.cpp |
@@ -88,16 +88,30 @@ AdblockPlus::JsValuePtr AdblockPlus::JsE |
const v8::TryCatch tryCatch; |
const v8::Handle<v8::Script> script = CompileScript(source, filename); |
CheckTryCatch(tryCatch); |
v8::Local<v8::Value> result = script->Run(); |
CheckTryCatch(tryCatch); |
return JsValuePtr(new JsValue(shared_from_this(), result)); |
} |
+void AdblockPlus::JsEngine::SetInitCallback(AdblockPlus::JsEngine::InitCallback callback) |
+{ |
+ initCallback = callback; |
+} |
+ |
+void AdblockPlus::JsEngine::InitDone() |
+{ |
+ // Zero out callback immediately to prevent reentrance |
+ InitCallback callback = initCallback; |
+ initCallback = 0; |
+ if (callback) |
+ callback(); |
+} |
+ |
void AdblockPlus::JsEngine::Gc() |
{ |
while (!v8::V8::IdleNotification()); |
} |
AdblockPlus::JsValuePtr AdblockPlus::JsEngine::NewValue(const std::string& val) |
{ |
const Context context(shared_from_this()); |