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

Unified Diff: src/JsEngine.cpp

Issue 10420020: Made sure FilterEngine instances are always initialized (Closed)
Patch Set: Created May 16, 2013, 2:27 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') | test/BaseJsTest.h » ('j') | 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
@@ -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());
« no previous file with comments | « src/GlobalJsObject.cpp ('k') | test/BaseJsTest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld