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

Unified Diff: include/AdblockPlus/JsEngine.h

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 | « include/AdblockPlus/FilterEngine.h ('k') | include/AdblockPlus/tr1_functional.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/AdblockPlus/JsEngine.h
===================================================================
--- a/include/AdblockPlus/JsEngine.h
+++ b/include/AdblockPlus/JsEngine.h
@@ -18,16 +18,17 @@
#ifndef ADBLOCK_PLUS_JS_ENGINE_H
#define ADBLOCK_PLUS_JS_ENGINE_H
#include <stdexcept>
#include <stdint.h>
#include <string>
#include <v8.h>
#include <AdblockPlus/AppInfo.h>
+#include <AdblockPlus/tr1_functional.h>
#include <AdblockPlus/LogSystem.h>
#include <AdblockPlus/FileSystem.h>
#include <AdblockPlus/JsValue.h>
#include <AdblockPlus/WebRequest.h>
#include "tr1_memory.h"
namespace AdblockPlus
@@ -42,17 +43,21 @@ namespace AdblockPlus
class JsEngine;
typedef std::tr1::shared_ptr<JsEngine> JsEnginePtr;
class JsEngine : public std::tr1::enable_shared_from_this<JsEngine>
{
friend class JsValue;
public:
+ typedef std::tr1::function<void()> InitCallback;
+
static JsEnginePtr New(const AppInfo& appInfo = AppInfo());
+ void SetInitCallback(InitCallback callback);
+ void InitDone(void);
JsValuePtr Evaluate(const std::string& source,
const std::string& filename = "");
void Gc();
JsValuePtr NewValue(const std::string& val);
JsValuePtr NewValue(int64_t val);
JsValuePtr NewValue(bool val);
inline JsValuePtr NewValue(const char* val)
{
@@ -95,12 +100,13 @@ namespace AdblockPlus
private:
JsEngine();
FileSystemPtr fileSystem;
WebRequestPtr webRequest;
LogSystemPtr logSystem;
v8::Isolate* isolate;
v8::Persistent<v8::Context> context;
+ InitCallback initCallback;
};
}
#endif
« no previous file with comments | « include/AdblockPlus/FilterEngine.h ('k') | include/AdblockPlus/tr1_functional.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld